I’m making a Weapon Inventory, so that the FirstPersonCharacter can collect his weapons and switch through them pressing the corresponding key on the keyboard.
Now, I created a Base Class (called Weapon) and a Derivated Class from it (called Minigun). I’m gonna use the Minigun as example for my purpose.
I created two variables on the Character: OwningWeapons (array of Weapon objects) and ActiveWeapon (Weapon reference object).
I then created some functions on the Character: AddWeapon, CheckAlreadyOwning, AddBullets
I’ve troubles in AddWeapon function.
The outer is the “owner” of your created object. If that is in your pawn, you should probably get a reference to self and plug it in there. But it seems minigun is an actor and not an object? You don’t construct actors like that, you spawn them.
Set the minigun actor to data-only, then add mesh to that data
Add a current weapon mesh to character, then change it to Spawn Actor From Class and spawn it anywhere and make it ignore collision
Then read data from it and set it to your character’s mesh component