there are many ways to accomplish a burst fire mode given your script, but the basic idea would be to create your own loop then run it x number of times (3 in your case). the easiest way i could explain this is that you would need to call your fire event at the the end of your current script and add in some flow control at the begining. so you could use a variable that decrements each time the script is run, a multi gate, do N, or some other form of flow control.
below are two examples.
its a decrement integer node. basically it takes in a variable integer subtracts one then sets the integers value. to get it just drag off of a integer pin and in the search type in two dashes (–).
how did you have it setup? what was the default value of the variable? where are you calling the fire function from?
thats the picture i posted. i realize that you were working off what i provided, i asked about your setup because many times people when copying from tutorials dont do things exactly as shown.
the variable should be set to 3 if you want a 3 round burst, and you should also have the the set node that comes from the false on the branch set to 3 as well.
between the branch and the variable you should have a greater than node (>) not a equal node (==).
also try setting your spawn collision override to always spawn. how do your projectiles function? if they use a overlap or hit event that can interact with others of the same class then that could cause issues (projectile 2 hit projectile 1 both explode for example). you may also want to add in a delay somewhere in your script so the burst fired projectiles arent spawned at the same time but rather spawn in a sequence one after another at a regular interval as real world gun work.
I would like to know how to make a 3 round burst weapon with my weapon system. Thanks in advance.
What is this block if i may ask. I’m kinda new to UE4
I used your system and all it did was fire a single bullet and never fire a bullet out of that weapon until the next time the game is loaded up.
I have it set up like this
and the default variable is set to 0
I just added the branch with the logic attatched to it to the beginning of my setup and the ending part i highlighted in my last photo to the end of my existing logic.
your decrementing the burst variable right?
if its not stopping then theres either no breaking out of the loop or your calling the fire function repeatedly. in the example i posted when the variable reached 0 then the branch would read false and go to the delay and set node, which would then not call the fire function therefore creating a path that breaks out of the loop.
the script at its most basic is: fire event → is burst greater than 0, if no end loop , if yes → spawn projectile → burst -1 → set burst → fire event. that loop continues until burst is less than 1, then it sets its value so its ready for next time.
so this leaves the solutions of your not decrementing the burst variable or your calling the fire function multiple times. without knowing about your setup and seeing the script its hard to tell. as it currently stands the script should only be able to run every 0.2 seconds as regulated by the delay node.
I did what you advised and now it runs rapid fire in a 3 round burst without stopping. My bullets themselves have no collision currently.
I fixed it. I had set the loop to go through the false line instead of the true one, causing the infinite loop. Thanks for your help man!