Why is my timer not firing every .5 Second?

Hello,

My blueprint for continuous damage for every half second that my character stands on spikes is not functioning correctly. I only take damage when I initially stand on the spikes and unreal never calls for a second check on whether I should take damage or not. Do I have the right idea here? How can I fix this?

I originally a function plugged in the settimer node for a value of .5, but it didn’t seem to be adding anything so I deleted it.

Thanks a ton guys.

I ended up taking out the timer entirely as I couldn’t get it to work while looping back to the start of my damage system with a variable of is Elisa overlaping with spikes and setting up a branch. If the variable of spike overlap is true then run the damage system again. If false do nothing, not what I was trying to do but it works like a charm.

You should read up on how to use timers. What you did is starting a timer named “” (thats an empty string) and then continued with reducing the health by 0.5 and then the event is finished. Timer is an asynchronous task and does not work like Loop (think about it, it makes sense).

What you should do:
Create a function, which deals damage and name it, eg “ApplyDamage”
put the name (ApplyDamage) into the function name of Set Timer.

From then on, ApplyDamage is called every 0.5
To end the timer, you call “Set Timer” with loop=false (but this actually calls the timer once more) or you cancel it with “Clear Timer”.

PS: Your actor can potentially have multiple overlap events in a short time and therefore get more damage than every 0.5 seconds. The reason of this is, that if SetTimer is called on an already active Timer, it’s “cooldown” is reset and it runs immediately.

To prevent this, insert a branch which uses “Is Timer Active” to check if the timer already runs (then you don’t need to start it again)

I’ll try this when I start up Unreal later today, thanks so much .