Data Assets and an Inventory System

I’m currently using a Data Table to store the item information in. However after learning the hard way I’ve realized that if I want items to have randomized stats it can’t be stored in a data table.

I’ve then learned that you can use Data Assets to store this information in which can contain variables etc.

What the item would look like:
Item Name
Boots / Gloves / Chestplate / Helmet etc
Type of Armor
Soulbound / Accountbound / Bind on Equip
Main Stat value / Main Stat description
Sub Stat value / Sub stat description
Resistances:
Vulnerabilities:
Durability 100 / 100

Going back and forth between different tutorials and “best practices” I’m more than likely confused as to what the best system would be for something like this and whether I can actually achieve something like this with a data table?

Any help on this would be much appreciated.

Data table can store the base items. Use a struct to hold the base item index and any overloaded (random values) and extra attributes.

The serialize / deserialize the array of structs to save or load the inventory.

I have the data table and the item stuct set up, so for example I have an item struct with:

Min Damage - Integer
Max Damage - Integer

Would i then define the “integer” in the actor itself referencing the item struct and setting the values “min damage” / “max damage”?

Yes the inventory item would have the override values inside of it’s struct.
It’s up to you to decide it it’s hard overrides (replacing the values) or just the delta value from the base class item.

Am i missing something here, the text value isn’t changing the data table value at all and I can’t think what I’m missing

https://blueprintue.com/blueprint/19adp0r1/

@K1N3RGY11 I recommend taking a look into Epic’s ‘ActionRPG’ sample: Action RPG Game | Unreal Engine Documentation

You are not setting the item by reference.
The datatable will also reset upon the end of gameplay. It does not have a built in load / save function. You would have to use the datatable function convert struct to JSON string and save it as a field in your savegame.

Though loading would probably need c++

Though I doubt there is need for a datatable for the characters inventory. You can just save out the TArray of structs to a save file and reload it on game load de-serializing it and populating the array again.

I use data tables for my items. On pickup I do a look up and transfer that data to structs in the actor class. The DT’s just hold configuration info for the various items.

For example recoil, rate of fire, base dmg per bone, drop off curves, sway curves. I use the DT’s because it makes modifications to stats easy. Using something like runtime datatable I can make changes in a live environment to ease patching/tweaking/testing.

For inventory I strictly use structs. Attached actor items (guns, armor etc) are stored as parent class based obj refs in the primary inventory struct.

1 Like