Automatic Weapon looping sounds without Press/Release Event
I am working on a project that includes a mini-gun as a weapon. The way it is set up, it slowly starts shooting and speeds up to full speed over time. The issue I'm having is that the player input for Mouse 1 Press/Release is unusable as this character will also be AI. This means I can't play a loop and turn it off like automatic weapons are traditionally done. I only have access to a Fire Weapon event that triggers every time the weapon fires, and as it's a minigun this is extremely fast. How can I get an event to trigger once when the weapon begins firing, and again when it is released without using player input?
asked Oct 04 '18 at 08:46 AM in Using UE4
Set a variable for the fire rate. Set another variable current fire time. On tick check whether game time seconds is greater than CurrentFireTime. If it is, fire the gun and increase CurrentFireTime by FireRate seconds. Then the next time it fires will be after than much time has passed. Also when it fires decrease FireRate (maybe we should call it RefireDelay) by a small amount. And it repeats this process as long as fire button is held, gking faster and faster until FireRate is getting Clamped to a minimum value (so it doest reach firing once very frame unless you want it to) remember to multiply by deltatime.
answered Nov 22 '18 at 07:31 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here