Stat/Attribute Manager

The Stat Manager (AC_StatManager) is responsible for managing all stats and attributes in the project, both for player and AI. It works similarly to the Action Manager by instantiating each stat as a UObject at runtime, based on either a provided map or a data table. This component is designed to be data-oriented and event-driven, ensuring real-time responsiveness and integration with other systems.

It is added to the Base Character class by default (B_Base_Character).

How It Works

  1. Stat Initialization:

    • At startup, the AC_StatManager:

      • Loads stats from the provided data table or Stats[] map.

      • Creates an instance of each stat as a UObject for modular and extensible management.

    • The player's class asset provides base values for the attributes.

  2. Stat Tracking:

    • Maintains a centralized map of stat instances, allowing quick retrieval through Gameplay Tags.

  3. Stat Modification:

    • Provides methods to:

      • Increment or decrement a stat by a given value (e.g., apply damage, buffs).

      • Query the current or base value of a stat.

      • Level up the player.

  4. Event Dispatching:

    • Changes to stat values automatically trigger event dispatchers, which are typically listened to by:

      • UI Widgets (e.g., updating health bars, stamina meters).

      • Other Components (e.g., triggering status effects or activating abilities).

Adjusting Which Stats/Attributes to Initialize

The Stats/Attributes a character will have depends on what the Stat Manager is provided. Stats can be provided through a data table or through the Stats[] map in AC_StatManager:

Example Usages

Adjust Stats:

Will adjust "MyPrimaryStat"'s Current Value by +1 and level up the player.

Find/Get Stats:

GetStat() will return the Stat/Attribute Object, as well as the Stat Info struct.

Toggle Regeneration for Compatible Stats/Attributes:

Will try to Toggle Regeneration on the Stat Object with the provided tag.

Adjust Player Level Manually

Player level is handled automatically through attribute increase from the Campfire. However, you can also manually increase/decrease level using the Stat Manager.

Will increase player level by 1.

Compare Stat to a Threshold Value

Will check if Stamina is ≥ 25.0f.

Last updated

Was this helpful?