. . . Posted April 16, 2022 Share Posted April 16, 2022 I want to make a jumping state and I'd like the player to still be able to move with wasd, is this possible or only the run state allows the player to move around? Link to comment https://forums.kleientertainment.com/forums/topic/139270-is-there-a-way-to-make-a-state-which-still-allows-the-player-to-move-around-while-in-it/ Share on other sites More sharing options...
IronHunter Posted April 19, 2022 Share Posted April 19, 2022 I believe locomotion is handled by the state event for locomote, it is not a very friendly event to modify but if you want to add your own locomotion states you'll probably need to modify this event's function and make yours attempt to run first if valid. It can be found in the events table of sg_wilson EventHandler("locomote", function(inst, data) if inst.sg:HasStateTag("busy") then return end local is_moving = inst.sg:HasStateTag("moving") local should_move = inst.components.locomotor:WantsToMoveForward() if inst:HasTag("ingym") then inst.sg.statemem.dontleavegym = true local gym = inst.components.strongman.gym if gym then gym.components.mightygym:CharacterExitGym(inst) end elseif inst.sg:HasStateTag("bedroll") or inst.sg:HasStateTag("tent") or inst.sg:HasStateTag("waking") then -- wakeup on locomote if inst.sleepingbag ~= nil and inst.sg:HasStateTag("sleeping") then inst.sleepingbag.components.sleepingbag:DoWakeUp() inst.sleepingbag = nil end elseif is_moving and not should_move then inst.sg:GoToState("run_stop") elseif not is_moving and should_move then inst.sg:GoToState("run_start") elseif data.force_idle_state and not (is_moving or should_move or inst.sg:HasStateTag("idle") or inst:HasTag("is_furling")) then inst.sg:GoToState("idle") end end), You should be able to edit this somehow using a postinit or maybe a global hook for the stategraph 1 Link to comment https://forums.kleientertainment.com/forums/topic/139270-is-there-a-way-to-make-a-state-which-still-allows-the-player-to-move-around-while-in-it/#findComment-1560173 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