Want my projectile to fire continuously when my key is "held down"
So I have a firing projectile, it fires single individual rounds only when I press my LMB once, I want it to fire continous shots when my LMB (or keyboard key) is held down, how do I do that?
asked Mar 01 '18 at 08:30 AM in Blueprint Scripting
True Origins Int
Indeed there are multiple ways to achieve this, see THIS thread.
answered Mar 01 '18 at 11:46 AM
below is a basic script to get this working. basically you have a variable and set it to true when the button is pressed and false when released. then call the fire function. this function will keep firing until the variable becomes false.
answered Mar 01 '18 at 04:28 PM
You have several option to do that..
Axis bind continously gets called in every frame with input value.. that means input value is 0 by when input is not pressed and goes to specified range (you can specify that in project settings / input). For example if your axis bind configured as 0 - 1 and if you press mouse button input value would be 1..
So because of continously call you can check for that 1 and at that point you know mouse button is pressing..
However firing projectile i think you should have some delay between shoots.. so
2: You can do a bool variable in your weapon or character class... when mouse button pressed you set that true. Other mechanism should be done in TICK event, so you can check is button bool true or false and do your logic like add deltatimes or delayed triggered events etc..
this topics contains some tips about this: https://answers.unrealengine.com/questions/31437/mouse-left-button-down-to-shoot-automatically.html
Hello! I think in this video, Zak Parrish shows something very similar to what you want to achieve
answered Mar 02 '18 at 03:01 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here