Alt fire for Weapon

How do you make a M4A1 shoot with bullets from the primary fire mode and then when the player presses a secondary fire button it uses the grenade fire mode.

So primary fire bullets and secondary fire grenades?

What would be the best way to create a weapon like this?

Hi,

its really simple to do that.

  1. Create a new BP First Person Project
  2. Open Project Settings > Input
  3. Create a new ActionMapping called “Fire2” and attach the Right Mouse Button (or any button for the second fire mode)
  4. Make a Child Version of FirstPersonProjectile
  5. Open that Child Version and change the Material to something else than yellow
  6. Open the FirstPersonCharacter Event Graph and duplicate the “Spawn Projectile” Window
  7. Exchange the InputAction from “Fire” to Fire2
  8. Unpin the Touch Input
  9. Exchange the Actor Class that will be spawn to your new Child Projectile

Compile > Save > Play > Enjoy

You could also do a “PrimeDown” and a “SecondDown” variable, which are triggered on and off when the respective buttons are pressed. Simply then make it that when prime is down, shoot. If false, check for second down. If true, throw grenade.