Hi, today I tried to programming with blueprint a FPS inventory.
I have to confess: I still not understood how the arrays, struct and enums work. instead, make the most of them.
I want not only creating an inventory (after all, there are a lot of tutorials)
but creating 'dedicates slots: first slot Melee weapons, second slot Guns, third’Shotguns, etc.
In this game there are a lot of weapons for each class.
Since, I recently have got the habit to try for first and asking after trying.
Here what I did: Is that the right way?
So using an enum?
Hi man ,
i suppose that you want to store 2 guns in the 2 guns slots and 2 melee in the melee slots , and so on.
You can do it all by Array of enum , you create an enumerator full of all weapons you can have.
then you create an array of that enumerator, naming it SlotMelee.
Then… Only the 'Melee, Shotguns and Explosives slot should have max two weapons per slot. The other slot should have only one weapon, like a fps arena!
I’ve to specify a thing: there are too many weapons in this game.
So, if I press E (interact) the blueprint assigns the weapon to the dedicated slot in relationship with its class.
Sure man , Here i made a wall and a weapon generator, the weapon get a random type from enum.
When the Weapon hit the wall : i get his reference and from there i get his type.
wich his type i Switch to different slots array.
sure if you need only 1 weapon you dont need an array.
I just made the weapon add my array if is empty , or overwrite the old weapon.
but here is a good way to switch N weapon.
you can also have multiple kind of weapon pinned to the same slots !
if you have an Mk23, a Revolver and a DesertEagle type… these are all gun
and all their switch go to the Gun Slot.