Jump to content

needs some help with stategraphs


Recommended Posts

        local yuzu_paperbox_idle = State{
            name = "yuzu_paperbox_idle",
            tags = { "hiding", "notalking", "yuzu_paperbox" ,"idle" ,"autopredict"},
 
            onenter = function(inst, talktask)
                inst.components.locomotor:Stop()
                inst.AnimState:PushAnimation("hideshell_idle", false)
                --Transferred over from shell_idle so it doesn't cut off abrubtly
                inst.sg.statemem.talktask = talktask
            end,
 
            onupdate = function(inst, dt)
                CommonUpdate(inst, dt)
            end,
 
            events =
            {
                EventHandler("ontalk", function(inst)
                    inst.AnimState:PushAnimation("hitshell")
                    inst.AnimState:PushAnimation("hideshell_idle", false)
                    return OnTalk_Override(inst)
                end),
                EventHandler("donetalking", OnDoneTalking_Override),
            },
   
            onexit = function(inst,instant)
                inst.components.talker:Say("out")
                CancelTalk_Override(inst,instant)
            end,
        }
        AddStategraphState("wilson", yuzu_paperbox_idle)
        AddStategraphState("wilson_client", yuzu_paperbox_idle)

copied from shell_idle (for the snurtleshell) and edited to make it able to move while hiding

I added ‘inst.components.talker:Say("out")’ in "onexit" to judge whether my character are truly "out"

it worked totally fine while the lag compensation was turned off.I had no trouble moving while staying hiding.

but when i move with the lag compensation turned on,my character says "out" immediately after i've pressed any button to move

I am just a rookie and I cant figure out whats wrong with it.

 

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...