How do I make my health regen system better

So, I am developing a health regeneration system. I have it split into 3 custom events a timer and a function.

So when I use (for example) a healing potion it calls the event Start Health Regen from the player BP which takes two inputs: Amount which is an integer, and rate which is an integer. for this example both will be set to 10.

The Start Health Regen Custom Event has 6 Variables: HealthRegenTick which is a float, HealthRegenAmount which is an integer, HealthTickRate which is an integer, HealthTickCount which is an integer, HealthPerTick which is an integer, and IsRegeneratingHealth? which is a boolean.

HealthRegenTick is set to 1 by default, HealthRegenAmount is set by the input Amount, HealthTickRate is set by the input Rate, HealthTickCount is set to 0 by default, HealthPerTick is set to HealthRegenAmount Divided by HealthTickRate, IsRegeneratingHealth? is false by default.

from the event node is a branch with IsRegeneratingHealth? plugged into a NOT gate being the input.

from the true branch the initial values of HealthRegenAmount, HealthTickRate, HealthPerTick, and HealthTickCount are set respectively then IsRegeneratingHealth? is set to true.

From the IsRegeneratingHealth? boolean pin a timer is set by event with it’s time set to HealthRegenTick, The Event is the second custom event called Health Regen, and the timers handle is output to a Clear and invalidate by handle node Connected to a third Custom event called Regen Health End.

from Health Regen is a branch with a test if HealthTickCount is greater than or equal to HealthTickRate.

from the true branch is the call for the Regen Health End event.

from the false branch is the Increase Health function which takes an input amount and adds it to the players current health clamping it at the max health. The input is set to HealthPerTick.

from the function is an increment node for the HealthTickCount.

From the Clear and invalidate by handle node is a setter for IsRegeneratingHealth? to false, and setters for HealthRegenAmount, HealthTickRate, and HealthPerTick to 0.

If the IsRegeneratingHealth? Test is true (meaning another health regeneration is happening) than the initial branch is false.

when the branch is false HealthRegenAmount is set to the current value plus the incoming value, HealthTickRate is set to the current value plus the incoming value, and HealthPerTick is set to the new Amount divided by the new Rate. This regenerates the new values from the current HealthTickCount.(for this example you drank the second potion 3 seconds after the first. You healed 1 hp every second for 3 seconds, the amount then changed to 20 and the rate to 20 for HealthTickCount 4 and on til count 20 where the Regen Health End event is triggered.

This is a clean system In my opinion and will work even when you change the HealthRegenTick (which I plan for perks doing this like stats in vitality, gear effects, and that sort of thing)

I want to implement a Potency check for this where either you gain potency for over healing, or for generally drinking potions quickly, and if you get too high of a potency you get potion sickness which dynamically weakens potions based on how high your potency is over the limit.

I also want to implement health DoT and wondered if there was a way to abstract my system to do both cleanly or if I was better just making a parallel system.

I would also enjoy a way to more smoothly move between progress bar percents with this system since the actual movement seems a bit clunky while still keeping the timing modifier the same

for progress bar, just do the interpolation.
P.S. Instead of text, i think a screen of the blueprint would be better :stuck_out_tongue:

Agreed on the screenshot of the blueprints, it’s well described but still difficult to follow