i have been trying to get it where the player can toggle the rate of fire for the weapon such as single-fire to full-auto and get it where it loops fireing animations correctly and disable when the fire button is let go of and get it to loop the subtracting of ammo from mag through a function but cant get it to work. any ideas or examples?
anybody this question still hasn’t been answered
What you can do is set up a branch that checks for a boolean value. If the button is pressed, it sets the bool to true and your fire rate can be set to fire rate a. if false, set it to b. For instance, if your fire is left mouse button and you press LMB it will check if the boolean is true. Lets say you have your right button set up to determine the state of the boolean as long as it is pressed it will be true, if released it is set back to false. When you hold the RMB down, then press LMB, it will determine the bool to be true and fire the function you have set up to do an alternative fire mode.
Another way to do this would be to set up a flipflop node so that, instead of press and release (meaning you would be forced to hold the button down to access the alternate fire mode) you could use the flipflop to switch. If you RMB once it will set bool to true. If you press it again, it will set the bool to false.
I wrote a mini tutorial on a gun I created where we discuss this very topic, you can find the link here: