Goregonzola Posted February 7, 2021 Share Posted February 7, 2021 (edited) Hello there! I need a tiny bit of help about my custom character: I would like him to change his texture, while he's holding his custom item, and change it back to default, when he unequips it. I've came up with the following coding, but it does nothing in the game (it does not crash though): Spoiler -- Tiger skin local function OnEquipCustom(inst, data) if data.item.prefab == "tigerpan" then inst.AnimState:SetBuild("thejanitiger") end end local function OnUnequipCustom(inst, data) if data.item.prefab == "tigerpan" then inst.AnimState:SetBuild("thejani") end end I've put this into the character prefab's master postnit section. The "tigerpan" is the custom item, "thejanitiger" is the texture he should equip with the item (it has a full texture folder inside the export folder), and "thejani" is his default texture folder. What do I do wrong? Edited February 8, 2021 by BillTheCipher Link to comment Share on other sites More sharing options...
Thomas Die Posted February 7, 2021 Share Posted February 7, 2021 (edited) Maybe include the anim assets to your prefab as well. local assets = { Asset("SCRIPT", "scripts/prefabs/player_common.lua"), Asset("ANIM", "anim/name_of_file.zip"), } Edited February 7, 2021 by thomas4846 Link to comment Share on other sites More sharing options...
Goregonzola Posted February 7, 2021 Author Share Posted February 7, 2021 (edited) @thomas4846 Oof... I've totally forgot that. Thanks! I added it to the assets, but the game doesn't compiles the textures into an anim ZIP for some reason. Is there something else I'm missing out? Edited February 7, 2021 by BillTheCipher Link to comment Share on other sites More sharing options...
Thomas Die Posted February 7, 2021 Share Posted February 7, 2021 Ehh sorry brain lag, uhh what do you mean by that? Link to comment Share on other sites More sharing options...
Goregonzola Posted February 7, 2021 Author Share Posted February 7, 2021 @thomas4846 When I run the autocomplier, it doesn't generate an anim ZIP file - neither into the "thejanitiger" export folder, neither into the anim folder. This is the only two coding that currently contains "thejanitiger" (alias the equip skin): Spoiler local assets = { Asset("SCRIPT", "scripts/prefabs/player_common.lua"), Asset( "ANIM", "anim/thejanitiger.zip" ), } Spoiler -- Tiger skin local function OnEquipCustom(inst, data) if data.item.prefab == "tigerpan" then inst.AnimState:SetBuild("thejanitiger") end end local function OnUnequipCustom(inst, data) if data.item.prefab == "tigerpan" then inst.AnimState:SetBuild("thejani") end end Is there anywhere else I should reference the "thejanitiger" texture, or the problem is rooted in something else? Link to comment Share on other sites More sharing options...
Thomas Die Posted February 7, 2021 Share Posted February 7, 2021 Ngl having troubles with the compiler myself. Can't help with that soz Link to comment Share on other sites More sharing options...
Goregonzola Posted February 7, 2021 Author Share Posted February 7, 2021 (edited) @thomas4846 I figured it out: I've accidently named the hair files to hair_hat. Silly me However, his texture still not changes when he equips his item Edited February 7, 2021 by BillTheCipher Link to comment Share on other sites More sharing options...
Thomas Die Posted February 7, 2021 Share Posted February 7, 2021 Eyo can ya pass the file I'll fix it i can. Link to comment Share on other sites More sharing options...
Goregonzola Posted February 8, 2021 Author Share Posted February 8, 2021 @thomas4846 Voilá! LeVR.rar Link to comment Share on other sites More sharing options...
Thomas Die Posted February 8, 2021 Share Posted February 8, 2021 inst:ListenForEvent("equip", function(inst, data) if data.item.prefab == "tigerpan" then inst.AnimState:SetBuild("thejanitiger") end end) inst:ListenForEvent("unequip", function(inst, data) if data.item.prefab == "tigerpan" then inst.AnimState:SetBuild("thejani") end end) you forgot to call the functions 1 Link to comment Share on other sites More sharing options...
Goregonzola Posted February 8, 2021 Author Share Posted February 8, 2021 @thomas4846 Dang, that's some advanced brainfart from me... Much thanks! Link to comment Share on other sites More sharing options...
Thomas Die Posted February 8, 2021 Share Posted February 8, 2021 happens to to best of us =) Link to comment 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