Gun fire delay method

So i´m making a automatic gun should i use the delay node to wait before i can fire again or something else?

I use timer for cooldown, the timer location is in gamemode that way every actor can get to it, every tick of the gamemode increase the timer by the delta time of the tick, and that way when I fire(or attack) I save the current timer with attack speed(in secs) and do a compare to the current time.
It can work with delay, but as I saw it the delays destroy each other (there can’t be more than one delay ruining each time), and that can create problems if you need to use delay in the future in the same bp.

Personally I find that timers work the best. Some people may use event tick but that is typically way to fast. Here’s how I set it up. Basically you click your fire button which plays a timer. You can make this a Set Timer by Event or Set Timer by Function. It works the same way as your see here. In the timer you should set it to Looping so it will repeat as long as you hold the firing button down. Then you can choose how fast you want it to shoot with the time value. So connect it to an event and do your line trace or however you shoot the weapon and voila. For Set Timer by Function you would create the shooting functionality inside the function and use the function name in the Set Timer by Function. So then when you release the fire button you just invalidate and clear the timer. If you have any questions just ask

1 Like