Health Regen Running off a Custom Event?

Wanting to have Health Regen at the end of a ** CombatTimer Custom Event**, only node’s I could think of was DoOnce and a WhileLoop

Combat Timer Graph (Gets called when combat is initiated)

WhileLoop - Problem is an infinite loop error due to the delay node, I’m assuming WhileLoops carry out it’s task in one go hence it can’t be delayed

DoOnce Thought I could trick this node by feeding the final Execution pin into it’s reset Input, but it’s determined to do things, well, once :L

I’ve searched on youtube to see what way people got this to work for then, but they all rely on the Event Tick which won’t work for me, so I guess my question is, does anyone have another angle I could go with? My knowledge of BP’s and programming in general are still noobish so bear with me

while loop in BP are designed for quick executions like searching in a array, it can’t be easily delayed.
but there is a “set timer by event”, the timer can be reset, and it calls a function when the timer ends

Unfortunately I am currently unable to take screenshots as I don’t have UE4 on this computer otherwise they would be here. Despite this I will endeavor to give an adequate answer. So here goes:

  1. Connect your custom event to a Sequence.

  2. Create a Gate and make sure Start Closed is ticked.

  3. Connect the Then 0 to Open on the Gate and connect Then 1 to Enter on the gate.

  4. Add another Sequence to the right of the Gate and connect it to Exit on the Gate.

  5. Connect the Then 0 to your SET AI Health Value.

  6. Connect Then 1 to a Retriggerable Delay with Duration as Heath Regen Rate.

  7. Connect the completed pip of Retriggerable Delay to a Branch.

  8. Connect your AI Health Value < Max Health as the Condition to Branch.

  9. Connect True of the Branch to Enter and connect False to Close.

I hope this helped.

God bless, Gate nodes was something I knew I’d run into eventually, actually a pretty handy Node.

Final Results:

Works perfectly for depletion as well
Sprinting Method:

Condensed into a Macro