Jump to content

Help with run stategraph?


Recommended Posts

The idea is to change how the character runs, Animation is no problem, that is already handled. Now what I might, infact, I indeed need help with, is how to call the stategraph properly to modify it

 Whenever I tried to modify it by calling AddStategraphPostInit("wilson",  function(sg) failed by the character no longer being able to move, mostly due to how many different states the run has. I know very little on the part of stategraphs so some help would be super appreciated.

Before I have tried something like this

AddStategraphPostInit("wilson",  function(sg)
		
			local _run_start_onenter = sg.states.idle.onenter
	sg.states.run_start.onenter = function(inst)
		_run_start_onenter(inst)
		if inst:HasTag("xxx") and inst.AnimState:IsCurrentAnimation("run_pre") then
			inst.AnimState:PlayAnimation("xxxrun_pre")
		end
        end	
		
		local _run_onenter = sg.states.idle.onenter
	sg.states.run.onenter = function(inst)
		_run_onenter(inst)
		if inst:HasTag("xxx") and inst.AnimState:IsCurrentAnimation("run_loop") then
			inst.AnimState:PlayAnimation("xxxrun_loop", true)
		end
        end	
		
					local _run_stop_onenter = sg.states.idle.onenter
	sg.states.run_stop.onenter = function(inst)
		_run_stop_onenter(inst)
		if inst:HasTag("xxx") and inst.AnimState:IsCurrentAnimation("run_pst") then
			inst.AnimState:PlayAnimation("xxxrun_pst")
		end
        end	
end)

it didn't work at all, as I mentioned before, character could no longer move. Again, any tips or help with be super appreciated!

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...