I’m trying to make an inventory that can store items with custom properties such as durability or maybe leftover ammos in a gun.
In my project items are stored in a DataTable that it self use a structure which have some basic values like name, icon, equipActor(actor classReference), pickupActor (actor classReference), quantity.
The Inventory it’s just a component with an array type of the structure that I mention before.
To hold an item it’s just spawning a new item actor with values from (inventory component → array Item Structure) and the actor get destroyed when change you item so you can spawn the new one.
Now the problem is that some items need some extra custom values like durability but as you can understand other items like wood don’t need it.
So if you have any idea how can I do that pleaze respond. (I have no problem rewriting the entire program if is necessary)
Some ideas I’ve already tried and failed:
-
Add all custom values to the sturcture for items.
At one point if I add to many values for different items it will be really hard to find anything and probably will have lag issues. -
Changing the array in Inventory component to type of actor.
Two problems, I can’t have in chest default items with custom properties cause you need to spawn it first.
second all items need to be stored in a location of the map(this will cause lag issues) -
Adding the custom values directly to the actor items.
Custom values can’t be saved when i don’t hold them because the actor get’s destroyed.