Give A Character Drowning & Suffocation Resistance

ControllerOnAHanger

WHATEVER HAPPENED TO: [Robot Jones]
Hello.
I want to give a SRB2 character I'm making breathe underwater & in space, but I don't know quite how to.
And no, this isn't a HMS123311 remake.
Any help on giving the character drowning & suffocation resistance?
 
You will need to script it using Lua. Timers for drowning and suffocation are stored in the player.powers array. You can access and set these values using the keys from here; for instance, if you wanted to shorten your character's air supply to 10 seconds you would set player.powers[pw_underwater] to 10*TICRATE. Setting this power to 0 or consistently setting it to a high value will make it so your character does not consume air.
 
Okie then!

---------- Post added at 06:48 AM ---------- Previous post was at 06:40 AM ----------

Gave my character the lua needed for underwater & space breathing.
Still suffocates in space.
Am I doing something wrong?
 
There's two seperate values for the space and underwater timers. Make sure you set them both.
 
Here's what I have:
71d11a33b7.png

And Jacen suffocates and drowns as normal.
Something must be done wrong.
 
Try a ThinkFrame hook instead, for player in players.iterate, and drop the else.
This will iterate over every tic and should theoretically just keep your values set no matter what. If I am wrong I don't mind being corrected.
 
Instead of "local function SetStats(player)"
try
Code:
addHook("ThinkFrame", do
	for player in players.iterate
		if player.mo.valid
		and(player.mo.skin == "jacen") then
			player.powers[pw_underwater] = (whatever number that you put here is fine because it will constantly be set every frame which doesn't allow it to tick down)
			player.powers[pw_spacetime] = probably the same number
		end
	end
end)
a ThinkFrame hook will rerun every tic so your underwater timers shouldn't tick down unless you specifically tell the game to do so.
 

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

Back
Top