How to force a player to enter a specific state that uses a sprite?

Status
Not open for further replies.

amperbee

thunderdome denizen
Retired Staff
I'm making a map that has a (Lua) gimmick that, every few seconds, it pushes the player towards a direction. It uses some of the player momentum so you can have some control before being pushed.

I'd like to force the player in a state to prevent them from moving while the gimmick is running, but every time a player has their state changed, a single keypress or tic later they are in the walking animation.

A workaround I used in the meanwhile is to save the player momentum in dummy variables, use the player pain function, disable the control for some seconds, and set the player momentum to the saved variables + player pushing values.

How do I make a player display a different sprite/state, for example, making the player use the falling/spinning (jump) sprites?
 
Disable the player's control for as long as you want the effect to last, then manually set either the player mobj's state (player.mo.state) or their sprite (player.mo.sprite and player.mo.frame) every tic until the effect is over. The game will still try to make the player switch to their proper state, but as long as your thinker is called after the player mobj's thinker each tic (put it in ThinkFrame to be safe), you'll override everything the game does.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top