Timer With a Do N function

Hi!

Simple question, how do i get my Do N to work with the timer? As it is now the FireBullet function is only called once, instead of the 10 that i told it to call. Everything up to the Set Timer works, and so does the FireProjectile.

Well, what i want is that when actor CharacterBlue overlaps CharacterRed 10 projectiles should be fired. These 10 projectiles should be fired with a certain time inbetween (in this case 10s).

I haven’t figured out a better way to do it than what i have in the above picture :frowning:

Thanks, It worked using the delay :slight_smile:

The Timer is doing nothing in your setup.

A Timer calls a funtion by its name. You need to delete “Fire Projectile” and write its name into the Set Timer node.

This way the FireProjectile function will get called every 10 seconds (at least that’s how you set it up).

Do you want to have 10 Projectiles every 10 seconds, or 10 times 1 each 10 seconds? Your setup is a bit missleading here (:

Maybe you would want to use the “Delay” node here after the Do N instead of the timer.

Yeah, use a for loop or do N loop and plug a “Delay” with 10 seconds behind it. And behind that, you plug the function. That should work (:

You can also create variables that count for you and use timers.

You would have one timer at the start that has 0 in time, because the first projectile should be spawned directly. And remove the loop bool.
And you will want to check an INT variable if it is less or equal than 10 and if it is, add 1 to the INT variable and call the timer.

Inside the function, you just place a second timer that calls the function itself with a 10 in time and still false in the loop bool.

This setup would work the same and timers don’t delay the whole actor, so maybe you should think about doing it like this instead of a delay, but still the delay would also work.

I will still give you the timer version:

You set the counter to 0 every time he overlaps, so that you can start fresh with 10 Projectiles (maybe you need to alter this if you don’t want to have him spamming. Like adding a bool “isAlreadyFiring”).

http://puu.sh/h9R73/003b70f757.png

And inside the function, you check if we have fired 10 times already (add 1 first, because we already fired once). And call the timer again with a 10 sec delay:

http://puu.sh/h9R5j/4928b3586b.png