How do i make enemies take damage over time?

Hello, How do I do that when a bullet collides with an enemy in the group “enemies” a variable “eafuoco” changes to 1 and when this variable is = to 1 every 1 second the enemy that got shot (and has the variable eafuoco = to 1) will get damage every 1 second.

Also the variable “eafuoco” is a group variable

this is what i did, but works only partially if an enemy gets hit it starts taking damage every 1 second and the variable changes to 1 but if i hit another enemy nothing happens

For sure not with scene timer
For that you would use object timer

Also i would go with
INSTEAD of eaufoco = 1

eaufoco is greater than 0
eaufoco is less than 4 <-(THIS 4 means repeat 3 times if you set it to 6 it will repeat it 5 times so 5 seconds with your timer setup)

And then in action keep it as you have
But also add 1 to eaufoco variable

Then separate event
eaufoco = 5
Set eaufoco to 0

1 Like

Thank you! I fixed it but I didn’t understand what you mean here, would be cool if you could explain it in a bit more detail if you want!

""Also i would go with
INSTEAD of eaufoco = 1

eaufoco is greater than 0
eaufoco is less than 4 <-(THIS 4 means repeat 3 times if you set it to 6 it will repeat it 5 times so 5 seconds with your timer setup)

And then in action keep it as you have
But also add 1 to eaufoco variable

Then separate event
eaufoco = 5
Set eaufoco to 0""

This is how I fixed

A - Variable eafuoco is GRATER than 0
B - Variable eafuoco is LESS than 4 ← this means it will repeat 3 times if you set it to 7 it will repeat itself 6 times

C - Add 1 to eafuoco variable
D - New event eaufoco variable is equal to 4 (or whatever you set in B) change eaufoco variable set to 0

That is IF you want it to repeat only few times
If you want them to take damage forever after they gonna get hit by bullet then you already have perfectly working logic for that

1 Like

Hoo now I see it!! Thank you really really much!

1 Like