Shooter weapon inventory array setup

I’m looking to make a simple inventory system for my FPS that I’m working on, so at the start of the match, a player chooses a primary weapon, and the secondary is always a handgun, it can’t be modified. However, I also want to have the option for the player to pick up special weapons in the game, such as a flamethrower, or launcher, which would mean that they would need another slot. From looking at the ShooterGame example it looks like creating an array BP would be the best option, but I have two questions-

  1. In my Character BP, I’m referencing the fire function of the specific weapon I’m using, and I have an if statement to change the spawned weapon, and fire function to the secondary, when the swap weapon button is pressed. The problem with this is that it only can reference two specific weapons, and I would like to be able to simply say, “when the swap button is pressed, spawn a new active weapon, and use the function of that active weapon”- so it could be any of the weapons, all with their own different functions, just like ShooterGame does. Any idea on how to achieve this? Basically I want to be able to make a generic spawn actor and a generic function for firing which are automatically filled depending on the weapon you have selected, as opposed to spawning a specific weapon BP.

  2. Assuming I got question 1 working, I would have a selectable primary weapon that swaps to a fixed secondary weapon, but then if I picked up a special weapon in game such as a launcher, how would I then add that to my inventory, and call that specific weapon BP?


I’ve decided to go for a simple flip flop approach (Primary/Secondary), and then spawning special weapons with another key, so all good!

Can you tell me how you did it? I’m a bit of a newbie but your system sounds great, what exactly is the blueprint required? Thanks!

It’s all about destroying the currently spawned actor, and attaching a new one to the hand socket of the character mesh. The flip flop determines which weapon is currently equipped, and will go back and forth from primary to secondary!