. . . Posted August 26, 2016 Share Posted August 26, 2016 (edited) Hello, I need help fixing a weird anim glitch. So, when my character attacks with his fists while insane instead of playing the punch anim he plays the throw anim & that's how I want it to be. The problem is if you equip a item then attack with your fists while insane the item you last held will show up when you use the throw anim & I don't know how to fix that ... Here's gifs they show more of what's the problem. This how it should look like always (but it only is like this when you never equip a item, once you equip a item you have to relog for the item to go away from the anim) This's how the anim becomes after you equip a item (in the example I equipped a nightsword & unequipped it but as you can see it's still in the throw anim...) I would love any help, thank you a lot for reading !!! BTW here's the code that changes my character's punch anim when he goes insane & stuff if anyone needs to edit it to help me. local function HackState(sg, state) local _attack_onenter = sg.states[state]["onenter"] sg.states[state]["onenter"] = function(inst) _attack_onenter(inst) local needs_fix = inst.prefab == "adam" and not inst.replica.inventory:GetEquippedItem(GLOBAL.EQUIPSLOTS.HANDS) if needs_fix and inst.replica.sanity:IsSane() then inst.sg.statemem.isbeaver = nil inst.AnimState:PlayAnimation("punch") inst.sg:SetTimeout(24 * GLOBAL.FRAMES) elseif needs_fix and not inst.replica.sanity:IsSane() then inst.sg.statemem.isbeaver = nil inst.AnimState:PlayAnimation("throw") inst.sg:SetTimeout(14 * GLOBAL.FRAMES) end end end local function HackAttack(sg) HackState(sg, "attack") HackState(sg, "dojostleaction") end AddStategraphPostInit("wilson", HackAttack) AddStategraphPostInit("wilson_client", HackAttack) Edited September 1, 2016 by SuperDavid Link to comment Share on other sites More sharing options...
DarkXero Posted August 26, 2016 Share Posted August 26, 2016 Because unlike armor and backpacks, the game doesn't really have to clear the swap_object symbol. It just switches the arm shown. inst:ListenForEvent("unequip", function(inst, data) if data and data.eslot == EQUIPSLOTS.HANDS then inst.AnimState:ClearOverrideSymbol("swap_object") end end) Put this in your master_postinit to clear the symbol. Link to comment Share on other sites More sharing options...
. . . Posted August 26, 2016 Author Share Posted August 26, 2016 @DarkXero Thank you very much !!! Link to comment Share on other sites More sharing options...
. . . Posted September 1, 2016 Author Share Posted September 1, 2016 @DarkXero Sorry to bother you but can I maybe ask how I would do something? This's the code I need help with local function HackState(sg, state) local _attack_onenter = sg.states[state]["onenter"] sg.states[state]["onenter"] = function(inst) _attack_onenter(inst) local needs_fix = inst.prefab == "adam" and not inst.replica.inventory:GetEquippedItem(GLOBAL.EQUIPSLOTS.HANDS) if needs_fix and inst.replica.sanity:IsSane() then inst.sg.statemem.isbeaver = nil inst.AnimState:PlayAnimation("punch") inst.sg:SetTimeout(24 * GLOBAL.FRAMES) elseif needs_fix and not inst.replica.sanity:IsSane() then inst.sg.statemem.isbeaver = nil inst.AnimState:PlayAnimation("throw") inst.sg:SetTimeout(14 * GLOBAL.FRAMES) end end end local function HackAttack(sg) HackState(sg, "attack") HackState(sg, "dojostleaction") end AddStategraphPostInit("wilson", HackAttack) AddStategraphPostInit("wilson_client", HackAttack) So, what I need help is when my character enters gelid mode I want this elseif needs_fix and not inst.replica.sanity:IsSane() then inst.sg.statemem.isbeaver = nil inst.AnimState:PlayAnimation("throw") inst.sg:SetTimeout(14 * GLOBAL.FRAMES) to be replaced with this elseif needs_fix and not inst.replica.sanity:IsSane() then inst.sg.statemem.isbeaver = nil inst.AnimState:PlayAnimation("throw") inst.sg:SetTimeout(24 * GLOBAL.FRAMES) I tried doing something like local function HackState(sg, state) local _attack_onenter = sg.states[state]["onenter"] sg.states[state]["onenter"] = function(inst) _attack_onenter(inst) local needs_fix = inst.prefab == "adam" and not inst.replica.inventory:GetEquippedItem(GLOBAL.EQUIPSLOTS.HANDS) if needs_fix and inst.replica.sanity:IsSane() then inst.sg.statemem.isbeaver = nil inst.AnimState:PlayAnimation("punch") inst.sg:SetTimeout(24 * GLOBAL.FRAMES) elseif needs_fix and not inst.replica.sanity:IsSane() and inst.gelid_mode == nil then inst.sg.statemem.isbeaver = nil inst.AnimState:PlayAnimation("throw") inst.sg:SetTimeout(14 * GLOBAL.FRAMES) elseif needs_fix and not inst.replica.sanity:IsSane() and inst.gelid_mode == true then inst.sg.statemem.isbeaver = nil inst.AnimState:PlayAnimation("throw") inst.sg:SetTimeout(24 * GLOBAL.FRAMES) end end end but that didn't work. Could you maybe tell me if this would even be possible or not? Thank you so much DarkXero & you don't need to help if you don't want to ( but I always very much apprciate your help )!!! Link to comment Share on other sites More sharing options...
DarkXero Posted September 1, 2016 Share Posted September 1, 2016 local function HackState(sg, state) local _attack_onenter = sg.states[state]["onenter"] sg.states[state]["onenter"] = function(inst) _attack_onenter(inst) local needs_fix = inst.prefab == "adam" and not inst.replica.inventory:GetEquippedItem(GLOBAL.EQUIPSLOTS.HANDS) if needs_fix and inst.replica.sanity:IsSane() then inst.sg.statemem.isbeaver = nil inst.AnimState:PlayAnimation("punch") inst.sg:SetTimeout(24 * GLOBAL.FRAMES) elseif needs_fix and not inst.replica.sanity:IsSane() then inst.sg.statemem.isbeaver = nil inst.AnimState:PlayAnimation("throw") if inst.noactualfreezing:value() then inst.sg:SetTimeout(24 * GLOBAL.FRAMES) else inst.sg:SetTimeout(14 * GLOBAL.FRAMES) end end end end local function HackAttack(sg) HackState(sg, "attack") HackState(sg, "dojostleaction") end AddStategraphPostInit("wilson", HackAttack) AddStategraphPostInit("wilson_client", HackAttack) Here I make use of the noactualfreezing variable that is networked, and it is true when gelid mode is activated. You can't just use inst.gelid_mode here, because "wilson_client" makes use of the state, and inst.gelid_mode is nil for clients. Link to comment Share on other sites More sharing options...
. . . Posted September 1, 2016 Author Share Posted September 1, 2016 @DarkXero So sorry to bother you again & again but I used this code local function HackState(sg, state) local _attack_onenter = sg.states[state]["onenter"] sg.states[state]["onenter"] = function(inst) _attack_onenter(inst) local needs_fix = inst.prefab == "adam" and not inst.replica.inventory:GetEquippedItem(GLOBAL.EQUIPSLOTS.HANDS) if needs_fix and inst.replica.sanity:IsSane() then inst.sg.statemem.isbeaver = nil inst.AnimState:PlayAnimation("punch") inst.sg:SetTimeout(24 * GLOBAL.FRAMES) elseif needs_fix and not inst.replica.sanity:IsSane() then inst.sg.statemem.isbeaver = nil inst.AnimState:PlayAnimation("throw") if inst.noactualfreezing:value() then inst.sg:SetTimeout(24 * GLOBAL.FRAMES) else inst.sg:SetTimeout(14 * GLOBAL.FRAMES) end end end end And it works fine, kinda. You see when he goes insane he attacks at 14 frames which's good but then when he's insane & turns gelid mode his attack goes 24 frame which's good but when the gelid mode ends his insane attack stays at 24 frames & never goes back to 14 frames ... I'm so, so sorry to ask again for your help but maybe you know why this happens? So sorry for bothering you so much & thanks you so, so, so, so, so much for your help & guidance DarkXero !!!!!!!!!! Link to comment Share on other sites More sharing options...
DarkXero Posted September 1, 2016 Share Posted September 1, 2016 55 minutes ago, SuperDavid said: maybe you know why this happens Are you setting inst.noactualfreezing:set(false) after leaving gelid mode (which you should, so your character can freeze properly)? Link to comment Share on other sites More sharing options...
. . . Posted September 1, 2016 Author Share Posted September 1, 2016 23 minutes ago, DarkXero said: Are you setting inst.noactualfreezing:set(false) after leaving gelid mode (which you should, so your character can freeze properly)? He..hehe.... oops ... Thanks so much I completely forgot about that ....... You're so helpful DarkXero, thank you so much !!!!!! 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