Grifuz Posted May 10, 2014 Share Posted May 10, 2014 (edited) 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 Edited May 10, 2014 by Grifuz Link to comment https://forums.kleientertainment.com/forums/topic/36303-help-item-picture-wont-show-in-the-item-bar/ Share on other sites More sharing options...
debugman18 Posted May 10, 2014 Share Posted May 10, 2014 (edited) 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. Edited May 10, 2014 by debugman18 Link to comment https://forums.kleientertainment.com/forums/topic/36303-help-item-picture-wont-show-in-the-item-bar/#findComment-477465 Share on other sites More sharing options...
Grifuz Posted May 10, 2014 Author Share Posted May 10, 2014 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") thenowner.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")endend 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 instend return Prefab( "common/inventory/hat_d", fn, assets) Link to comment https://forums.kleientertainment.com/forums/topic/36303-help-item-picture-wont-show-in-the-item-bar/#findComment-477472 Share on other sites More sharing options...
debugman18 Posted May 10, 2014 Share Posted May 10, 2014 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") thenowner.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")endend 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 instend return Prefab( "common/inventory/hat_d", fn, assets) What does your xml file look like? Link to comment https://forums.kleientertainment.com/forums/topic/36303-help-item-picture-wont-show-in-the-item-bar/#findComment-477473 Share on other sites More sharing options...
Grifuz Posted May 10, 2014 Author Share Posted May 10, 2014 What does your xml file look like? <Atlas><Texture filename="hat_d.tex" /> <Elements><Element name="hat_d.tex" u1="0" u2="1" v1="0" v2="1" /></Elements></Atlas> Link to comment https://forums.kleientertainment.com/forums/topic/36303-help-item-picture-wont-show-in-the-item-bar/#findComment-477478 Share on other sites More sharing options...
debugman18 Posted May 10, 2014 Share Posted May 10, 2014 (edited) Add this to your modmain.lua InventoryImageAssets { "hat_d",} Just add the tex and xml to your assets table in modmain.lua. Edited May 10, 2014 by debugman18 Link to comment https://forums.kleientertainment.com/forums/topic/36303-help-item-picture-wont-show-in-the-item-bar/#findComment-477498 Share on other sites More sharing options...
Grifuz Posted May 10, 2014 Author Share Posted May 10, 2014 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 ROBOTtable.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 https://forums.kleientertainment.com/forums/topic/36303-help-item-picture-wont-show-in-the-item-bar/#findComment-477500 Share on other sites More sharing options...
debugman18 Posted May 10, 2014 Share Posted May 10, 2014 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 ROBOTtable.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 https://forums.kleientertainment.com/forums/topic/36303-help-item-picture-wont-show-in-the-item-bar/#findComment-477502 Share on other sites More sharing options...
Grifuz Posted May 10, 2014 Author Share Posted May 10, 2014 Couldn't find where it was exactly in the log, sorry. Link to comment https://forums.kleientertainment.com/forums/topic/36303-help-item-picture-wont-show-in-the-item-bar/#findComment-477511 Share on other sites More sharing options...
DeathDisciple Posted May 10, 2014 Share Posted May 10, 2014 you have calledinst: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 https://forums.kleientertainment.com/forums/topic/36303-help-item-picture-wont-show-in-the-item-bar/#findComment-477515 Share on other sites More sharing options...
Grifuz Posted May 10, 2014 Author Share Posted May 10, 2014 (edited) you have calledinst: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? Edited May 10, 2014 by Grifuz Link to comment https://forums.kleientertainment.com/forums/topic/36303-help-item-picture-wont-show-in-the-item-bar/#findComment-477524 Share on other sites More sharing options...
simplex Posted May 10, 2014 Share Posted May 10, 2014 (edited) 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 . 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? Edited May 11, 2014 by simplex Link to comment https://forums.kleientertainment.com/forums/topic/36303-help-item-picture-wont-show-in-the-item-bar/#findComment-477525 Share on other sites More sharing options...
debugman18 Posted May 11, 2014 Share Posted May 11, 2014 You're too used to U&A, in order to use this syntax he'd have to modimport our asset_utils.lua script . Yes, I came upon that realization. :/ Link to comment https://forums.kleientertainment.com/forums/topic/36303-help-item-picture-wont-show-in-the-item-bar/#findComment-477530 Share on other sites More sharing options...
Grifuz Posted May 11, 2014 Author Share Posted May 11, 2014 You're too used to U&A, in order to use this syntax he'd have to modimport our asset_utils.lua script . 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 https://forums.kleientertainment.com/forums/topic/36303-help-item-picture-wont-show-in-the-item-bar/#findComment-477545 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now