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-
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.
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?