Trigger API Reference DCEI Events Effect0 - funovus/editor-wiki GitHub Wiki
Table of Contents
- [Trigger API Reference\DCEI Events\Effect](#trigger-api-referencedcei-eventseffect)
* [void TriggerAddEffectEvent(string effectName, TypedCallback trigger, bool simple)](#void-triggeraddeffecteventstring-effectname-typedcallbackeffectcontext-trigger-bool-simple)
* [void TriggerAddEffectHookEvent(string effectName, TypedCallback trigger, bool simple)](#void-triggeraddeffecthookeventstring-effectname-typedcallbackeffectcontext-trigger-bool-simple)
|
Trigger API Reference\DCEI Events\Effect {Trigger-API-ReferenceDCEI-EventsEffect}
void TriggerAddEffectEvent(string effectName, TypedCallback<EffectContext> trigger, bool simple) {void-TriggerAddEffectEventstring-effectName-TypedCallbackEffectContext-trigger-bool-simple}
void TriggerAddEffectEvent(string effectName, TypedCallback<EffectContext> trigger, bool simple)
This event is triggered when an effect occurs. Use TriggeringEffectName and TriggeringEffectContext to get the name and context of the effect. This function can also pass the effect context as a parameter to the callback function.
-
string
effectName
the name of the effect which triggers the event. -
object
trigger
the callback function that is run when the event is triggered. -
bool
simple
this flag reduces overhead by preventing the usage of DCEI.Wait() within the trigger. You should only set this to true if the trigger does not use DCEI.Wait().
-
EffectContext
effect_context
function OnDoNothing(effect_context)
local context = DCEI.TriggeringEffectContext
local caster_name = DCEI.UnitName(context.caster)
local source_name = DCEI.UnitName(context.source)
local target_name = DCEI.UnitName(context.target)
DCEI.LogMessage(caster_name .. " did nothing to " .. target_name .. " via " .. source_name .. ".")
end
DCEI.TriggerAddEffectEvent("DoNothing", OnDoNothing, true)
void TriggerAddEffectHookEvent(string effectName, TypedCallback<EffectContext> trigger, bool simple) {void-TriggerAddEffectHookEventstring-effectName-TypedCallbackEffectContext-trigger-bool-simple}
void TriggerAddEffectHookEvent(string effectName, TypedCallback<EffectContext> trigger, bool simple)
Added effect hook trigger APIs that let you customize effect data at runtime for each effect instance.
-
string
effectName
the name of the effect which triggers the event. -
object
trigger
the callback function that is run when the event is triggered. -
bool
simple
this flag reduces overhead by preventing the usage of DCEI.Wait() within the trigger. You should only set this to true
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
)