Jump to content

[HELP] Item picture won't show in the Item bar?


Recommended Posts

Hello, I need some help with my mod, I tried to make a hat for my character, but it seems that the Inventory image and description (when you hover over it it should say the name and right click to wear and left click to inspect) are missing. However I can wear  the hat and On the ground I can see the hat and the description from it.  I checked the log to see this:

WARNING! Could not find region 'hat_d.tex' from atlas 'images/inventoryimages.xml'. Is the region specified in the atlas?
images/inventoryimages.xml  


Yes, both files "hat_d.tex" and "hat_d.xml" are in the mod/images/inventoryimages folder.

I'd appreciate some help and I'll attack some pictures for better understanding

2HG4dcb.jpg
Daj9Ll1.jpg
Link to comment
Share on other sites

 

Hello, I need some help with my mod, I tried to make a hat for my character, but it seems that the Inventory image and description (when you hover over it it should say the name and right click to wear and left click to inspect) are missing. However I can wear  the hat and On the ground I can see the hat and the description from it.  I checked the log to see this:
WARNING! Could not find region 'hat_d.tex' from atlas 'images/inventoryimages.xml'. Is the region specified in the atlas?
images/inventoryimages.xml

Yes, both files "hat_d.tex" and "hat_d.xml" are in the mod/images/inventoryimages folder.

I'd appreciate some help and I'll attack some pictures for better understanding

 

 

What tex files are referenced in the xml file?

 

Could you post your code? You're referencing the inventoryimages.xml, which does contain your tex.

Link to comment
Share on other sites

Code in the hat_d.lua?

 local assets = {  
  Asset("ANIM", "anim/hat_d.zip"),
   Asset("IMAGE", "images/inventoryimages/hat_d.tex"),   
   Asset("ATLAS", "images/inventoryimages/hat_d.xml"),
 
}
 
local function onequip(inst, owner)
        owner.AnimState:OverrideSymbol("swap_hat", "hat_d", "swap_hat")
        owner.AnimState:Show("HAT")
        owner.AnimState:Show("HAT_HAIR")
        owner.AnimState:Hide("HAIR_NOHAT")
        owner.AnimState:Hide("HAIR")
        
        if owner:HasTag("player") then
owner.AnimState:Hide("HEAD")
owner.AnimState:Show("HEAD_HAIR")
end
    
    end
 
local function onunequip(inst, owner) 
        owner.AnimState:Hide("HAT")
        owner.AnimState:Hide("HAT_HAIR")
        owner.AnimState:Show("HAIR_NOHAT")
        owner.AnimState:Show("HAIR")
 
if owner:HasTag("player") then
       owner.AnimState:Show("HEAD")
owner.AnimState:Hide("HEAD_HAIR")
end
end
 
 
 
 
local function fn(Sim)
local inst = CreateEntity()
local trans = inst.entity:AddTransform()
local anim = inst.entity:AddAnimState()
    MakeInventoryPhysics(inst)
    
inst:AddTag("hat")
    
anim:SetBank("earmuffshat")
    anim:SetBuild("hat_d")
    anim:PlayAnimation("anim")
 
inst:AddComponent("inspectable")
   
    inst:AddComponent("inventoryitem")
inst.components.inventoryitem.atlasname = "images/inventoryimages/hat_d.xml"
 
    inst:AddComponent("insulator")
    inst.components.insulator.insulation = 50
    
    inst:AddComponent("inventoryitem")
    inst:AddComponent("tradable")
 
    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.HEAD
 
    inst.components.equippable:SetOnEquip( onequip )
 
    inst.components.equippable:SetOnUnequip( onunequip )
 
 
    return inst
end
 
return Prefab( "common/inventory/hat_d", fn, assets)  
Link to comment
Share on other sites

 

