Creating a Weapon System / Switching System

Hi guys,

I’m looking for the best way to set up the following system:

I want to create a weapon system that allows me to pickup weapons. However, I want to limit the weapons to only holding two weapons, and be able to switch between the two. From there you if you encounter a new gun, you can drop the current one and pickup the new one (replacing the old one). It’s pretty much an identical system to Halo.

Most tutorials I’ve found so far are pretty messy and don’t seem to handle the weapon system in a decent way. I’ve already gone about creating a Weapon Enumeration that holds a few weapon names and a BP_BaseWeapon blueprint to derive new weapons from.

Picking up the weapon I understand, but how to store this and switch between them and delete the current and replace it with a new one is what I don’t. I’m beginning to slowly get a grasp on this but it just seems like I cannot find a good tutorial to send me in the right direction.

If someone could help me with this or send me in the right direction, that would be awesome.


There’s always many different ways to do the same thing but here’s a few different approaches

Distribute the logic

  • Create a Blueprint Actor Component or Actor for each weapon, and add your weapon logic there (Firing and whatnot)
  • Have your Character’s Mesh have two Weapon Components or two Child Actors named Weapon_In_Hand and Weapon_On_Back and set their parent sockets, set to movable, and remove collision (if you’re doing different models for first person and third person meshes you’d need to do it to both)

Manually manage things

  • On the Character’s Mesh have two Skeletal Meshes for your weapons that are set like the Components
  • Manage two enums, WeaponInHand and WeaponOnBack
  • On Character Fire / Pickup / ect. check those enums and run the corresponding logic

Equipment Manager

  • Lastly a slightly better approach usually involves using an Equipment Manager that simply abstracts out the base logic of when Switching Weapons, when you can fire, and whatnot.
  • Have the Equipment Manager be on the Character and have it contain references to your weapons

Hope that helps!

Almost missed the second part of this, deleting and setting:
Depending on your method it may be different but you usually end up calling Destroy to get rid of it and Spawn Actor by Class to create a new one then re-parent / attach to the Mesh. It’s hard to give specifics since there’s so many different setups that would change what exactly you would do.

Try using this. I just created it. Maybe you can do something with it and maybe improve it.

1 Like