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?
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.
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.