Jump to content

Recommended Posts

Please help me!It's my first time making a mod.

I don't want to set the inventory image separately for each prefab. And I want minisign worked.

So I imitate Island Adventure mod. I almost made it.

I packed all my tex files into one file. And I imported it as forum do 

Assets = {
    Asset("ATLAS", "images/ws_inventoryimages.xml"),
    Asset("IMAGE", "images/ws_inventoryimages.tex"),
    Asset("ATLAS_BUILD", "images/ws_inventoryimages.xml", 256)
}

Here's part of my code:

local UpvalueHacker = require('utils/upvaluehacker')
GLOBAL.require("simutil")
local GetInventoryItemAtlas_old = GLOBAL.GetInventoryItemAtlas
local inventoryItemAtlasLookup = UpvalueHacker.GetUpvalue(
                                     GLOBAL.GetInventoryItemAtlas,
                                     "inventoryItemAtlasLookup")
local ws_inventoryimages = GLOBAL.resolvefilepath(
                               "images/ws_inventoryimages.xml")
 
GLOBAL.GetInventoryItemAtlas = function(imagename)
    if inventoryItemAtlasLookup[imagename] then
        return inventoryItemAtlasLookup[imagename]
    end
    if GLOBAL.TheSim:AtlasContains(ws_inventoryimages, imagename) then
        inventoryItemAtlasLookup[imagename] = ws_inventoryimages
        return ws_inventoryimages
    end
    return GetInventoryItemAtlas_old(imagename)
end

But inventory image don't appear when I enter the game.

My item's inventory image just become a black square.

image.png.7869401006d6df4f7c0b2f92eb55bab0.png

After I draw my item on minisign. It worked! Not being a black square again.

I don't know why.

Apparently it related to this line:

inst.AnimState:OverrideSymbol("SWAP_SIGN", atlas or
                                          GetInventoryItemAtlas(image .. ".tex"),
                                      image .. ".tex")

But I can't find definition of AnimState:OverrideSymbol

I don't know why it can make inventory image work again.

What can I do to fix this?

This tormented me a lot. I would appreciate it if someone could help me! Thanks

Edited by Shigeo Kageyama

Thanks for Jerry002's help. I resolved it.

It's because wrong file format

I used Simple TEX Atlas Packer 0.2.0.2 in the past. It has some problem with size. Inventory image size must be 64*64. The packer sometimes generate 64*65.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...