It's been attempted over the years (2012,
Fed 2014,
July 2014, 2016, 2017) to make a proper health system working.
Due to how packages prioritize in add-ons sometimes the health is affected even if there's a special armor system. Well, I found a new way.
How does it work?I had to rewrite the armor function, I did remove the vehicle health events, but I don't think anyone was really using those anyway, so it's less work for me if no one plans to use them.
The origin of me making this was an inspiration of making RPGs, if anyone in 2012 remembers me and played my servers, you might know about "Level UP RPG", I integrated the health system but there were times it went very buggy and crashed my server. Over the years I gained experience on these functions and improve them.
The health system is very useful and I would like to share it for everyone for use. The only concern I still have with it is mods that use
maxDamage (it's a static variable in player datablocks), which I am unable to get around that unless I edit the add-on.
ModdingIf you want an add-on edited using health variables, you can PM me or post it here and I can fix it up, or if you want to edit it, go ahead and use these resource functions from here:
Support_HealthDetection.cs object.getHealth() replaces
object.getDatablock().maxDamage - object.getDamageLevel() object.getMaxHealth() replaces
object.getDatablock().maxDamage
DownloadAs you can see the version (v9), it has been through a lot of revisions. As far as I know, there's no bugs, and this add-on should work even with armor add-ons.
There are events:
setMaxHealth - Sets their max health, of course
addMaxHealth - Adds max health to their current max health
setInvulnerbilityTime - They are immune to both damage and knockback for a certain amount of time
setFInvulnerbilityTime - They are immune from fall damage for a certain amount of time
setInvulnerbility - They are immune to both damage and knockback
There are a few additional client events
setMaxHealth and
saveHealth, you need to use
saveHealth on the client for it to save when they leave, it will load what their health and max health is when they come back.
Setting max health on a client will save until they leave (unless you used the saveHealth event on a client (not the player))
Make sure
$Pref::Server::MaxHealth_Enabled is set to 1 (or use /ToggleHealthSaver) for health save events to show up, it's off by default
If events still do not show, try /requestEventTables
Download (Google Drive):
Support_NewHealth