How can I set up a firerate method that is capped regardless if I’m holding down the left mouse button, or if I’m clicking as fast as I can? Take this picture for example.
I have this set up in such a way that it works perfectly to hold the mouse down and shoot my projectile at my desired fire rate. However, I can left click much faster then this. I have searched everywhere with no luck. I have tried delays, timers, etc. I can’t seem to figure out a solution.
So… My question is this. How can I add to this BP to NOT let me fire faster then my retriggerable delay?
Replace the Retriggerable Delay with a normal Delay. The Retriggerable Delay will restart its timer each time it’s called. You could also do something similar to this, calling FireCooldown somewhere in your firing execution chain.
I also want to keep the AUTO fire feature. I want to be able to fire by holding down the left mouse button and also while tapping it. I just don’t want to be able to tap fire faster then the weapon can autofire.
Thanks for the reply! Sorry I should’ve been more specific. I need to keep the retriggerable in there. At least to my knowledge
The normal delay does work for this, and after messing with it for a little while I can’t seem to find any discernible difference between the them functionality-wise either. Either way, I was wrong on that; it doesn’t seem to be the problem now that I’ve messed with it for a while. The second sequence node spawns the projectile before going to the delay. So every time the gate is closed and opened again from clicking, it spawns a projectile each time before hitting the delay. I couldn’t find any way to wire anything up using that sequence-and-gate setup that fully enforced the delay without triggering infinite loop detection.
The most straightforward method I’ve found that doesn’t allow spam-clicking to bypass the fire rate was to only set a boolean true when pressed and false when released. Then in Tick, call an event that does the actual weapon firing using the graph I posted above if that boolean was true.
I doubt it’s the best way to handle it, but it does seem to work.
Now I’m not sure if I should edit my answer, or delete it, or what.
keep your answer. it’s helping us eliminate some possibilities haha. I’m sure there’s got to be a “proper” way to set this up somehow. I’ve been playing with it all day, but I lack the experience in unreal to figure it out.
@tekskid - i do the same, when mouse down, set bool mouseactive = true under event tick i have a branch(if mouseactive = true then delay 0.1 seconds then fire, if false do nothing. works beautifully, and its simple.
Here’s the solution I came up with. There is also an ammo system in this BP. This lets me auto fire, and doesn’t allow me to fire faster then the auto fire setup.