GS2-Enhance Script Trigger Reference

Reference for event triggers that call extended scripts

Trigger

enhance

Enhancement execution

Synchronous Execution Script

The script is executed synchronously before the enhancement execution process.

Request
Type Description
namespace Namespace Namespace
rateModel RateModel Enhancement Rate Model
targetItemSetId string GRN of the Item Set to be enhanced
bonusRate float Experience bonus multiplier (1.0 = no bonus)
experienceValue long Amount of experience gained
Result
Type Required Default Value Limits Description
permit bool
✓
Whether to allow enhancement execution
overrideExperienceValue long 0 ~ 2147483645 Amount of gained experience to override
Implementation Example
-- Request
local namespace = args.namespace
local rateModel = args.rateModel
local targetItemSetId = args.targetItemSetId
local bonusRate = args.bonusRate
local experienceValue = args.experienceValue

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

-- Result
result = {
  permit=permit,
  overrideExperienceValue=overrideExperienceValue
}

Asynchronous Execution Script

The script is executed asynchronously after the enhancement execution process.

Request
Type Description
namespace Namespace Namespace
rateModel RateModel Enhancement Rate Model
targetItemSetId string GRN of the Item Set to be enhanced
bonusRate float Experience bonus multiplier (1.0 = no bonus)
experienceValue long Amount of experience gained
Implementation Example
-- Request
local namespace = args.namespace
local rateModel = args.rateModel
local targetItemSetId = args.targetItemSetId
local bonusRate = args.bonusRate
local experienceValue = args.experienceValue

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

result = {
}