Set Timer by Function Name

Hi,

I’m working on a spaceship game and for the autofire weapons i used a timer set by function name. I got something that worked all fine before i realized when i was shooting with my pawn, it made ALL the others ships around fire at the same time and the same rate.

So i reallized that this timer was triggering the function on all of my ships at once and not only the one that called for the shot.
Is it a normal behavior and how am i supposed to work around this.

Thank you.

Hi
Yes, the alternative would be to use the Set Timer by Event node in the particular ship you want to do the firing. Doing it with Set Timer by Function Name will execute the event for any actor that has the Function (as you discovered). The way you’d set it up to work for one ship would be similar to this:

243926-capture.jpg

The “BeginFire” event that executes the Set Timer by Event node will then trigger the Delegate Event to fire (it’s just another custom event connected via the red wire) as often as you set the timer to.

Hi again,

I think i did something wrong cause it change nothing for me. So don’t know if ther eis a warkaround but will post what is my code currently.

So i used the function name cause it was allowing me to use it as a variable and the name can be Wshot0, Wshot1 …
I did so cause i was told a timer could only be affected to a single custom event.

So i altered it like you said like this

And i got the exact same result :confused:

Alright, seem the issue is somewhere else.
I don’t know why my player controller trigger the shot on every pawn and not only his.

This is supposed to happen only on the pawn that it controls but it fire on each. It’s even more confusing as the code to make the ship move is looking like that too and there is no issues with it.