x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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?

Product Version: UE 4.20
Tags:
more ▼

asked Oct 04 '18 at 08:46 AM in Using UE4

avatar image

Dassoop
1 2 1

avatar image HarryHighDef Oct 04 '18 at 10:38 AM

Have your fire event start your sound then have a retriggerable delay connected to the stop?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Nov 22 '18 at 07:31 PM

avatar image

mightyenigma
3.8k 18 20 20

avatar image mightyenigma Nov 22 '18 at 08:45 PM

Oh sorry I just realized you meant the sou d effect not the shooting itself

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question