Apply damage over time

Hi all,

So I’m trying to apply damage to a player over time, while he is in a box, and for some reason it’s not working.

Using an event tick with a delay and an if statement is kinda glitchy.
What can I do to apply damage to a player over time?

Here’s what I have:

It sometimes glitches out and only applies the damage once, instead of every few seconds.

In which way is it glitchy?

Would you mind sharing your current setup?

And what kind of damage over time? Simply damage over time while inside of that box or a usual dot applied inside of the box with a duration?

I’ve added more information. For some reason it sometimes only applies 5 points of damage right when I enter the pool and never again, other times it applies it applies it every .2 seconds.

Thank you this worked! I used this documentation on timers: https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/UseTimers/Blueprints/index.html
Which was exactly what I need

What is the delta value in the tick event anyway though?

There 2 ways to do that by tick and by timers

You using tick method and i see few issues:

-Don’t know why you using delay at all, tick is called on every frame so this delay will be executed all the time and ticks will be just delayed
-You should scale (multiply) damage with “Delta Secounds” this way your damage will be damage per secound, but damage will be applied on every frame
-Because of that you can use integer health and damage, you need to use float type for it to be bale to use fractions of numbers. If you can’t use it then use timers insted
-You collision checking is may be very expensive sometimes for something executed on every frame, insted you listen to overlap start and stop events and set boolean varable to true or false. OR even better put that code inside the volume and apply damage to all character overlapping the volume.

With timer things is a lot easier you make looping timer which will execute function or event every specific time. You start timer using “Set Timer” node, timer is assgined to specific object and function/event, the pair is used as timer id which you can use in timer control nodes. If you want to use integer health i really recomand you to use that insted

Tick is called on every frame, but ofcorse there no guarranty frame will be rendered in static rate as fps may change a lot, so without some support fps will effect rate of changes applied in tick, less frames = less changes = changes are slower and that support is delta time

Delta time return estimated time between frames allowing you to scale applied changes in tick to time between frames, so you changes are not frame dependent any more but time dependent, when you multiply delta time with a change of value (delta of value in math terminology) it will turn in to change per second, in other word speed of change, in your case delta is damage so damage applied per secound.

Delta time in tick is also effected by Global Time Dilation settings in engine, allowing you to globally control of speed of the game, allowing you to do slomo action for example ;]