# Gameplay Effects

### What are Gameplay Effects?

Gameplay Effects are the only correct way to modify attributes in GAS. They are Blueprint Classes that define:

* What Attributes to change
* How to change them
* How long the change lasts
* What conditions must be met

***

### Types of Gameplay Effects

| Type     | When To Use                                                                             | Example                                      |
| -------- | --------------------------------------------------------------------------------------- | -------------------------------------------- |
| Instant  | Immediate effect that happens instantly and then disappears                             | Damage, Healing, Instant Attribute Restore   |
| Duration | Temporary effect that lasts for a specific amount of time then is automatically removed | Temporary Speed Buff, Stun, Damage Over Time |
| Infinite | Permanent effect that lasts until manually removed                                      | Passive Regeneration, Permanent stat upgrade |

***

### Creating a Gameplay Effect

{% stepper %}
{% step %}

### Create the Effect

In Content Browser, Right click in an empty space\
Select Blueprint Class\
In the search box, type "GameplayEffect"\
Select GameplayEffect (NotGameplayEffectUIData or other variants)\
Name it GE\_Heal\_50

{% hint style="info" %}
Use GE\_ prefix for Gameplay Effects. Incldue what it does in the name. Better for organization ^^
{% endhint %}
{% endstep %}

{% step %}

### Configure Duration Policy

| Duration Policy | What it Does                                      |
| --------------- | ------------------------------------------------- |
| Instant         | Effect Applies once immediately, then disappears. |
| Has Duration    | Effect lasts for specified time.                  |
| Infinite        | Effect lasts forever until manually removed.      |
| {% endstep %}   |                                                   |

{% step %}

### Add a Modifier

Modifiers are what actually change attribute values.

In Details panel, scroll down to find Modifiers\
Click the + button to add a new modifier\
Expand the newly created Modifier \[0] entry

**Configure the modifier:**

* Attribute: Click Dropdown -> Select RealityAttributeSet.Heal
* Modifier OP: Set to Add (Base)
* Modifier Magnitude: Expand this section
* Magnitude Calculation Type: Set to Scalable Float
* Scalable Float Magnitude -> Value: Set to 50.0

{% hint style="info" %}
The Heal attribute is a meta attribute. When you add to it, the system automatically convers that into an increase to Health proper clamping and callbacks.&#x20;
{% endhint %}
{% endstep %}

{% step %}

### Save and Compile

Click Compile and Click Save!
{% endstep %}
{% endstepper %}

***

### Applying the Gameplay Effects

In the Event Graph, right click in an empty space and search "Apply Effect to Player". \
Select your Effect Class, and desired magnitude. (Just leave it at 1.0 for this example)\
In an Empty Space, Right Click and get "Get Reality Player Controller", then, from the Return Value of that node, connect it to "Player Controller" of the Apply Effect node.&#x20;

Make sure your Apply Effect node is connected to an event.&#x20;

{% hint style="info" %}
Get Reality Player Controller is getting Player 0 (Owner of the Blueprint), If using the gamemode BP you will have to get a specific players player controller ref.
{% endhint %}

***

### Applying Gameplay Effect Examples

#### Specific Player from All Players


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://beyond-sandbox.gitbook.io/realitysdk/documentation/reality-gameplay-system/gameplay-effects.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
