[SOLVED!] Immediate Ability usage after setting it?

SpinSlash165

speeeeeeeen
Hello! This might be a weird question, but I'm having a few issues with Lua.

I've set up a code that switches my character's CA from DOUBLEJUMP to TWINSPIN by pressing Spin while airborne - which works as intended - but my problem is that I have to press Spin a second time to get the Twinspin ability itself to actually activate.
I've tried setting flags like PF_THOKKED or PF_JUMPED, but nothing seems to be working. Is there a way to set it to activate on the initial press of Spin?

Here is this block's code for reference:
Code:
              if player.spintapping and not P_IsObjectOnGround(player.mo) then
			player.charability = CA_TWINSPIN
		elseif P_IsObjectOnGround(player.mo) then
			player.charability = CA_DOUBLEJUMP
		end
I'm not overly familiar with Lua, so there's a good chance I'm missing something important. Still, any help is appreciated!
 
Last edited:
UPDATE: It has been solved! The PF_THOKKED flag works, I just needed to load the Twinspin's player.mo.state and play the animation & sound with it.
 
ThinkFrame hooks run functions after the majority of game logic, so changing the player's ability in those functions is only effective for the following tics. The SpinSpecial hook allows you to execute functions before the player's spin ability is used.
 

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

Back
Top