ON THIS PAGE
ITEMS EXPLAINED
Items are made of two parts: The Data Asset that defines the item type, and the Struct that contains each item’s individual data.
Item Data Assets
The Data Asset is the foundation of items. They are not the items themselves, but are instead something like the blueprint of the item from which all item instances are created.
The Data Asset contains all the generation rules and logic for each item type, as well as the static variables and rolled stat rules that define each item.
The Data Asset should be used to access and process any data relating to an item. Any fixed or static values can be accessed directly through a getter function on the Data Asset, and instanced values like Rolled Stats can be processed according to the rules defined by that Data Asset.
The Data Asset also allows for child classes that can have unique variables and functions, as well as overrides to parent functions for changes to default item behaviour. For example, a weapon may decide to use its Weapon Type enum variable in the Get Item Type Text function instead of a generic Item Type.
It is important to note that Data Assets are not instanced, and are read only. Any item data that needs to be saved per item instance should use the Item Live Data struct that’s saved in the inventory and Save Game file.
Data Assets also come in two varieties: A Primary Data Asset, and the individual Data Assets themselves.
Blue Primary Data Assets are like the Class, where variables and functions are defined. Red Data Assets are data only blueprints where variables can be set. The red Data Assets are the ones that are chosen when working with Data Assets and Items, and the functions that can be called on them belong to the blue Primary Data Asset they inherit from.
ST_ItemLiveData
The struct is fairly simple. It only contains the data that can change on an individual item instance, and a reference to its parent Data Asset. Here is an example of how an item might look when generated:
Here's an explanation on what all of this means:
Variable | Description |
---|---|
Item ID | A unique identifier for this item. This can be added to individual item instances where randomly rolled stats or other live data are unique to individual items such as weapons and armor, or can be set to an Item Type as a whole for stackable, unchanging items like materials or consumables. |
Item Level | This item’s level. Items that can roll different Rarity tiers have their Rarity decided by their level according to a curve table. Fixed and rolled stats can be scaled by level using a stat scale curve. Unlevelled items (like materials, quest items etc) are set to 1. |
Quantity | A stack of items is contained within a single slot using this quantity value. Non stackable items like weapons and armour are set to 1. When a stackable item is added to an existing stack, it simply modifies the quantity value stored in this struct, and so should only be used for items that do not have individual data such as random rolled stats. |
Item Rolled Stats | These are the randomly rolled stats unique to this item instance. A stat roll is made of only a few parts. The Stat Name, Stat Group, Stat Value, and Stat Level Scale Curve. |
Item Inventory State Tags | These tags define changes to an item’s state. This includes flags like Favourite, Protected, Junk, and New. Items that are set to Locked (either Favourite or Protected) cannot be sold, dropped, or dismantled. Items marked as Junk can be sold and dismantled in bulk. New items will have a “New” indicator on the item slot in the player inventory. |
Item Data Asset | The item’s parent Data Asset that contains all of the item’s static data, as well as providing data processing that can be unique to each item type. This includes item generation, stat rules and display formatting, rolled stat conversion to true values and more. |
Saved Live Data | This is for unique live data specific to an item type that can be changed per item instance that is not included in the base item type. This could be used for things like equipped current ammo on a weapon, battery charge for a torch, and so on. Saved Live Data is stored as a array of strings that can be converted to and from your variables in the item’s Data Asset. |