How can I make a weapon that I can pick up and then have multiple weapons in a inventory?
I would check out the UMG Inventory tutorial and use that as a starter. You can use a weapon mesh as a pickup item. when that item is picked up you can set up the “USE” option to set a variable to allow you to spawn that weapon. I am not quite sure if it would work but it sounds like what I am going to try once I get done with my menus.
Hi pikachu1001000,
A simple way to do an inventory (not the best way, mind you) would be to make an array of a variable type. The size of the array and the number of arrays you may need would depend on how you want this inventory system to work. If you wish to do something similar to an FPS like Doom or Unreal Tournament, you could have an array with about 10 booleans. If you want to get more fancy, you could make a struct or class for the weapons themselves that can store things like ammo or durability, instead of using booleans. Each boolean could be associated with a weapon and be set to true or false depending on if the character has it. You could then have keybindings set up for 1-9 on your keyboard and if a user hits a button, check to see if the boolean for that weapon is true. If it is true, then equip the weapon associated with it.
As far as the pickup goes, you could make an asset that sits on the ground (or floats, it’s up to you) with a box collision surrounding it to act as a trigger. Turn all collision off but allow the trigger to overlap pawns. After this, you could use ‘OnBeginOverlap’ on either the Pawn or the asset itself to set the boolean in your array that is associated with that weapon to true and then run DestroyActor on the asset.
Hope this helps!
I do want something similar to Unreal Tournament.