i can't set a shield's timer properly

Hello, so the ideal is when i grab the power of “shield” it has to last 10 seconds… but it lasts less and sometimes different values
this is what i have done. There is no other conditions and actions with the same animation. Any idea what i have done wrong? Thank you for your time :slight_smile:

The reason you get different results because the timer runs constantly and when the animation of the player become 2, the timer may be already at 8 seconds.
After resetting the timer, also pause the timer and unpause the timer when the animation is 2.

You are going to need 2 events.

EVENT1
Condition:

The number of the current animation of Player is = 2 Trigger Once
Action:

Unpause the timer "ShieldFinish" of Player.

EVENT2
Condition:

The timer "ShieldFinish" of Player is greater than 10 seconds

Action:

Do = 0 to the number of current animation of Player Reset the timer "ShieldFinish" of Player Pause the timer "ShieldFinish" of Player

Or move the reset timer action to the first event :wink:

Thank you so much ! it worked almost perfectly… but now i have a new issue… the FIRST shield i collision with lasts 4 seconds… then after this… all the shields last 10 seconds. Iam trying to figured it out why but i cant find a solution. Any idea on this one? Thank you again :slight_smile:

Thank you Lizard-13. I have tried this way but didnt work… dont know why

Do you use the timer anywhere else?
But what Lizard-13 suggested should work and also more simple. Just reset the timer on collision and after it should be fine unless the player constantly colliding with the shield then you constantly reset the timer.
If you move the shield with the player after collision, make the timer reset only once by adding the Trigger Once to the collision check.

Thank you so much both of you ! it works perfectly now. Have a nice day :slight_smile: