Wait x seconds to repeat something

I am making a regeneration system for my game but I only want to start regenerating once x seconds have passed and then in that loop every 0.1 seconds it gives me an extra health. How would go about doing this as I’ve tried everything I could think of.

My current blueprint:

If your health (mana) is under 100 it will start fulling with 1 (you must to add delay)

I notice you’re looking to improve on your mana system.

I suggest taking your logic out of tick and using Timers instead.

I would have two timers do your legwork. One timer be your “lastTimeSpellUsed” which you would call after your player successfully used a spell. That would be a one time use timer which triggers a looping timer to “regenerateMana”. Second timer would constantly loop until your mana was back to full and then turn off.

Hi ElectricNic89,

This shouldn’t be too difficult to accomplish.

First, create an int variable called “RegenerationCountdown” that has a default value of 10, a boolean called “IsHurt?” that is set to true as soon as damage is taken, and another boolean called “CanHeal?” that is false by default.

Next, create a function called “HealCountdown” inside of the player blueprint that decreases the “RegenerationCountdown” variable by one. Once the value reaches zero, tell that function to set “IsHurt?” back to false, “CanHeal?” equal to true, and reset the “RegenerationCountdown” var to its default value of 10.

In your EventTick, create a branch that executes the “HealCountdown” function if the “IsHurt?” var is true and use a delay node to make it execute every second. In your EventTick you will also have a branch that executes a player healing function if the “CanHeal?” var is true.

Event Graph

HealCountdown

HealPlayer

I haven’t tested this but it should work. Let me know how it turns out.