Trigger API Reference DCEI Events Ability0 - funovus/editor-wiki GitHub Wiki
Table of Contents
- [Trigger API Reference\DCEI Events\Ability](#trigger-api-referencedcei-eventsability)
* [void TriggerAddCastAbilityEvent(unit unit, TypedCallback trigger, bool simple, AbilityFilter filter)](#void-triggeraddcastabilityeventunit-unit-typedcallbackunit-float2-trigger-bool-simple-abilityfilter-filter)
* [void TriggerAddUseAbilityEvent(unit unit, TypedCallback trigger, bool simple, AbilityFilter filter)](#void-triggeradduseabilityeventunit-unit-typedcallbackunit-float2-trigger-bool-simple-abilityfilter-filter)
* [void TriggerAddActivateAbilityEvent(unit unit, TypedCallback trigger, bool simple, AbilityFilter filter)](#void-triggeraddactivateabilityeventunit-unit-typedcallback-trigger-bool-simple-abilityfilter-filter)
* [void TriggerAddUnitAbilityOnOffEvent(unit unit, TypedCallback trigger, bool simple, AbilityFilter filter)](#void-triggeraddunitabilityonoffeventunit-unit-typedcallbackbool-trigger-bool-simple-abilityfilter-filter)
* [void TriggerAddUnitAbilityOnEvent(unit unit, TypedCallback trigger, bool simple, AbilityFilter filter)](#void-triggeraddunitabilityoneventunit-unit-typedcallbackbool-trigger-bool-simple-abilityfilter-filter)
* [void TriggerAddUnitAbilityOffEvent(unit unit, TypedCallback trigger, bool simple, AbilityFilter filter)](#void-triggeraddunitabilityoffeventunit-unit-typedcallbackbool-trigger-bool-simple-abilityfilter-filter)
* [void TriggerAddDeactivateAbilityEvent(unit unit, TypedCallback trigger, bool simple, AbilityFilter filter)](#void-triggeradddeactivateabilityeventunit-unit-typedcallback-trigger-bool-simple-abilityfilter-filter)
|
Trigger API Reference\DCEI Events\Ability {Trigger-API-ReferenceDCEI-EventsAbility}
The order of phases for abilities and their corresponding events are as follows:
- Ability Starts (via trigger or button)
- Enter Target Mode (TriggerAddActivateAbilityEvent())
- Exit Target Mode (TriggerAddDeactivateAbilityEvent())
- Queued
- Prep Time Start
- Prep Time End
- Cast (TriggerAddCastAbilityEvent())
- Finish Time Start
- Finish Time End (TriggerAddUseAbilityEvent())
- Cooldown Start (TriggerAddUnitAbilityOnOffEvent())
- Cooldown End (TriggerAddUnitAbilityOnOffEvent())
void TriggerAddCastAbilityEvent(unit unit, TypedCallback<unit, Float2> trigger, bool simple, AbilityFilter filter) {void-TriggerAddCastAbilityEventunit-unit-TypedCallbackunit-Float2-trigger-bool-simple-AbilityFilter-filter}
void TriggerAddCastAbilityEvent(unit unit, TypedCallback<unit, Float2> trigger, bool simple, AbilityFilter filter)
This event triggers when an ability has completed its cast. This function can also pass the target unit and target location as parameters to the callback function (if target is only a location, target unit will return nil). You can also set up an Ability Filter to make this only trigger for certain ability.
-
unit
unit
the unit that triggers this event. Use DCEI.UnitAny to trigger this event when any unit uses an ability. -
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(). -
AbilityFilter
filter
this filter allows you to only trigger this event on certain abilities
-
Unit
target_unit
-
Float2
target_position
function OnAbilityCast(target_unit, target_pos)
local unit = DCEI.TriggeringUnit
local unit_name = DCEI.UnitName(unit)
local ability_name = DCEI.TriggeringAbilityName
DCEI.LogMessage(unit_name .. " casts " .. ability_name)
local target_name = DCEI.UnitName(target_unit)
DCEI.LogMessage("Target: " .. target_name .. " at (" .. target_pos.x .. ", " .. target_pos.y .. ")")
end
DCEI.TriggerAddCastAbilityEvent(DCEI.UnitAny, OnAbilityCast, true)
void TriggerAddUseAbilityEvent(unit unit, TypedCallback<unit, Float2> trigger, bool simple, AbilityFilter filter) {void-TriggerAddUseAbilityEventunit-unit-TypedCallbackunit-Float2-trigger-bool-simple-AbilityFilter-filter}
void TriggerAddUseAbilityEvent(unit unit, TypedCallback<unit, Float2> trigger, bool simple, AbilityFilter filter)
This event triggers when an ability exits the finish phase. This function can also pass the target unit and target location as parameters to the callback function (if target is only a location, target unit will return nil). You can also set up an Ability Filter to make this only trigger for certain ability.
-
unit
unit
the unit that triggers this event. Use DCEI.UnitAny to trigger this event when any unit uses an ability. -
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(). -
AbilityFilter
filter
this filter allows you to only trigger this event on certain abilities
-
Unit
target_unit
-
Float2
target_position
function OnAbilityCast(target_unit, target_pos)
local unit = DCEI.TriggeringUnit
local unit_name = DCEI.UnitName(unit)
local ability_name = DCEI.TriggeringAbilityName
DCEI.LogMessage(unit_name .. " casts " .. ability_name)
local target_name = DCEI.UnitName(target_unit)
DCEI.LogMessage("Target: " .. target_name .. " at (" .. target_pos.x .. ", " .. target_pos.y .. ")")
end
DCEI.TriggerAddUseAbilityEvent(DCEI.UnitAny, OnAbilityCast, true)
void TriggerAddActivateAbilityEvent(unit unit, TypedCallback trigger, bool simple, AbilityFilter filter) {void-TriggerAddActivateAbilityEventunit-unit-TypedCallback-trigger-bool-simple-AbilityFilter-filter}
void TriggerAddActivateAbilityEvent(unit unit, TypedCallback trigger, bool simple, AbilityFilter filter)
This event triggers when an ability activates. You can also set up an Ability Filter to make this only trigger for certain ability.
-
unit
unit
the unit that triggers this event. Use DCEI.UnitAny to trigger this event when any unit uses an ability. -
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(). -
AbilityFilter
filter
this filter allows you to only trigger this event on certain abilities
function OnAbilityActivate()
local ability_name = DCEI.TriggeringAbilityName
DCEI.LogMessage("Ability " .. ability_name .. "activated!")
end
DCEI.TriggerAddActivateAbilityEvent(DCEI.UnitAny, OnAbilityActivate, true)
void TriggerAddUnitAbilityOnOffEvent(unit unit, TypedCallback<bool> trigger, bool simple, AbilityFilter filter) {void-TriggerAddUnitAbilityOnOffEventunit-unit-TypedCallbackbool-trigger-bool-simple-AbilityFilter-filter}
void TriggerAddUnitAbilityOnOffEvent(unit unit, TypedCallback<bool> trigger, bool simple, AbilityFilter filter)
This event triggers when an ability goes on or off cooldown. For abilities with charges, the event will only trigger when the charge count decreases to 0 or increases to at least 1.
The first parameter of the callback function is a boolean that indicates whether the ability has become available (true) or unavailable (false).
-
unit
unit
the unit that triggers this event. Use DCEI.UnitAny to trigger this event when any unit uses an ability. -
object
trigger
the callback function that is run when the event is triggered. This first parameter of this function will returntrue
when the ability goes off cooldown andfalse
when the ability enters cooldown. -
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(). -
AbilityFilter
filter
this filter allows you to only trigger this event on certain abilities
-
Boolean
is_on
function OnAbilityOnOff(is_ready)
local unit = DCEI.TriggeringUnit
local unit_name = DCEI.UnitName(unit)
local ability_name = DCEI.TriggeringAbilityName
local state = is_ready and "on" or "off"
DCEI.LogMessage(ability_name .. " is now ".. state .. " for " .. unit_name)
end
DCEI.TriggerAddUnitAbilityOnOffEvent(DCEI.UnitAny, OnAbilityOnOff, true)
void TriggerAddUnitAbilityOnEvent(unit unit, TypedCallback<bool> trigger, bool simple, AbilityFilter filter) {void-TriggerAddUnitAbilityOnEventunit-unit-TypedCallbackbool-trigger-bool-simple-AbilityFilter-filter}
void TriggerAddUnitAbilityOnEvent(unit unit, TypedCallback<bool> trigger, bool simple, AbilityFilter filter)
This event triggers when an ability goes on cooldown.
-
unit
unit
the unit that triggers this event. Use DCEI.UnitAny to trigger this event when any unit uses an ability. -
object
trigger
the callback function that is run when the event is triggered. This first parameter of this function will returntrue
when the ability goes off cooldown andfalse
when the ability enters cooldown. -
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(). -
AbilityFilter
filter
this filter allows you to only trigger this event on certain abilities
function OnAbilityOn()
local unit = DCEI.TriggeringUnit
local unit_name = DCEI.UnitName(unit)
local ability_name = DCEI.TriggeringAbilityName
DCEI.LogMessage(ability_name .. " is now on for " .. unit_name)
end
DCEI.TriggerAddUnitAbilityOnEvent(DCEI.UnitAny, OnAbilityOn, true)
void TriggerAddUnitAbilityOffEvent(unit unit, TypedCallback<bool> trigger, bool simple, AbilityFilter filter) {void-TriggerAddUnitAbilityOffEventunit-unit-TypedCallbackbool-trigger-bool-simple-AbilityFilter-filter}
void TriggerAddUnitAbilityOffEvent(unit unit, TypedCallback<bool> trigger, bool simple, AbilityFilter filter)
This event triggers when an ability goes off cooldown.
-
unit
unit
the unit that triggers this event. Use DCEI.UnitAny to trigger this event when any unit uses an ability. -
object
trigger
the callback function that is run when the event is triggered. This first parameter of this function will returntrue
when the ability goes off cooldown andfalse
when the ability enters cooldown. -
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(). -
AbilityFilter
filter
this filter allows you to only trigger this event on certain abilities
function OnAbilityOnOff()
local unit = DCEI.TriggeringUnit
local unit_name = DCEI.UnitName(unit)
local ability_name = DCEI.TriggeringAbilityName
DCEI.LogMessage(ability_name .. " is now off for " .. unit_name)
end
DCEI.TriggerAddUnitAbilityOffEvent(DCEI.UnitAny, OnAbilityOnOff, true)
void TriggerAddDeactivateAbilityEvent(unit unit, TypedCallback trigger, bool simple, AbilityFilter filter) {void-TriggerAddDeactivateAbilityEventunit-unit-TypedCallback-trigger-bool-simple-AbilityFilter-filter}
void TriggerAddDeactivateAbilityEvent(unit unit, TypedCallback trigger, bool simple, AbilityFilter filter)
This event triggers when an ability exits targeting mode for the unit.
Note: This is event is triggered regardless of method by which the targeting mode was exited, whether it was canceled or a target was set.
-
unit
unit
the unit that triggers this event. Use DCEI.UnitAny to trigger this event when any unit uses an ability. -
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(). -
AbilityFilter
filter
this filter allows you to only trigger this event on certain abilities
function OnAbilityDeactivate()
local unit = DCEI.TriggeringUnit
local unit_name = DCEI.UnitName(unit)
local ability_name = DCEI.TriggeringAbilityName
DCEI.LogMessage(unit_name .. " has exited the targeting mode for " .. ability_name)
end
DCEI.TriggerAddDeactivateAbilityEvent(DCEI.UnitAny, OnAbilityDeactivate, true)