SRB2 Message Board  

Go Back   SRB2 Message Board > Sonic Robo Blast 2 > Help

Reply
 
Thread Tools Search this Thread
Old 03-02-2019   #1
Jacen'99
Lil' Beanie
 
Jacen'99's Avatar
Default Give A Character Drowning & Suffocation Resistance

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?
__________________
this is signed by Jacen'99
Jacen'99 is offline   Reply With Quote
Old 03-24-2019   #2
Jacen'99
Lil' Beanie
 
Jacen'99's Avatar
Default

Huh, nobody wants to help me in my quest for drowning & suffocation resistance then?
Okay.
__________________
this is signed by Jacen'99
Jacen'99 is offline   Reply With Quote
Old 03-24-2019   #3
Lach
nanananananananananananan a
 
Lach's Avatar
Default

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.
Lach is online now   Reply With Quote
Old 03-24-2019   #4
Jacen'99
Lil' Beanie
 
Jacen'99's Avatar
Default

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?
__________________
this is signed by Jacen'99
Jacen'99 is offline   Reply With Quote
Old 03-24-2019   #5
Rumia1
Backseat Developer
 
Rumia1's Avatar
Default

There's two seperate values for the space and underwater timers. Make sure you set them both.
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is offline   Reply With Quote
Old 03-24-2019   #6
Jacen'99
Lil' Beanie
 
Jacen'99's Avatar
Default

Here's what I have:

And Jacen suffocates and drowns as normal.
Something must be done wrong.
__________________
this is signed by Jacen'99
Jacen'99 is offline   Reply With Quote
Old 03-25-2019   #7
Rumia1
Backseat Developer
 
Rumia1's Avatar
Default

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.
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is offline   Reply With Quote
Old 03-25-2019   #8
Jacen'99
Lil' Beanie
 
Jacen'99's Avatar
Default

But how would I add a ThinkFrame?
Keep in mind that I barely know anything with Lua.
__________________
this is signed by Jacen'99
Jacen'99 is offline   Reply With Quote
Old 03-25-2019   #9
Rumia1
Backseat Developer
 
Rumia1's Avatar
Default

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.
__________________
Quote:
Originally Posted by Cirno
Egguman-senpai...
Rumia1 is offline   Reply With Quote
Old 03-27-2019   #10
Jacen'99
Lil' Beanie
 
Jacen'99's Avatar
Default Thanks!

Thanks for the help!
Jacen can breathe in space and undewater now!
__________________
this is signed by Jacen'99
Jacen'99 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:55 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.