Health regeneragtion system

Ok so I am trying to make a health system that includes a regeneration element. I can get it to to take DMG really easly and regenerate health constantly however I want the regeneration to stop for like 3 seconds when DMG is received then continue after that 3 seconds. All of my attempts thus far have not succeeded. I really need help on this matter so please Unreal community lend me a hand.

Tried adding a delay between damage and regen? the delay timer resets each time you take damage

Make a variable for “LastTimeDamaged” (float), then in your damage event, do a Get Game Time In Seconds and set your LastTimeDamaged with it.

Then in your regen functionality, subtract LastTimeDamaged from Get Game Time In Seconds, and check the result - if it’s greater than or equal to 3, start regenerating.

That’s how I’d do it anyway. Delays might be unreliable for this.

I have a question for you. I saw a video on youtube and a guy was using a “current time” variable which he got from multiplying something into a custom event tick. Does the “get current game time in seconds” node bypass having to do that?

Sir you diserve a cookie. I shall try that as soon as I can (which will be later tonight) then I will post up the results along with a picture.

Do you remember what it was he multiple because he might of just made a “custom delta time” buy multiplying “x” to get the seconds and minutes of sort. Sorry if I sound a little confusing Im just making a quick guess of what he was trying to do and how he did it

@Ziven, as @NerdRebellion says, I think that’s something different.

Get Game Time in Seconds just gets the total time since the game began.

Ya you can totally do that but the question is why. I mean the ticks have a set time more or less that they “tick” which if you multiple it by the right amount however you can just get that by using the delta time. I mean I geuse you can maybe use that to debug or find how much time is going by per tick but again you can use the internet to get the tick time or just have a print connected to the delta time.

thats the video and the part in the video where he starts doing it.

Yeah he seems to be using it for the same purpose. hes getting the current time since the game begins. but hes doing it in a complicated way. maybe he didnt know there was a node for it?

Idk from what it seems like to me is that he plans on using his event tick results for another function. or mabey like you said he didn’t know about it. When I started out I used ticks instead of delta as well. I would leave a comment and ask him. Also did he bring it in any other of his videos later on?

Yes he uses it for his “current time” variable and uses it in part 3.

Ok I kind of get what he is trying to do now. He wants to have a custom delta time that he can control and mode later and probly intends to use delta time later on. Making a custom time can be benifical but a headache as well. take the minecraft days and nights. The programmer could of made it so it changes every 8min. or they could of made a custom time where 8 min = 12 hrs which makes it easier to import and for other people to change. However you need to make sure you remember to change things that rely on delta time to your new custom time because if you do not it will mess things up a lot. So my suggestion would be stick with the delta time unless you want a custom time. Do you understand now?

Like I said I would I have tested out the Current time and last timeDMG and it works like a charm. Again thank you everybody.