> For the complete documentation index, see [llms.txt](/llms.txt)

# GS2-Buff Script Trigger Reference

Reference for event triggers that call extended scripts



## Trigger

### apply

Buff application

**Related methods:**
applyBuff - Apply buff
applyBuffByUserId - Apply buff by User ID


#### Synchronous Execution Script

The script is executed synchronously before the buff application process.

##### Request

| | Type | Description |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | Namespace |
| buffEntryModel | [BuffEntryModel](../sdk/#buffentrymodel) | Buff Entry Model |
| userId | string | User ID |

##### Result

|  | Type | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- |
| permit | bool | ✓ |  |  | Whether to allow the buff to be applied |
| overrideBuffRate | float | ✓ |  | 0 ~ 100 | Override rate applied to the buff (multiplier) |

##### Implementation Example


**Lua**
```lua

-- Request
local namespace = args.namespace
local buffEntryModel = args.buffEntryModel
local userId = args.userId

-- Business logic:
local permit = true
local overrideBuffRate = 0

-- Result
result = {
  permit=permit,
  overrideBuffRate=overrideBuffRate
}
```


#### Asynchronous Execution Script

The script is executed asynchronously after the buff application process.

##### Request

| | Type | Description |
| --- | --- | --- |
| namespace | [Namespace](../sdk/#namespace) | Namespace |
| buffEntryModel | [BuffEntryModel](../sdk/#buffentrymodel) | Buff Entry Model |
| userId | string | User ID |


##### Implementation Example


**Lua**
```lua

-- Request
local namespace = args.namespace
local buffEntryModel = args.buffEntryModel
local userId = args.userId

-- Asynchronous scripts typically do not affect the API response.
-- These scripts are typically used for logging, analytics, external notifications, and similar purposes.

result = {
}
```


---
  



