> For the complete documentation index, see [llms.txt](https://soulslike-framework.isik.vip/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://soulslike-framework.isik.vip/components-managers/shared-components/stat-attribute-manager.md).

# Stat/Attribute Manager

<div align="left"><figure><img src="https://3303637552-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOAGs3il6rJbkejwPOlEP%2Fuploads%2FOXndO6hKeLj0uEuE8Vaf%2FActorComponent_64x.png?alt=media&amp;token=b00844b2-cbc3-4f89-9f4b-d2c8e193007c" alt=""><figcaption></figcaption></figure></div>

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:**

<figure><img src="https://3303637552-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOAGs3il6rJbkejwPOlEP%2Fuploads%2FrOdAqA1bC3MKqEiSyyxN%2Fimage.png?alt=media&amp;token=2b3a25e7-f452-449a-af17-3c23cd2bcde5" alt=""><figcaption></figcaption></figure>

### Example Usages

#### Adjust Stats:

<figure><img src="https://3303637552-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOAGs3il6rJbkejwPOlEP%2Fuploads%2FnUMaNmisYPFKJHIqyyCP%2Fimage.png?alt=media&amp;token=8b89550c-55ab-4840-b1e7-70b5b8dd576e" alt=""><figcaption><p>Will adjust "MyPrimaryStat"'s Current Value by +1 and level up the player. </p></figcaption></figure>

#### Find/Get Stats:

<figure><img src="https://3303637552-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOAGs3il6rJbkejwPOlEP%2Fuploads%2FxzYGvi9YK59vG5lpHpnK%2Fimage.png?alt=media&amp;token=ae596b73-fac2-4c3f-ab16-88d81d3426f8" alt=""><figcaption><p>GetStat() will return the Stat/Attribute Object, as well as the Stat Info struct.</p></figcaption></figure>

#### Toggle Regeneration for Compatible Stats/Attributes:

<figure><img src="https://3303637552-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOAGs3il6rJbkejwPOlEP%2Fuploads%2FiDyNdmcAITmVbPna5jbb%2Fimage.png?alt=media&amp;token=700676ca-4b82-4c6e-ae93-b535e534a964" alt=""><figcaption><p>Will try to Toggle Regeneration on the Stat Object with the provided tag.</p></figcaption></figure>

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

<figure><img src="https://3303637552-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOAGs3il6rJbkejwPOlEP%2Fuploads%2FfuPhKAE8wJ0JyqT899fp%2Fimage.png?alt=media&amp;token=a9db0e6a-c198-4ac8-9b54-e5790e55abfa" alt=""><figcaption><p>Will increase player level by 1.</p></figcaption></figure>

#### Compare Stat to a Threshold Value

<figure><img src="https://3303637552-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOAGs3il6rJbkejwPOlEP%2Fuploads%2FkyLaEbHPdDESXu14Wu9T%2Fimage.png?alt=media&amp;token=31304d9f-df4b-4041-86cf-2806aa8f7cf1" alt=""><figcaption><p>Will check if Stamina is ≥ 25.0f.</p></figcaption></figure>

### See Next: [**How to Create/Edit Stats/Attributes?**](/workflow/editor-1.md)
