Gameplay Attributes
Last modified: 15 August 2024Add the
NinjaInventoryAttributeSet
to your Ability System Component.Initialize the Attribute Set with a Data Table that uses
AttributeMetaData
as the row type.Initialize the
WeightLimit
attribute, if your Inventory Manager will track encumbrance.Initialize the
Wealth
attribute, if your character has any initial funds.The attributes,
EquipmentLevel
,AverageEquipmentLevel
andEncumbrance
are calculated automatically and don't require initialization.
The Inventory Framework includes its own Attribute Set, containing attributes used by certain functionalities provided by Items or by the Inventory Manager itself.
The Attribute Set is represented by the NinjaInventoryAttributeSet
class, make sure to add it to the Ability System Component assigned to your Character or Player State.
Available Attributes
The following table contains all attributes available in the Inventory System's Attribute Set.
Attribute | Description | Meta |
---|---|---|
| Current wealth for the character. Can represent any type of in-game currency. | No |
| Aggregation of the level from all equipment pieces in use. Maintained automatically. | Yes |
| Average Equipment Level. Maintained automatically. | Yes |
| Maximum weight capacity for this inventory. | No |
| Weight currently carried by the avatar, considering stacks. Maintained automatically. | Yes |
| Slots available for the Backpack container. Provided for convenience, but not required. | No |
tip
You can always track your character's Attributes and their current values using the Gameplay Ability System debugger.
For more information about debugging the Inventory, including the Ability System please check the Debugging topic.
Average Equipment Level
This Meta Attribute is calculated by the GetAverageGearLevel
function in Equipment Manager. The attribute is updated when the total Equipment Level changes. The calculation logic can be represented as:
float absolute_level = aggregate_levels();
int container_count = get_relevant_containers().size();
return absolute_level / max(relevant_container_count, 1)
This means the average level is defined by the absolute item level divided by the amount of relevant containers configured in the inventory layout.
tip
A relevant container is an equipment slot not used for cosmetics.
Initialization Data
You can use this Json to facilitate the creation the Data Table used to initialize the Inventory Attributes. Please note that only attributes that are not maintained automatically were included.
The Data Table Row type used to create Attribute Set Data for initialization is provided by the Gameplay Ability System You can create your data table using the AttributeMetaData
structure.
Inventory Attributes
{...}