I decided to start from scratch and this is what I came up with:
I condensed everything into a function of “Fire Gun” so that I could reuse it for other things too. I took out a lot of flow control, since it was no longer doing anything. I also removed the first For Each Loop, since it was a bit redundant. I added in the animation for effect, but it wasn’t needed. The first “Fire Gun” that is called before the Timer is because I found that it wouldn’t fire if I just tapped the shoot button. It needs a little tweaking since I can just spam tap faster than the rapidfire, but that is easy to fix with something like a “Can Fire” bool.
Another issue was that the “==” is not looking for the specific instance of the actor. I decided that using a Cast To was more efficient. To get the Cast To node, you will have to drag from “Hit Actors” and search since it is context sensitive. The destroy now knows exactly what it is talking to.
To answer you questions:
- But does it matter using a ‘Pause Timer’ or ‘Clear Timer’?
Clear Timer resets the timer to 0, Pause Timer tells it to stop at whatever number it is on. I’m using both in my example because of the way a real gun’s rapid fire would work; It is no longer moving bullets (Pause Timer) and will settle on the next bullet in line (Clear Timer). If I was doing something like filling a room with water over time, I would just use Pause so that I could pick up where I left off if I turned the water flow on or off.
- Are ‘Delay’ nodes a bad idea for rapid executions generally?
No, they’re fine for fast executions. The problem I was pointing out was that the Delay was being used to have the execution fire repeatedly; Timers are way better at repeating executions.
- I currently have a delay involved in the spawning of my AI, however the delay is set to every 6 seconds so I am hoping that ok and isn’t going to affect performance too much correct?
That’s fine. I don’t know how intense the AIs are, but having something spawn every few seconds is safe. Again, a Delay will work, but a Timer is more efficient/performance-friendly at repeating execution.
If you have any other questions, feel free to ask.