Trigger API Reference\DCEI Functions\Effect
string GetEffectType(string 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(DCEI.Effect("DoNothing"))
DCEI.LogMessage(effect_type)
void CreateEffectAtSelf(string effectName, unit target)
void CreateEffectAtSelf(string effectName, unit target)
Description
Creates an effect targeting a unit. The unit is also the source and caster.
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 = DCEI.Unit("Standard MeleeUnit")
local x, y = 16, 16
local test_subject = DCEI.CreateUnit(team_id, player_id, unit_type, x, y)
local kill_effect = DCEI.Effect("Kill")
DCEI.CreateEffectAtSelf(kill_effect, test_subject)
void CreateEffectAtUnit(string effectName, unit target, unit caster, unit source = default)
void CreateEffectAtUnit(string effectName, unit target, unit caster, unit source = default)
Description
Creates an effect targeting a unit that includes separate caster and source units.
Parameters
- string
effectName
the name of the effect to create. - unit
target
the unit to target with the effect. - unit
caster
the unit which casts the effect. - unit
source
the unit which is the source of the effect. Default value is the caster unit.
Example Usage
local team_id = 1
local player_id = 1
local unit_type = DCEI.Unit("Standard MeleeUnit")
local x, y = 16, 16
local target = DCEI.CreateUnit(team_id, player_id, unit_type, x, y)
local caster = DCEI.CreateUnit(team_id, player_id, unit_type, x, y)
local kill_effect = DCEI.Effect("Kill")
DCEI.CreateEffectAtUnit(kill_effect, target, caster)
void CreateEffectAtPosition(string 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 = DCEI.Unit("Standard MeleeUnit"))
local x, y = 16, 16
local test_subject = DCEI.CreateUnit(team_id, player_id, unit_type, x, y)
DCEI.CreateEffectAtPosition(DCEI.Effect("Kill"), test_subject)
double EvaluateEffectHookExpression(string 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
name
the name of the expression to evaluate
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 GetEffectHookFieldValue(String[] path)
Description
Added effect hook trigger APIs that let you customize effect data at runtime for each effect instance.
Parameters
- String[]
path
field path for the value to get.
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 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[]
path
field path for the value to set. - 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
)