Guys, how do i keep my guns firerate, framerate independent?

As you guys can see, i already multiply the firerate(bolt cycle speed) by the delta seconds but it just does not work! as the framerate drops, the gun cycles slower every frame!

What do you have after Then 1, the actual shot?

Try setting a timer with the period of 1 / fire rate. If the frame rate doesn’t drop lower than the fire rate, that should work fine.

What is a timer? do you you mean a delay? Sorry i am new to this.

Take a look at this tutorial: WTF Is? Set Timer in Unreal Engine 4 ( UE4 ) - YouTube

You’re using GetWorldDeltaSeconds in the delay, which makes it framerate dependent.
Instead, in the Duration you could input your “1 / Bolt Cycle Speed”, where the Speed is “shots per second”. This way, your Delay will always wait the same amount of time, independent from your framerate.

So i just divide it by 1 and then input it into the duration?

You divide 1 by your speed, not the duration by 1 (so it’s 1 / Speed). But yes, you just input the result of the division in your Duration. The reason is, you want to wait until you can shoot your next bullet. If you can shoot 10 bullets per second, that means you can shoot one bullet per 0.1 seconds, which you can obtain if you do “1 / 10”.

Wow that really worked! Thank you! The only thing now is that the player can bypass all that and fire faster then allowed by clicking really fast but i will find a fix for that. Thank you!

You can try something like this:

1 Like

Glad it worked!
Please don’t forget to mark the answer as correct just for clean-up :wink: