Weapon System

Hi, I trying to make a weapon system where the player start with a pistol, but can pick up other weapons on the level. When pick up an other weapon I want it to add as a secondary weapon so the player can switch between the pistol and the other weapon. I want the secondary weapon to be replaceable when i find a new weapon, but the pistol not replaceable, always stay as a primary weapon.
I made a GunBase actor and the weapons and a system that attach the weapon actor to the character and destroy the old one, but can’t get what exactly I want. I watched tutorials but still can’t get it right.

Not sure which part of the above you’re having problems with but do consider the following, all pseudoscript:

  • the player can reference 3 weapons:

image

  • and the logic could look like so:

I tried to make it but still not very clear.
I made this because I want it the player can only pick up weapons when the currently equipped gun is not a pistol, except the first weapon. So always need to swap to secondary weapon to replace it.

I make this to attach the pistol to the back of the player and equip a new swappable weapon. If we don’t have a secondary weapon.

and make this to detach and destroy the currently equipped weapon and attach the new weapon, when we already has a secondary weapon.

Unfortunately I can’t detach and destroy the weapons they stay in the players hand when picking up new guns, and how to properly reference the picked weapon and equipped weapon.