Code in the hat_d.lua?

 local assets = {  
  Asset("ANIM", "anim/hat_d.zip"),
   Asset("IMAGE", "images/inventoryimages/hat_d.tex"),   
   Asset("ATLAS", "images/inventoryimages/hat_d.xml"),
 
}
 
local function onequip(inst, owner)
        owner.AnimState:OverrideSymbol("swap_hat", "hat_d", "swap_hat")
        owner.AnimState:Show("HAT")
        owner.AnimState:Show("HAT_HAIR")
        owner.AnimState:Hide("HAIR_NOHAT")
        owner.AnimState:Hide("HAIR")
        
        if owner:HasTag("player") then
owner.AnimState:Hide("HEAD")
owner.AnimState:Show("HEAD_HAIR")
end
    
    end
 
local function onunequip(inst, owner) 
        owner.AnimState:Hide("HAT")
        owner.AnimState:Hide("HAT_HAIR")
        owner.AnimState:Show("HAIR_NOHAT")
        owner.AnimState:Show("HAIR")
 
if owner:HasTag("player") then
       owner.AnimState:Show("HEAD")
owner.AnimState:Hide("HEAD_HAIR")
end
end
 
 
 
 
local function fn(Sim)
local inst = CreateEntity()
local trans = inst.entity:AddTransform()
local anim = inst.entity:AddAnimState()
    MakeInventoryPhysics(inst)
    
inst:AddTag("hat")
    
anim:SetBank("earmuffshat")
    anim:SetBuild("hat_d")
    anim:PlayAnimation("anim")
 
inst:AddComponent("inspectable")
   
    inst:AddComponent("inventoryitem")
inst.components.inventoryitem.atlasname = "images/inventoryimages/hat_d.xml"
 
    inst:AddComponent("insulator")
    inst.components.insulator.insulation = 50
    
    inst:AddComponent("inventoryitem")
    inst:AddComponent("tradable")
 
    inst:AddComponent("equippable")
    inst.components.equippable.equipslot = EQUIPSLOTS.HEAD
 
    inst.components.equippable:SetOnEquip( onequip )
 
    inst.components.equippable:SetOnUnequip( onunequip )
 
 
    return inst
end
 
return Prefab( "common/inventory/hat_d", fn, assets)  

 

 

What does your xml file look like?

Link to comment
Share on other sites

Add this to your modmain.lua:

 

InventoryImageAssets {

    "hat_d",

}

Anywhere in specific?

 PrefabFiles = {
"clem",
"hat_d",
}
 
Assets = {
    Asset( "IMAGE", "images/saveslot_portraits/clem.tex" ),
    Asset( "ATLAS", "images/saveslot_portraits/clem.xml" ),
 
    Asset( "IMAGE", "images/selectscreen_portraits/clem.tex" ),
    Asset( "ATLAS", "images/selectscreen_portraits/clem.xml" ),
 
    Asset( "IMAGE", "images/selectscreen_portraits/clem_silho.tex" ),
    Asset( "ATLAS", "images/selectscreen_portraits/clem_silho.xml" ),
 
    Asset( "IMAGE", "bigportraits/clem.tex" ),
    Asset( "ATLAS", "bigportraits/clem.xml" ),
 
Asset( "IMAGE", "images/inventoryimages/hat_d.tex"),
Asset( "ATLAS", "images/inventoryimages/hat_d.xml"),
 
}
 
 
 
-- You can also add any kind of custom dialogue that you would like. Don't forget to make
-- categores that don't exist yet using = {}
-- note: these are UPPER-CASE charcacter name
 
GLOBAL.STRINGS.NAMES.HAT_D = "Clementine's Hat"
GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.HAT_D = "I'll miss you..."
GLOBAL.STRINGS.CHARACTERS.clem = {}
GLOBAL.STRINGS.CHARACTERS.clem.DESCRIBE = {}
GLOBAL.STRINGS.CHARACTERS.clem.DESCRIBE.EVERGREEN = "A template description of a tree."
 
