> For the complete documentation index, see [llms.txt](https://roogame.gitbook.io/roogame/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://roogame.gitbook.io/roogame/ultimate-stats-framework/creating-your-status-effect-system/api-reference.md).

# API Reference

Use the Status Effect API through the Ultimate Stats Framework **Component** to add, remove, query, and monitor Status Effects at runtime.

### Apply Status Effects

| Function            | Description                                                                             |
| ------------------- | --------------------------------------------------------------------------------------- |
| `Add Status Effect` | Adds a Status Effect to the component by its Status Effect Tag.                         |
| `Apply Stat Action` | Executes a Stat Action Data Asset. A Stat Action can also add or remove Status Effects. |

<figure><img src="https://2218703886-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4YPyrdOyfjDGtlxlvjSd%2Fuploads%2FYuYQ7RleI6FhDXzAmFRT%2Fimage.png?alt=media&amp;token=7b98c703-7490-46be-b059-7369c67cb8fa" alt=""><figcaption></figcaption></figure>

#### Add Status Effect

```
Inputs:
Status Effect Tag
Source ID
Time Elapsed
```

```
Status Effect Tag
```

The Gameplay Tag of the Status Effect to apply.

```
RooGame.Stats.StatusEffect.Bleeding
RooGame.Stats.StatusEffect.Poison
RooGame.Stats.StatusEffect.Haste
```

```
Source ID
```

An optional identifier for the source that applied the Status Effect.

```
Skill_BleedingStrike
Weapon_PoisonSword
Enemy_Spider
```

```
Time Elapsed
```

The initial elapsed time for the Status Effect. Leave this at `0.0` when applying a new effect normally.

Example:

```
Add Status Effect

Status Effect Tag:
RooGame.Stats.StatusEffect.Bleeding

Source ID:
Skill_BleedingStrike

Time Elapsed:
0.0
```

### Remove Status Effects

| Function                       | Description                                                |
| ------------------------------ | ---------------------------------------------------------- |
| `Remove Status Effect`         | Removes one or more stacks of a Status Effect.             |
| `Clear Status Effects By Type` | Removes every active Status Effect with the selected Type. |
| `Clear All Status Effects`     | Removes every active Status Effect from the component.     |

<figure><img src="https://2218703886-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4YPyrdOyfjDGtlxlvjSd%2Fuploads%2FimubsWUr8zM2OjtkfaKX%2Fimage.png?alt=media&amp;token=20a0b06a-c307-4c6b-996c-03c1779c5777" alt=""><figcaption></figcaption></figure>

#### Remove Status Effect

```
Inputs:
Status Effect Tag
Amount
```

`Amount` defines how many stacks to remove.

```
Amount = 1
```

Removes one stack.

```
Amount = 3
```

Removes up to three stacks.

Example:

```
Remove Status Effect

Status Effect Tag:
RooGame.Stats.StatusEffect.Bleeding

Amount:
1
```

### Query Status Effects

| Function                           | Description                                               |
| ---------------------------------- | --------------------------------------------------------- |
| `Has Status Effect`                | Returns whether the specified Status Effect is active.    |
| `Get Status Effect Stack Count`    | Returns the number of active stacks.                      |
| `Get Status Effect Remaining Time` | Returns the remaining duration of a specific stack.       |
| `Get Status Effect Progress`       | Returns the remaining duration ratio of a specific stack. |

<figure><img src="https://2218703886-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4YPyrdOyfjDGtlxlvjSd%2Fuploads%2FEY0CinJ3F25SyzQ16tnp%2Fimage.png?alt=media&amp;token=54f645b6-cf68-48c1-b17c-7bccda7aa8c8" alt=""><figcaption></figcaption></figure>

#### Has Status Effect

```
Has Status Effect
Status Effect Tag = RooGame.Stats.StatusEffect.Bleeding
```

Returns `true` while at least one Bleeding stack is active.

#### Get Status Effect Stack Count

```
Get Status Effect Stack Count
Status Effect Tag = RooGame.Stats.StatusEffect.Bleeding
```

Example result:

```
Bleeding Stacks = 3
```

### Component Events

The Ultimate Stats Framework Component provides the following Status Effect events.

| Event                        | Trigger                                                          | Parameters                         |
| ---------------------------- | ---------------------------------------------------------------- | ---------------------------------- |
| `On Status Effect Added`     | Fires after a Status Effect stack is added.                      | `Status Effect Tag`, `Stack Count` |
| `On Status Effect Removed`   | Fires after a Status Effect stack is removed.                    | `Status Effect Tag`, `Stack Count` |
| `On Status Effect Refreshed` | Fires when an existing Status Effect duration is refreshed.      | `Status Effect Tag`, `Stack Count` |
| `On Status Effect Ticked`    | Fires after a Status Effect completes one Tick Action execution. | `Status Effect Tag`, `Stack Count` |
| `On Status Effect Expired`   | Fires when one or more stacks expire because of duration.        | `Status Effect Tag`, `Stack Count` |

<figure><img src="https://2218703886-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4YPyrdOyfjDGtlxlvjSd%2Fuploads%2FvHoopYxNgWNOrGFQ8sUa%2Fimage.png?alt=media&amp;token=49471915-ab09-4c6a-8d75-85714184e4e3" alt=""><figcaption></figcaption></figure>
