MidrealmDM Posted April 21, 2014 Share Posted April 21, 2014 Ive created a hat-type item and everything appears to work except -when the item is equipped, it becomes invisible. It appears in the character's inventory fine, and in the build menu of the science engine. The log file doesn't seem to show any reason for this error. withing the modmain.luaAssets = { Asset( "IMAGE", "images/inventoryimages/logicfilter.tex" ), Asset( "ATLAS", "images/inventoryimages/logicfilter.xml" ), } within the Item's Lua filelocal assets= { Asset("ANIM", "anim/logicfilter.zip"), Asset("ATLAS", "images/inventoryimages/logicfilter.xml"), } local function onequip(inst, owner) owner.AnimState:OverrideSymbol("swap_hat", "logicfilter", "swap_hat") owner.AnimState:Show("HAT") owner.AnimState:Hide("HAT_HAIR") owner.AnimState:Show("HAIR_NOHAT") owner.AnimState:Show("HAIR") owner.AnimState:Show("HEAD") owner.AnimState:Hide("HEAD_HAIR") end local function fn(Sim) local inst = CreateEntity() local trans = inst.entity:AddTransform() local anim = inst.entity:AddAnimState() MakeInventoryPhysics(inst) inst:AddTag("hat") inst.AnimState:SetBank("footballhat") inst.AnimState:SetBuild("logicfilter") inst.AnimState:PlayAnimation("anim") inst:AddComponent("inspectable") inst:AddComponent("equippable") inst.components.equippable.equipslot = EQUIPSLOTS.HEAD inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/logicfilter.xml" return inst end I'm certain I am missing something obvious....but I have no idea what. I checked the atlas-0.tex, in the logicfilter.zip file and it is good, as best I can tell.and I used an editor to change the build.bin to the proper name.I left the anim.bin alone (leaving the default footballhat) Link to comment Share on other sites More sharing options...
debugman18 Posted April 21, 2014 Share Posted April 21, 2014 Ive created a hat-type item and everything appears to work except -when the item is equipped, it becomes invisible. It appears in the character's inventory fine, and in the build menu of the science engine. The log file doesn't seem to show any reason for this error. withing the modmain.luaAssets = { Asset( "IMAGE", "images/inventoryimages/logicfilter.tex" ), Asset( "ATLAS", "images/inventoryimages/logicfilter.xml" ), } within the Item's Lua filelocal assets= { Asset("ANIM", "anim/logicfilter.zip"), Asset("ATLAS", "images/inventoryimages/logicfilter.xml"), } local function onequip(inst, owner) owner.AnimState:OverrideSymbol("swap_hat", "logicfilter", "swap_hat") owner.AnimState:Show("HAT") owner.AnimState:Hide("HAT_HAIR") owner.AnimState:Show("HAIR_NOHAT") owner.AnimState:Show("HAIR") owner.AnimState:Show("HEAD") owner.AnimState:Hide("HEAD_HAIR") end local function fn(Sim) local inst = CreateEntity() local trans = inst.entity:AddTransform() local anim = inst.entity:AddAnimState() MakeInventoryPhysics(inst) inst:AddTag("hat") inst.AnimState:SetBank("footballhat") inst.AnimState:SetBuild("logicfilter") inst.AnimState:PlayAnimation("anim") inst:AddComponent("inspectable") inst:AddComponent("equippable") inst.components.equippable.equipslot = EQUIPSLOTS.HEAD inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/logicfilter.xml" return inst end I'm certain I am missing something obvious....but I have no idea what. I checked the atlas-0.tex, in the logicfilter.zip file and it is good, as best I can tell.and I used an editor to change the build.bin to the proper name.I left the anim.bin alone (leaving the default footballhat) A question: Is the zip file you're loading the ground animation or the swap animation for the hat? It seems to me that you're missing the swap animation for your hat. Link to comment Share on other sites More sharing options...
MidrealmDM Posted April 22, 2014 Author Share Posted April 22, 2014 A question: Is the zip file you're loading the ground animation or the swap animation for the hat? It seems to me that you're missing the swap animation for your hat. I copied the football hat zip so it should have both,the graphic (atlas-0.tex) shows both the ground and equipped images. is the swap animation file defined seperately? Link to comment Share on other sites More sharing options...
debugman18 Posted April 22, 2014 Share Posted April 22, 2014 I copied the football hat zip so it should have both,the graphic (atlas-0.tex) shows both the ground and equipped images. is the swap animation file defined seperately? Yes. Link to comment Share on other sites More sharing options...
MidrealmDM Posted April 22, 2014 Author Share Posted April 22, 2014 Yes. Could you tell me where? Link to comment Share on other sites More sharing options...
debugman18 Posted April 22, 2014 Share Posted April 22, 2014 Could you tell me where? Should be swap_football_helmet or something like that. Link to comment Share on other sites More sharing options...
NikMik Posted April 22, 2014 Share Posted April 22, 2014 Should be swap_football_helmet or something like that.Not for hats, no. Just hand-held items. Link to comment Share on other sites More sharing options...
debugman18 Posted April 22, 2014 Share Posted April 22, 2014 Not for hats, no. Just hand-held items. Oh, I could've sworn hats had it too. I feel silly. @MidrealmDMActually, it's simple, sorry.inst.components.equippable:SetOnEquip(onequip)inst.components.equippable:SetOnUnequip(onunequip) Link to comment Share on other sites More sharing options...
Recommended Posts
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.