-- Let the game know Wod is a male, for proper pronouns during the end-game sequence.
-- Possible genders here are MALE, FEMALE, or ROBOT
table.insert(GLOBAL.CHARACTER_GENDERS.FEMALE, "clem")
 
AddPrefabPostInit('hat_pine')
 
AddModCharacter("clem")

I tried adding it under "Assets = { 

}
 but it crashed my game on start
Link to comment
Share on other sites

 

Anywhere in specific?

 PrefabFiles = {
"clem",
"hat_d",
}
 
Assets = {
    Asset( "IMAGE", "images/saveslot_portraits/clem.tex" ),
    Asset( "ATLAS", "images/saveslot_portraits/clem.xml" ),
 
    Asset( "IMAGE", "images/selectscreen_portraits/clem.tex" ),
    Asset( "ATLAS", "images/selectscreen_portraits/clem.xml" ),
 
    Asset( "IMAGE", "images/selectscreen_portraits/clem_silho.tex" ),
    Asset( "ATLAS", "images/selectscreen_portraits/clem_silho.xml" ),
 
    Asset( "IMAGE", "bigportraits/clem.tex" ),
    Asset( "ATLAS", "bigportraits/clem.xml" ),
 
Asset( "IMAGE", "images/inventoryimages/hat_d.tex"),
Asset( "ATLAS", "images/inventoryimages/hat_d.xml"),
 
}
 
 
 
-- You can also add any kind of custom dialogue that you would like. Don't forget to make
-- categores that don't exist yet using = {}
-- note: these are UPPER-CASE charcacter name
 
GLOBAL.STRINGS.NAMES.HAT_D = "Clementine's Hat"
GLOBAL.STRINGS.CHARACTERS.GENERIC.DESCRIBE.HAT_D = "I'll miss you..."
GLOBAL.STRINGS.CHARACTERS.clem = {}
GLOBAL.STRINGS.CHARACTERS.clem.DESCRIBE = {}
GLOBAL.STRINGS.CHARACTERS.clem.DESCRIBE.EVERGREEN = "A template description of a tree."
 
-- Let the game know Wod is a male, for proper pronouns during the end-game sequence.
-- Possible genders here are MALE, FEMALE, or ROBOT
table.insert(GLOBAL.CHARACTER_GENDERS.FEMALE, "clem")
 
AddPrefabPostInit('hat_pine')
 
AddModCharacter("clem")

I tried adding it under "Assets = { 

}
 but it crashed my game on start

 

 

With what error?

Link to comment
Share on other sites

you have called

inst:AddComponent("inventoryitem")

twice. Apparently second call replaces your atlas with default one, which is why your atlas isn't even getting called (as original message suggests, default is images/inventoryimages.xml). Remove the second AddComponent call.

Link to comment
Share on other sites

you have called

inst:AddComponent("inventoryitem")

twice. Apparently second call replaces your atlas with default one, which is why your atlas isn't even getting called (as original message suggests, default is images/inventoryimages.xml). Remove the second AddComponent call.

-Snip-

Nevermind that worked, had to clean up some stuff in my prefab's code too.

Thanks you both I really appreciate it, want your names in the workshop page?

Link to comment
Share on other sites

Add this to your modmain.lua:

 

InventoryImageAssets {

    "hat_d",

}

You're too used to U&A, in order to use this syntax he'd have to modimport our asset_utils.lua script :razz:. The atlas and textyre assets should be declared as they are in the prefab file.

But anyway, the major issue is the double component adding pointed out by @DeathDisciple.

EDIT:

Deleted the second one, still get the error.

Which exact error?

Link to comment
Share on other sites

You're too used to U&A, in order to use this syntax he'd have to modimport our asset_utils.lua script :razz:. The atlas and textyre assets should be declared as they are in the prefab file.

But anyway, the major issue is the double component adding pointed out by @DeathDisciple.

EDIT:

Which exact error?

I edited my post, my hat works now, thanks :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...