Trigger API Reference DCEI Functions Effect0 - funovus/editor-wiki GitHub Wiki

Table of Contents
- [Trigger API Reference\DCEI Functions\Effect](#trigger-api-referencedcei-functionseffect) * [string GetEffectType(string effectName)](#string-geteffecttypestring-effectname) * [void CreateEffect(string effectName, unit target)](#void-createeffectstring-effectname-unit-target) * [void CreateEffectAtUnit(string effectName, unit target)](#void-createeffectatunitstring-effectname-unit-target) * [void CreateEffect(string effectName, unit caster, unit source, unit target)](#void-createeffectstring-effectname-unit-caster-unit-source-unit-target) * [void CreateEffectAtUnit(string effectName, unit target, unit caster, unit source)](#void-createeffectatunitstring-effectname-unit-target-unit-caster-unit-source) * [void CreateEffect(string effectName, unit caster, float x, float z)](#void-createeffectstring-effectname-unit-caster-float-x-float-z) * [void CreateEffectAtPosition(string effectName, unit caster, float x, float z)](#void-createeffectatpositionstring-effectname-unit-caster-float-x-float-z) * [double EvaluateEffectHookExpression(string name)](#double-evaluateeffecthookexpressionstring-name) * [object GetEffectHookFieldValue(String[] path)](#object-geteffecthookfieldvaluestring-path) * [void SetEffectHookFieldValue(String[] path, object value)](#void-seteffecthookfieldvaluestring-path-object-value)

Trigger API Reference\DCEI Functions\Effect {Trigger-API-ReferenceDCEI-FunctionsEffect}

string GetEffectType(string effectName) {string-GetEffectTypestring-effectName}

string GetEffectType(string effectName)

Description

Returns the effect type of an effect as a string.

Parameters

  • string effectName the name of the effect to check the type of.

Example Usage

local effect_type = DCEI.GetEffectType("DoNothing")
DCEI.LogMessage(effect_type)

void CreateEffect(string effectName, unit target) {void-CreateEffectstring-effectName-unit-target}

void CreateEffect(string effectName, unit target)

Description

Creates an effect targeting a unit. There is no source or caster unit.

Parameters

  • string effectName the name of the effect to create.
  • unit target the unit to target with the effect.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = "Standard MeleeUnit"
local x, y = 16, 16
local test_subject = DCEI.CreateUnitAsync(team_id, player_id, unit_type, x, y)
DCEI.CreateEffect("Kill", test_subject)

void CreateEffectAtUnit(string effectName, unit target) {void-CreateEffectAtUnitstring-effectName-unit-target}

void CreateEffectAtUnit(string effectName, unit target)

Description

Creates an effect targeting a unit. There is no source or caster unit.

Parameters

  • string effectName the name of the effect to create.
  • unit target the unit to target with the effect.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = "Standard MeleeUnit"
local x, y = 16, 16
local test_subject = DCEI.CreateUnitAsync(team_id, player_id, unit_type, x, y)
DCEI.CreateEffectAtUnit("Kill", test_subject)

void CreateEffect(string effectName, unit caster, unit source, unit target) {void-CreateEffectstring-effectName-unit-caster-unit-source-unit-target}

void CreateEffect(string effectName, unit caster, unit source, unit target)

Description

Create an effect targeting a unit via a source unit as if cast by another unit.

Parameters

  • string effectName the name of the effect to create.
  • unit caster the unit that is considered to be the caster of the effect.
  • unit source the unit to treat as the effect source.
  • unit target the unit to target with the effect.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = "Standard MeleeUnit"
local x, y = 16, 16
local caster = DCEI.CreateUnitAsync(team_id, player_id, unit_type, x, y)
local source = DCEI.CreateUnitAsync(team_id, player_id, unit_type, x, y)
local target = DCEI.CreateUnitAsync(team_id, player_id, unit_type, x, y)
DCEI.CreateEffect("Kill", caster, source, target)

void CreateEffectAtUnit(string effectName, unit target, unit caster, unit source) {void-CreateEffectAtUnitstring-effectName-unit-target-unit-caster-unit-source}

void CreateEffectAtUnit(string effectName, unit target, unit caster, unit source)

Description

Create an effect targeting a unit via a source unit as if cast by another unit.

Parameters

  • string effectName the name of the effect to create.
  • unit caster the unit that is considered to be the caster of the effect.
  • unit source the unit to treat as the effect source.
  • unit target the unit to target with the effect.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = "Standard MeleeUnit"
local x, y = 16, 16
local caster = DCEI.CreateUnitAsync(team_id, player_id, unit_type, x, y)
local source = DCEI.CreateUnitAsync(team_id, player_id, unit_type, x, y)
local target = DCEI.CreateUnitAsync(team_id, player_id, unit_type, x, y)
DCEI.CreateEffectAtUnit("Kill", caster, source, target)

void CreateEffect(string effectName, unit caster, float x, float z) {void-CreateEffectstring-effectName-unit-caster-float-x-float-z}

void CreateEffect(string effectName, unit caster, float x, float z)

Description

Creates an effect from a unit targeting a point.

Parameters

  • string effectName the name of the effect to create.
  • unit caster the unit that is considered to be the caster of the effect.
  • float x the x-axis coordinate to cast the ability at.
  • float z the z-axis coordinate to cast the ability at.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = "Standard MeleeUnit"
local x, y = 16, 16
local test_subject = DCEI.CreateUnitAsync(team_id, player_id, unit_type, x, y)
DCEI.CreateEffect("Kill", test_subject)

void CreateEffectAtPosition(string effectName, unit caster, float x, float z) {void-CreateEffectAtPositionstring-effectName-unit-caster-float-x-float-z}

void CreateEffectAtPosition(string effectName, unit caster, float x, float z)

Description

Creates an effect from a unit targeting a point.

Parameters

  • string effectName the name of the effect to create.
  • unit caster the unit that is considered to be the caster of the effect.
  • float x the x-axis coordinate to cast the ability at.
  • float z the z-axis coordinate to cast the ability at.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = "Standard MeleeUnit"
local x, y = 16, 16
local test_subject = DCEI.CreateUnitAsync(team_id, player_id, unit_type, x, y)
DCEI.CreateEffectAtPosition("Kill", test_subject)

double EvaluateEffectHookExpression(string name) {double-EvaluateEffectHookExpressionstring-name}

double EvaluateEffectHookExpression(string name)

Description

Added effect hook trigger APIs that let you customize effect data at runtime for each effect instance.

Parameters

  • string effectName the name of the effect which triggers the event.

Example Usage

DCEI.TriggerAddEffectHookEvent(
    DCEI.Effect("Standard RangedUnit Weapon Launch"),
    function(context)
        if DCEI.EvaluateEffectHookExpression("RandomChance 50%") ~= 0 then
            local field_path = {"launchMissile", "missileUnit"}
            local missile_unit = DCEI.GetUnitType(context.target)
            DCEI.SetEffectHookFieldValue(field_path, missile_unit)
        end
    end
)

object GetEffectHookFieldValue(String[] path) {object-GetEffectHookFieldValueString-path}

object GetEffectHookFieldValue(String[] path)

Description

Added effect hook trigger APIs that let you customize effect data at runtime for each effect instance.

Parameters

  • String[] paths the paths to retrive the field value from.

Example Usage

DCEI.TriggerAddEffectHookEvent(
    DCEI.Effect("Standard RangedUnit Weapon Launch"),
    function(context)
        if DCEI.EvaluateEffectHookExpression("RandomChance 50%") ~= 0 then
            local field_path = {"launchMissile", "missileUnit"}
            local missile_unit = DCEI.GetUnitType(context.target)
            DCEI.SetEffectHookFieldValue(field_path, missile_unit)
        end
    end
)

void SetEffectHookFieldValue(String[] path, object value) {void-SetEffectHookFieldValueString-path-object-value}

void SetEffectHookFieldValue(String[] path, object value)

Description

Added effect hook trigger APIs that let you customize effect data at runtime for each effect instance.

Parameters

  • String[] paths the paths to set the field value.
  • Object value the value to set.

Example Usage

DCEI.TriggerAddEffectHookEvent(
    DCEI.Effect("Standard RangedUnit Weapon Launch"),
    function(context)
        if DCEI.EvaluateEffectHookExpression("RandomChance 50%") ~= 0 then
            local field_path = {"launchMissile", "missileUnit"}
            local missile_unit = DCEI.GetUnitType(context.target)
            DCEI.SetEffectHookFieldValue(field_path, missile_unit)
        end
    end
)

⚠️ **GitHub.com Fallback** ⚠️