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?
its really simple to do that.
- Create a new BP First Person Project
- Open Project Settings > Input
- Create a new ActionMapping called “Fire2” and attach the Right Mouse Button (or any button for the second fire mode)
- Make a Child Version of FirstPersonProjectile
- Open that Child Version and change the Material to something else than yellow
- Open the FirstPersonCharacter Event Graph and duplicate the “Spawn Projectile” Window
- Exchange the InputAction from “Fire” to Fire2
- Unpin the Touch Input
- 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.