. . . Posted September 27, 2016 Share Posted September 27, 2016 (edited) Hello, I have a question . So, I have a item which I want to change it's animstate to " owner.AnimState:OverrideSymbol("swap_object", "swap_kunai_digging", "kunai") " then when the owner's not in dig state the animstate changes back to " owner.AnimState:OverrideSymbol("swap_object", "swap_kunai", "kunai") " would anyone know how to do that? Because I don't ... I would really appreciate some help !!! Edited September 29, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/70497-solved-how-to-swap-items-animstate-when-owner-digs/ Share on other sites More sharing options...
. . . Posted September 28, 2016 Author Share Posted September 28, 2016 Well I tried something like this local function OnDig(inst, owner) owner.AnimState:OverrideSymbol("swap_object", "swap_kunai_digging", "kunai") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") owner:DoTaskInTime(2, function() owner.AnimState:OverrideSymbol("swap_object", "swap_kunai", "kunai") end) end local function fn(colour) inst:ListenForEvent("ACTIONS.DIG", OnDig) end and nothing happened, not even a crash . Link to comment https://forums.kleientertainment.com/forums/topic/70497-solved-how-to-swap-items-animstate-when-owner-digs/#findComment-819473 Share on other sites More sharing options...
. . . Posted September 29, 2016 Author Share Posted September 29, 2016 Help...? Please...! Link to comment https://forums.kleientertainment.com/forums/topic/70497-solved-how-to-swap-items-animstate-when-owner-digs/#findComment-819918 Share on other sites More sharing options...
DarkXero Posted September 29, 2016 Share Posted September 29, 2016 local function OnNewState(inst, data) local using_kunai = inst.replica.inventory:EquipHasTag("kunai") if using_kunai then local statename = data and data.statename if statename == "dig_start" or statename == "dig" then inst.AnimState:OverrideSymbol("swap_object", "swap_kunai_digging", "kunai") else inst.AnimState:OverrideSymbol("swap_object", "swap_kunai", "kunai") end end end local function KunaiFix(inst) inst:ListenForEvent("newstate", OnNewState) end AddPlayerPostInit(KunaiFix) And add the "kunai" tag to your custom shovel item. Link to comment https://forums.kleientertainment.com/forums/topic/70497-solved-how-to-swap-items-animstate-when-owner-digs/#findComment-819941 Share on other sites More sharing options...
. . . Posted September 29, 2016 Author Share Posted September 29, 2016 1 hour ago, DarkXero said: local function OnNewState(inst, data) local using_kunai = inst.replica.inventory:EquipHasTag("kunai") if using_kunai then local statename = data and data.statename if statename == "dig_start" or statename == "dig" then inst.AnimState:OverrideSymbol("swap_object", "swap_kunai_digging", "kunai") else inst.AnimState:OverrideSymbol("swap_object", "swap_kunai", "kunai") end end end local function KunaiFix(inst) inst:ListenForEvent("newstate", OnNewState) end AddPlayerPostInit(KunaiFix) And add the "kunai" tag to your custom shovel item. Thanks so much !!! I'm just sorry but can you tell me where to put the codes, i'm dumb hahaha .... Link to comment https://forums.kleientertainment.com/forums/topic/70497-solved-how-to-swap-items-animstate-when-owner-digs/#findComment-819968 Share on other sites More sharing options...
DarkXero Posted September 29, 2016 Share Posted September 29, 2016 Modmain. Link to comment https://forums.kleientertainment.com/forums/topic/70497-solved-how-to-swap-items-animstate-when-owner-digs/#findComment-819969 Share on other sites More sharing options...
. . . Posted September 29, 2016 Author Share Posted September 29, 2016 I added it to modmain & got this crash Link to comment https://forums.kleientertainment.com/forums/topic/70497-solved-how-to-swap-items-animstate-when-owner-digs/#findComment-819976 Share on other sites More sharing options...
DarkXero Posted September 29, 2016 Share Posted September 29, 2016 Huh. local function OnNewState(inst, data) local using_kunai = inst.replica.inventory and inst.replica.inventory:EquipHasTag("kunai") if using_kunai then local statename = data and data.statename if statename == "dig_start" or statename == "dig" then inst.AnimState:OverrideSymbol("swap_object", "swap_kunai_digging", "kunai") else inst.AnimState:OverrideSymbol("swap_object", "swap_kunai", "kunai") end end end local function KunaiFix(inst) inst:ListenForEvent("newstate", OnNewState) end AddPlayerPostInit(KunaiFix) I forgot that happened. Use this instead. Link to comment https://forums.kleientertainment.com/forums/topic/70497-solved-how-to-swap-items-animstate-when-owner-digs/#findComment-819979 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