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.
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:
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.
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.
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.