Inventory with item nesting.

What is the proper way to implement items nesting in an inventory system? Also if I want items to have a mutable state like durability, power, or other UObject is my only option? Also when saving and loading such items should I use a data table with a two-way lookup? Or there are other ways to handle such inventories in the Unreal engine?

I folled this video course by Ryan Laley to implement my inventory system. The fact that it’s component based makes it very easy to work with as you can just put inventories where ever you want.

I also followed other very similar tutorials, some of them used actor references instead of classes to store them, but I prefer classes and destroying / respawning actors once you put them in your inventory / throw them out.

The durability thing depends on how you want to handle this. It would be easiest if you just can’t stack durability items. Otherwise you’d either have to persist all the durabilities for each item in a stack too, or make it like Ark did it with food where only the uppermost item of a stack loses durability.

Let me know if you need anymore help!

As as i understand i can’t nest blueprint structs in ue? (something like this https://hastebin.com/izefonaben.cpp), and there can’t be any inheritance so i must store all info in a huge struct regardless if item is weapon or weapon or any other item type.

I don’t think nested structs are an issue… (?)

I tried in a test project and you can reference a child struct in a parent struct (blueprint).
I wouldn’t know if this could cause any issues tho.

293116-structs.png