[C++] How to handle items in an inventory system?

Hello there,

Basically I started writing some UI code in a class deriving from AHUD to be able to open the inventory with ‘i’ and move around items. My problem is I am not sure where to create the items. Should I create some kind of database to store all items & their properties? Or is it better to create files for different items that will be read when the game starts? I have many ideas but before wasting my time with something that turns out to be bad I would like to ask you guys on your opinions and experiences with inventory systems.

I hope somebody has a good advice for where to start.

Thanks for reading!

Make item actor base class with variables with properties your game needs and functions which allow manipulation and then child from that base class which will be items :slight_smile: You should use that class for both world pickup and item in inventory and make graphical component invisible whatever is it in invetory or not. Would be good if you set owner of actor to who owns item. You will also need some inventory manager, depending on if items are assined to pawn or player (PlayerController) make array there which will contain pointers to item actors which player has, best practice is to make sperate class just for those mechanics, which later you can attach to any class.

Study Actor class to utilize the best of it to that:

Also i recomad you to check how old UE3 (and older) inventory system looked like which UE4 does not have anymore:

http://uncodex.com/2012-03/engine/inventorymanager.html <-inventory menager
http://uncodex.com/2012-03/engine/inventory.html <-Inventory class which represents the item, check childs too