While loop problem

Hi everyone, i need your help because i am stuck on this problems.
In this blueprint i am working on the enemies damaging the player.So on when the enemies overlap it damage the player once and then it keep damaging until the overlap end.
What i was trying to achieve with the branch is to avoid that if i keep beginnig the overlap and ending it faster than the AttackDelay, the enemy damage te player too fast.
So in the endoverlap i ve put a delay after which i let the enemy damage again the player.
So when it begins the overlap again it checks the condition, and if it false the delay is finished.
The problem is if the overlap happens before the delay is finished.I tried to use a while loop to wait untile the condition becomes false but the game crash for an infinite loop.

Do you have any solutions?.

Hi there,

I think whats going is the while loop is never being terminated, at least not as fast as unreal would like if at all. There is a much simpler way to implement this using the same timers you have without a while loop. The timer will run independent of the while loop, even if the condition is false, so you really only need to set it once.

I’ve recreated some of your functions in the first person template, but it should still work for yours.

Try implementing it like this:

I’ve tested out and gotten this result: When the player overlaps the object, it immediately does 10 damage, and then does 10 damage every second after that until the overlap is ended. By clearing and invalidating the time using its handle, we can stop it from executing. All without a loop. I think this is what you were going for, but let me know if I missed something.

Hope this helps!

First of all thank you for your answer but thats not what i was trying to achieve.but i v e managed to make it works working on the player character instead of the enemies;because i wanted something like invicibility frame.