Problems in continuous fire
When I hold down the fire key, I can continue to shoot even if the number of bullets is zero.
How should I revise it?
asked Oct 18 '18 at 11:55 AM in Using UE4
in your example the value of the loop pin will not change unless you press the button again. this means that the check for amount of ammo is not being done which is due to using a timer here. theres two ways to solve this:
first you could add a check after the start fire event which checks the ammo level and if theres no ammo then you clear the timer, in this case you would just have the timer set to always loop. see picture capture1.
the second method would be to rebuilt the script entirely and eliminate the timer, instead opting to make your own loop. see picture capture.
answered Oct 18 '18 at 01:32 PM
That's because your logic is wrong. You are only checking ammo before you set the timer. Once the timer is set it keeps calling ShootFire without checking ammo.
simply check ammo on start fire before calling shoot fire..
answered Oct 18 '18 at 01:44 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here