I am working on a project in where it’s possible to get 6 weapons, and only 6 weapons (one of each weapon), and each weapon goes into a specific ‘slot’ on the player. Once the player picks up a weapon, they can switch to the weapon using numpads 1-6.
The problem I am having, is trying to store the ‘slot data’ on the character blueprint. Each bp_weaponname is a child of bp_weapon, which has a ‘weaponData structure’ on it, which stores the slot # the weapon goes in, the weapon name, and whether the player has the weapon or not.
All of that works great, and the keybinds for switching weapons etc are in place (I am only using prints right now until I figure out the slot stuff), and I can interact with weapons to pick them up (but storing them doesn’t work, for obvious reasons).
I am trying to figure out how I can store slot information on the player blueprint, and store the weapon pawn in the correct slot when it’s picked up. I tried creating an ‘equippedWeapons’ structure attached to the player character (with slots1-6 defined as bp_weaponname etc), but I can’t set a default value in the editor (I receive a ‘Editing this value in a Class Default Object is not allowed’ error).
Am I going the correct route for doing this? Ideally, there is a variable with slots 1-6 (and possibly more later if we add more guns) stored on the player blueprint, and whenever a gun is interacted with, it executes a function to store the picked up weapon in the correct slot on the player.
Any help would be greatly appreciated. I thought a struct is what I needed to do this, but that doesn’t appear to be the case.
Sorry if this post is confusing. I wanted to outline the intended functionality. Everything except for the slot variable on the player, and the function to set a weapon into one of those slots, is working. I just am having trouble figuring out how to store the needed data on the player.