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"

How do I make a weapon fire fully-automatic?

I do know how to basically do this. I'm guessing I need some kind of Exec timer that is set to 0.1 seconds and then every 0.1 seconds it will shoot but how do I do this? And what Exec node would I use? I'm also guessing I need some kind of variable to help perform this.

Anyone know? Thanks!

Product Version: UE 4.9
Tags:
more ▼

asked Dec 08 '15 at 08:32 PM in Using UE4

avatar image

sayer6913
19 20 15 26

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

make a custom event called FireBullet that is called by a timer. the timer can be set when the player presses a button, and it can be cleared when the player releases the button, in an event called StopFiring. the delay on the timer should be set by a float called FireRate, and the timer handle should be stored in a variable called FireTimer.

then make a boolean called IsAutomatic, and after each shot, you can branch on IsAutomatic, and if its false, you can call StopFiring.

before you fire each bullet, you should check if your Ammo is greater than 0, and after you fire each bullet, subtract 1 from ammo to set the new ammo amount. if you try to fire a bullet, and Ammo is not greater than 0, StopFiring.

you should also make an enum that holds the weapons state, for things like dropping, jamming, overheating, switching, equipping, reloading, shooting, and Idle. then whenever you want to shoot a bullet, you check if its in the idle state, and if so, you switch WeaponState to shooting, and do the rest of the shooting code, subtracting ammo, tracing, spawning projectile, playing animations, etc...

more ▼

answered Dec 09 '15 at 01:49 PM

avatar image

ScottSpadea
9.5k 317 204 449

avatar image sayer6913 Dec 09 '15 at 11:05 PM

Ok thank you :)

(comments are locked)
10|2000 characters needed characters left
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