How to bypass the inventory (drop the current weapon when pickup up a new one)

This one doesn’t get asked a lot, but still comes up once or twice a year, so I decided to make a tutorial for it.

The inventory is basically just a widget that shows you the content of UT_Inventory and UT_InventoryBackpack arrays on the character, and by default, if you set equipped weapon slots to 4 (UT_Inventory) and if there is no more space left, it goes into the backpack one instead, from where you can unequip old ones and equip a different weapon, etc.

This also means that the inventory widget itself can be entirely bypassed in order to do such things, you can call the Drop Current Weapon function from anywhere really

But in this case let’s put it in BP_WeaponBase when it’s interacted with

And in BP_WeaponDropSpawner when it’s picked up

That’s it!

You now drop your current weapon each time you pick up a different one.