Create custom super form function w/ lua

EeveeEuphoria

a pikachu irl
Hey! So I've been trying for hours and hours to create a function that replaces the Super Sonic form, my goal is to make it so the button for it can be rebound, allow it to be used while having a shield equipped, and have one second of invulnerability when you run out of rings in the super form.

However, no matter how hard I try, I am not able to successfully set this up. The best I can get is that the super form activates perfectly fine when the character is standing still, jumps, and then presses the activation button. However if they are jumping, while simultaneously going forward at full speed, when attempting to do this, it activates abruptly and does not play the transformation animation (e.g. 1 frame normal, next frame already super and able to move and everything)

For reference, here's the code I'm talking about in its purest form. I set the rings to 17 since that's a quick amount of rings you can get in GFZ Act 1.
Code:
addHook("SpinSpecial", function(player) --NewSuper
	if All7Emeralds(emeralds) then
		if player.rings >= 17
		and not player.powers[pw_super]
		and not player.powers[pw_shield]
			player.charflags = $1 | SF_SUPER
			P_DoSuperTransformation(player, false)
		end
	end
end)

addHook("MapLoad", do
	for player in players.iterate
		if not player.mo return end
			player.charflags = $ & ~SF_SUPER
	end
end)

Any advice on this would be great, since I have been so stumped on this, it has literally fatigued me to the point where I'm probably gonna sleep after posting this. Thanks!
 

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

Back
Top