SRB2 Message Board  

Go Back   SRB2 Message Board > Sonic Robo Blast 2 > Releases > Lua

Reply
 
Thread Tools
Basic Health System Details »»
Basic Health System
Version: , by CobaltBW (I do things sometimes) CobaltBW is offline
Developer Last Online: Apr 2018

Category: Version: SRB2 Rating: (1 votes - 3.40 average)
Released: 10-21-2016 Last Update: Never Installs: 1
Scripts Re-Useable Content

This is a simple script which adds a basic health system to the game. I made this mostly to get away from Sonic's ring system, but it could also be a resource for anyone working on a mod or character that would benefit from it.



* Characters by default have 3 max HP. Health goes down by 1 every time the player gets hit, but no rings are spilled. The player dies when HP reaches 0.
* Players can restore HP by hitting super ring monitors. HP is also restored at the beginning of each level.
* Multiability characters have 1 less HP, characters with GlideAndClimb have 1 more HP. (E.G. Knuckles has 4, Sonic and Tails 3)

Credits: Some code borrowed/modified from Tripel's Tails Guy wad.

Download Now

File Type: rar health.rar (1.3 KB, 438 views)

Show Your Support

  • The author of this addon has given explicit permission for its content to be re-used and/or reproduced.

Comments
Old 10-23-2016   #2
TehRealSalt
Ya Gal Sal Here (σᴥσ)
Judge
 
TehRealSalt's Avatar
Default

Welcome to releases!
__________________
THZ Discord | Twitter | Tumblr
TehRealSalt is offline   Reply With Quote
Old 10-23-2016   #3
ManimiFire
Meow Motherfuckers.
 
ManimiFire's Avatar
Default

Omg, this is the regular and the simple health system that I waited for all the time!
Good job!
__________________
Check out my youtube channel: https://www.youtube.com/channel/UCd1...hUkNvNA93RPI8g
ManimiFire is offline   Reply With Quote
Old 10-23-2016   #4
MK.exe
The one and only!
 
MK.exe's Avatar
Default

Pretty neat but im not completely sold on losing all your rings on your final Health Point.
__________________
Done:
Hit a 180 Rail shot
1st person to have a map in releases with Slopes
MK.exe is offline   Reply With Quote
Old 10-23-2016   #5
-SpikeyBlueHog-
Never Stop Running
 
-SpikeyBlueHog-'s Avatar
Default

Nice Wad. It gives me some challenge at harder bosses.
__________________
-Gotta go Fast! - Sanic Hegehog
-SpikeyBlueHog- is offline   Reply With Quote
Old 10-23-2016   #6
Snu
Just call me Snu
 
Snu's Avatar
Default

This is a pretty neat Lua script, it might be better to remove the rings from the HUD so it wont confuse people thinking they'll live with 1 ring though.
__________________
Quote:
<Iceman404> SnowTH, the worst player ever 2014
<SnowTH> Woop
<SnowTH> I'm so proud
Snu is offline   Reply With Quote
Old 10-24-2016   #7
CobaltBW
I do things sometimes
 
CobaltBW's Avatar
Default

Quote:
Originally Posted by MK.exe View Post
Pretty neat but im not completely sold on losing all your rings on your final Health Point.
?

Quote:
Originally Posted by Snow View Post
This is a pretty neat Lua script, it might be better to remove the rings from the HUD so it wont confuse people thinking they'll live with 1 ring though.
Rings are intact because they're still used for gaining extra lives.
__________________
~CobaltBW

Check out my soundcloud profile for music stuff
CobaltBW is offline   Reply With Quote
Old 10-24-2016   #8
AozoraJustin
AKA Superjustinbros
 
AozoraJustin's Avatar
Default

The HP counter on the lower-left is simple, but it works.
It'll be fun to try out.
AozoraJustin is offline   Reply With Quote
Old 06-09-2017   #9
Simon_T
Pyro the Hedgehog
 
Simon_T's Avatar
Default

How can I make this character-specific?
__________________
O kurwa!
Simon_T is offline   Reply With Quote
Old 06-09-2017   #10
CobaltBW
I do things sometimes
 
CobaltBW's Avatar
Default

Pretty simple. There's a block of code in LUA_HP which defines a function called "calculate_hp_stat" -- this is responsible for giving characters their HP value. If you want to tweak it to work with one character, just replace lines 7-25 with this:

Code:
local function calculate_hp_stat(player)
	if not(player.mo)
		return(nil)
	elseif(player.pflags & PF_NIGHTSMODE)
		return(nil)
	elseif(player.mo.skin == "sonic")
		return(3)
	end
end
Replace "sonic" with your skin of choice, and replace "3" with the HP of your choosing -- only that character will receive the HP stat, and the others will play normally.

If you're curious: The code that you'd have just replaced there was mostly fluff to demonstrate how you can customize the HP values per character. That's of course only useful if you're making HP a broad mechanic. This replacement code keeps only some of the nil checks, which prevent the script from trying to give other objects health, or players health during NiGHTs special stages. The last elseif excludes any other character from using the function besides the one you've defined.

I'm only explaining that because that code chunk in the WAD is rather minimally commented. Sorry about that.
__________________
~CobaltBW

Check out my soundcloud profile for music stuff

Last edited by CobaltBW; 06-09-2017 at 04:31 PM.
CobaltBW is offline   Reply With Quote
Reply

Thread Tools

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 09:36 AM.


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