Overhealth Decay
View original size
This is a simple utility that decays any overhealth the player gains after a configurable delay at a configurable rate. It will also reset the delay if more overhealth is added while it is decaying. This also works on workshop temporary armor/shields.
- Known Issues
- The delay reset on O.H gain only triggers if its already decaying. Example: you have a 4-second delay on decay. If you gain 50 O.H, then 3 seconds latery gain 50 more, the decay will still begin after 1 second. You can patch this by disabling the decay rule when you know the player will continually gain O.H.
- Temporary armor and shields will convert into normal O.H if it starts decaying while the player is under max health.
The import code is a simple demo. Press interact to receive 50 overhealth. To use the tool yourself, just paste the code below into your mode or copy it from the demo if you're on console.
It uses 1 variable and 1 subroutine. Change their IDs if there's any conflict!
Big thanks to DBJ for helping me with bugs.
variables {
player:
0: storedOverhealth
}
subroutines {
0: StoreOverhealth
}
rule("Decay Overhealth")
{
event
{
Ongoing - Each Player;
All;
All;
}
conditions
{
(Max Health(Event Player) - Max Health of Type(Event Player, Health) - Max Health of Type(Event Player, Armor) - Max Health of Type(Event Player, Shields)) > 0;
}
actions
{
Wait(4, Restart When True);
Call Subroutine(StoreOverhealth);
"While has OH"
While((Max Health(Event Player) - Max Health of Type(Event Player, Health) - Max Health of Type(Event Player, Armor) - Max Health of Type(Event Player, Shields)) > 0);
"If OH gained, delay again"
Loop If((Max Health(Event Player) - Max Health of Type(Event Player, Health) - Max Health of Type(Event Player, Armor) - Max Health of Type(Event Player, Shields)) > Event Player.storedOverhealth[0]);
"If not full HP, replace current OH with current OH - 1"
If(Health(Event Player) < Max Health(Event Player));
Event Player.storedOverhealth[1] = Health(Event Player) - Event Player.storedOverhealth[0];
While(Health(Event Player) > Event Player.storedOverhealth[1]);
Set Player Health(Event Player, Event Player.storedOverhealth[1]);
End;
Event Player.storedOverhealth[0] -= 1;
Abort If(Event Player.storedOverhealth[0] < 1);
Add Health Pool To Player(Event Player, Health, Event Player.storedOverhealth[0], False, False);
"Else just subtract 1 from health"
Else;
Set Player Health(Event Player, Health(Event Player) - 1);
Call Subroutine(StoreOverhealth);
End;
Wait(0.120, Ignore Condition);
End;
}
}
rule("Store Overhealth")
{
event
{
Subroutine;
StoreOverhealth;
}
actions
{
Event Player.storedOverhealth[0] = (Max Health(Event Player) - Max Health of Type(Event Player, Health) - Max Health of Type(Event Player, Armor) - Max Health of Type(Event Player, Shields));
}
}
Players |
1 - 12
Categories:
Hero Adjustments,
Tools
Tags:
tool
overhealth
Created at:
Last updated:
Current version:
1.0
Source code
Loading...
5 Comments
👍🏻
Babe wake up, the GOAT has uploaded (thanks a lot for the code it's gonna help me a lot, i won't forget to credit you !)
glad to help
Alomare the godtier workshopper ・ᴗ・
<3