How to run different timers bound to the same event?

I’m trying to code a simple logic using blueprints, I understand that using Set Timer by Event/Function will reset existing Timers bound to that Event/Function. I’d like to know if it’s possible to bind multiple timers to the same Event/Function instead of resetting it, and if not, how is this usually handled?

Example of the logic I’m trying to implement:

  1. I launch a ball, and I use a 10 seconds Timer to simulate it reaching the target (before telling me if I hit or not).
  2. After 2 seconds I can launch a second ball with the same logic.

Currently, as soon as I launch the second ball, the first timer is reset and it’s like the first ball disappears, instead I would like to have the first ball finish his timer and tell me the result while the second ball is flying toward the target.

Hey @ClaudioPiccinni!

Have you tried making the ball a spawnable actor?
You’d spawn the actor(ball) then run the timer off of BeginPlay on the ball.
They should be separate timers since each ball would be its own individual entity!

1 Like

Hi @Mind-Brain, thanks for the prompt answer. I would like to not have it as a separate actor, but I recognize that this is a possible solution!

In the end I implemented this solution pointed to me by user Gompasta! in the official Discord. It involves spawning an Object from the Actor that wants to use multiple timers:

The object has this event + dispatcher to notify the end of the timer to the Actor:

In my version I ended up passing a variable in input to StartTimer, to set the time I needed for the timer.

This solution still involves spawning a separated entity (so I set the reply by mindbrain as the correct one), but this is fully generic without any specific actor logic. It only has a generalized timer and a timer-elapsed function, then it gets discarded, and you can spawn as many as you want. I think it’s an elegant solution albeit a bit convoluted.

1 Like

I might be missing the point, but how about:

A Delay could also work. Or with a single timer:

  • shoot ball, wait 10
  • do stuff, wait 2
  • shoot ball

You run the same timer but with different duration. Is this what you’re after?

No this is not what we were talking about

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.