# Data Assets and an Inventory System

**URL:** <https://forums.unrealengine.com/t/data-assets-and-an-inventory-system/1422623>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [November 26, 2023, 12:33pm UTC](https://forums.unrealengine.com/t/data-assets-and-an-inventory-system/1422623 "2023-11-26T12:33:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![K1N3RGY11](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/k1n3rgy11/32/735473_2.png) [@K1N3RGY11](https://forums.unrealengine.com/u/K1N3RGY11)\
**Post date:** [November 26, 2023, 12:33pm UTC](https://forums.unrealengine.com/t/data-assets-and-an-inventory-system/1422623/1 "2023-11-26T12:33:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [November 26, 2023, 12:50pm UTC](https://forums.unrealengine.com/t/data-assets-and-an-inventory-system/1422623/2 "2023-11-26T12:50:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![K1N3RGY11](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/k1n3rgy11/32/735473_2.png) [@K1N3RGY11](https://forums.unrealengine.com/u/K1N3RGY11)\
**Post date:** [November 26, 2023, 12:58pm UTC](https://forums.unrealengine.com/t/data-assets-and-an-inventory-system/1422623/3 "2023-11-26T12:58:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [November 26, 2023, 1:28pm UTC](https://forums.unrealengine.com/t/data-assets-and-an-inventory-system/1422623/4 "2023-11-26T13:28:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![K1N3RGY11](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/k1n3rgy11/32/735473_2.png) [@K1N3RGY11](https://forums.unrealengine.com/u/K1N3RGY11)\
**Post date:** [November 26, 2023, 3:28pm UTC](https://forums.unrealengine.com/t/data-assets-and-an-inventory-system/1422623/5 "2023-11-26T15:28:32Z")

</div>

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/](https://blueprintue.com/blueprint/19adp0r1/)

---

<div class="post-metadata">

**Author:** ![Titirez](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/titirez/32/1194668_2.png) [@Titirez](https://forums.unrealengine.com/u/Titirez)\
**Post date:** [November 26, 2023, 3:32pm UTC](https://forums.unrealengine.com/t/data-assets-and-an-inventory-system/1422623/6 "2023-11-26T15:32:01Z")

</div>

@K1N3RGY11 I recommend taking a look into Epic’s ‘ActionRPG’ sample: [Action RPG Game | Unreal Engine Documentation](https://docs.unrealengine.com/4.26/en-US/Resources/SampleGames/ARPG/)

---

<div class="post-metadata">

**Author:** ![3dRaven](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/3draven/32/906552_2.png) [@3dRaven](https://forums.unrealengine.com/u/3dRaven)\
**Post date:** [November 26, 2023, 3:48pm UTC](https://forums.unrealengine.com/t/data-assets-and-an-inventory-system/1422623/7 "2023-11-26T15:48:19Z")

</div>

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++

> [@Is there a way to update and save data table from blueprint?](https://forums.unrealengine.com/t/is-there-a-way-to-update-and-save-data-table-from-blueprint/104390/13):
>
> the engine now seems to support load/save to csv/json this is available on 5.1 at least but not sure if it’s on previous too. also You can save your data table from cpp. call FDataTableEditorUtils::BroadcastPreChange(DataTable, FDataTableEditorUtils::EDataTableChangeInfo::RowList); you can get the rows using DataTable-\>GetAllRows and you get some pointers. you can modify them. or you can add rows using DataTable-\>AddRow at the end you need to call DataTable-\>Modify() then UEditorLoadi…

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.

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [November 26, 2023, 5:28pm UTC](https://forums.unrealengine.com/t/data-assets-and-an-inventory-system/1422623/8 "2023-11-26T17:28:32Z")

</div>

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](https://www.unrealengine.com/marketplace/en-US/product/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.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [September 7, 2024, 10:14am UTC](https://forums.unrealengine.com/t/data-assets-and-an-inventory-system/1422623/9 "2024-09-07T10:14:47Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
