Weapon Switching - I can switch guns, but how do I fire from each one?

Hey all,

So I have a gun inventory here, and when I fire it will fire from the base weapon as shown below:

The shoot function is your typical line trace, break hit result and sound played. It’s in the WeaponMaster file.

My weapon switch code is here:

All I need to do, is make it so when the appropriate BP switches, I can fire the right ammo. So I start with a pistol, but at the moment of course all I fire with is pistol ammo. How do I make it so I can change the ammo type when the appropriate BP is made visible?

Thank you!

You can do this by overriding the Shoot function in the children of BPWeaponMaster.

Then the logic would work like so:

You can make classes like BPWeaponPistolMaster that inherit from BPWeaponMaster and have all your pistols inherit from that class instead of BPWeaponMaster. Then in BPWeaponPistolMaster, you could override this function to fire pistol ammo and not have to do it for every pistol manually.

Thank you!

1 Like