Trigger API Reference\DCEI Types

YogaFlexDirection

Enum YogaFlexDirection

Enum Structure

Column
ColumnReverse
Row
RowReverse

Description


Used for the flex frame property FlexDirection, see:

Example Usage


XML "FlexLayout":

<Frame layout="flex">
    <Frame frameImageColor="#ff0000ff" width="50" height="50" />
    <Frame frameImageColor="#00ff00ff" width="50" height="50" />
</Frame>

Lua:

local GMUI = require("GMUI")

local function TestFlexProperty()
    local NewFlexLayout = GMUI.Layout.New({ name = "FlexLayout" })
    DCEI.SetFrameFlexDirection(NewFlexLayout.Frame, "column")
end

TestFlexProperty()

YogaWrap

Enum YogaWrap

Enum Structure

NoWrap
Wrap
WrapReverse

Description


Used for the flex frame property FlexDirection, see:

Example Usage


XML "FlexLayout":

<Frame layout="flex" width="200" >
    <Frame id="child1" frameImageColor="#ff0000ff" widthPercent="100" height="50" />
    <Frame id="child2" frameImageColor="#00ff00ff" widthPercent="100" height="50" />
</Frame>

Lua:

local GMUI = require("GMUI")

local function TestFlexProperty()
    local NewFlexLayout = GMUI.Layout.New({ name = "FlexLayout" })
    DCEI.SetFrameFlexWrap(NewFlexLayout.Frame, "wrap")
end

TestFlexProperty()

YogaJustify

Enum YogaJustify

Enum Structure

FlexStart
Center
FlexEnd
SpaceBetween
SpaceAround

Description


This defines the alignment along the main axis. For more info (including visualizations of each property) see justifyContent XML attribute.. See also DCEI.SetFrameJustifyContent.

Example Usage


XML "FlexLayout":

<Frame layout="flex" width="200">
    <Frame id="child1" frameImageColor="#ff0000ff" width="50" height="50" />
    <Frame id="child2" frameImageColor="#00ff00ff" width="50" height="50" />
</Frame>

Lua:

local GMUI = require("GMUI")

local function TestFlexProperty()
    local NewFlexLayout = GMUI.Layout.New({ name = "FlexLayout" })
    DCEI.SetFrameJustifyContent(NewFlexLayout.Frame, "space-between")
end

TestFlexProperty()

YogaAlign

Enum YogaAlign

Enum Structure

Auto
FlexStart
Center
FlexEnd
Stretch
Baseline
SpaceBetween
SpaceAround

Description


This defines the default behavior for how flex items are laid out along the cross axis on the current line. Think of it as the justify-content version for the cross-axis (perpendicular to the main-axis).

For more info (including visualizations of each property) see alignItems XML attribute.

Example Usage

<Frame layout="flex" width="200">
    <Frame id="child1" frameImageColor="#ff0000ff" width="50" height="150" />
    <Frame id="child2" frameImageColor="#00ff00ff" width="50" height="50" />
</Frame>

Lua:

local GMUI = require("GMUI")

local function TestFlexProperty()
    local NewFlexLayout = GMUI.Layout.New({ name = "FlexLayout" })
    DCEI.SetFrameAlignItems(NewFlexLayout.Frame, "center")
end

TestFlexProperty()

YogaPositionType

Enum YogaPositionType

Enum Structure

Relative
Absolute

Description


Position Relative or Absolute.

Relative By default an element is positioned relatively. This means an element is positioned according to the normal flow of the layout, and then offset relative to that position based on the values of top, right, bottom, and left. The offset does not affect the position of any sibling or parent elements.

Absolute When positioned absolutely an element doesn't take part in the normal layout flow. It is instead laid out independent of its siblings. The position is determined based on the top, right, bottom, and left values.

For more info see position XML attribute.

Example Usage

<Frame layout="flex" width="200" height="200" flexWrap="wrap">
    <Frame id="child1" frameImageColor="#ff0000ff" widthPercent="50" height="55" />
    <Frame id="child2" frameImageColor="#00ff00ff" widthPercent="50" height="55" />
</Frame>

Lua:

local GMUI = require("GMUI")

local function TestFlexProperty()
    local NewFlexLayout = GMUI.Layout.New({ name = "FlexLayout" })
    DCEI.SetFramePosition(NewFlexLayout.child1, "Absolute")
    DCEI.SetFrameLeft(NewFlexLayout.child1, 150)
end

TestFlexProperty()

FullScreenMode

Enum FullScreenMode

Enum Structure

ExclusiveFullScreen
FullScreenWindow
MaximizedWindow
Windowed

Description


ExclusiveFullScreen
An exclusive full-screen mode where the application takes complete control of the screen, hiding other windows and overlays. Stretches the screen if the resolution does not fit.

FullScreenWindow
A windowed version of the FullScreen mode. If the resolution is too small and the ratio doesn't match the screen, it creates black borders.

MaximizedWindow
Emulates the FullScreen mode by stretching the window borders to fit the entire screen. Functionally similar to FullScreenWindow.

Windowed
Starts the game in its own window.

Example Usage

DCEI.SetResolution(1000, 500, "Windowed")
-- Logs after a timer so the game has time to update.
DCEI.TriggerAddTimerEventElapsed(function()
    local resolution = DCEI.GetCurrentResolution()
    DCEI.LogMessage("Width: " .. resolution.width)
    DCEI.LogMessage("Height: " .. resolution.height)
    DCEI.LogMessage("Mode: " .. resolution.mode)
end, 0)

SetResolution
GetCurrentResolution

UnitBehaviorStatus

Type UnitBehaviorStatus

Type Structure

UnitBehaviorStatus
{
string name
int stack_count
}

Description


Unit's behavior stats, including behavior name and stack count.

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 behavior_name = DCEI.Behavior("Damage Taken Half")

DCEI.ApplyBehaviorToSelf(test_subject, behavior_name, 2)

local stacks = DCEI.GetUnitBehaviorStackCount(test_subject, behavior_name)

DCEI.LogMessage(unit_type .. " has " .. stacks .. " stacks of " .. behavior_name)

BehaviorFilter

Type BehaviorFilter

Type Structure

BehaviorFilter
{
string name
string family
}

Description


Behavior Filters allow you to create a filter for trigger events such as TriggerAddBehaviorStackIncreaseEvent that make the event only fire for specific behavior type instead of all behaviors. See Using Trigger Event Filters

Example Usage

-- Create unit
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 behavior_name = DCEI.Behavior("Damage Taken Half")

function OnUnitBehaviorAdd(effect_context)
    local name = DCEI.TriggeringBehaviorName
    local u = DCEI.TriggeringUnit
    local unit_type = DCEI.GetUnitType(u)
    local stacks = DCEI.GetUnitBehaviorStackCount(u, name)
    DCEI.LogMessage(unit_type .. " had " .. name .. " added for a total of " .. stacks .. " stacks.")
end

local behavior_filter = { name = behavior_name }
DCEI.TriggerAddBehaviorAddEvent(DCEI.CreateUnitFilter({name = DCEI.Unit("Test Unit")}), OnUnitBehaviorAdd, true, behavior_filter)

DCEI.ApplyBehaviorToSelf(test_subject, behavior_name, 2)

AbilityFilter

Type AbilityFilter

Type Structure

AbilityFilter
{
string name
string family
}

Description


Ability Filters allow you to create a filter for trigger events such as TriggerAddCastAbilityEvent that make the event only fire for specific a specific ability type instead of all abilities. See Using Trigger Event Filters

Example Usage

function OnAbilityCast(target_unit, target_pos)
    local unit = DCEI.TriggeringUnit
    local unit_name = DCEI.GetUnitType(unit)
    local ability_name = DCEI.TriggeringAbilityName
    DCEI.LogMessage(unit_name .. " casts " .. ability_name)

    local target_name = DCEI.GetUnitType(target_unit)
    DCEI.LogMessage("Target: " .. target_name .. " at (" .. target_pos.x .. ", " .. target_pos.y .. ")")
end

local ability_filter = { name = "Ability Fireball" }
DCEI.TriggerAddUseAbilityEvent(DCEI.CreateUnitFilter({name = DCEI.Unit("Test Unit")}), OnAbilityCast, true, ability_filter)

WeaponFilter

Type WeaponFilter

Type Structure

WeaponFilter
{
string name
string family
}

Description


Weapon Filters allow you to create a filter for trigger events such as TriggerAddUseWeaponEvent that make the event only fire for specific a specific weapon type instead of all weapons. See Using Trigger Event Filters

Example Usage

local function OnUnitUseWeapon(target_unit, target_pos)
    local unit = DCEI.TriggeringUnit
    local unit_name = DCEI.GetUnitType(unit)
    local weapon = DCEI.TriggeringWeaponName
    DCEI.LogMessage(unit_name .. " has attacked with " .. weapon ..".")

    local target_name = DCEI.GetUnitType(target_unit)
    DCEI.LogMessage("Target: " .. target_name .. " at (" .. target_pos.x .. ", " .. target_pos.y .. ")")
end

local weapon_filter = { name = "Weapon Bow" }
DCEI.TriggerAddUseWeaponEvent(DCEI.CreateUnitFilter({name = DCEI.Unit("Test Unit")}), OnUnitUseWeapon, true, weapon_filter)

CriticalFilter

Type CriticalFilter

Type Structure

CriticalFilter
{
bool critical_only
bool not_critical_only
}

Description


Used to make events like TriggerAddUnitDamageEvent trigger with only critical or not critical damage events. See Using Trigger Event Filters

Example Usage

local function OnUnitDamaged(damage, target_unit)
    DCEI.ShowSimpleDamageNumber(target_unit, 1, damage)
end

DCEI.TriggerAddUnitDamageEvent(DCEI.CreateUnitFilter({name = DCEI.Unit("Test Unit")}), OnUnitDamaged, {critical_only = true})

UnitTagStatus

Type UnitTagStatus

Type Structure

UnitTagStatus
{
string name
int stack_count
}

Description


Tag status on unit, with name and stack count.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = DCEI.Unit("Standard MeleeUnit")
local x, y = 16, 16
local unit = DCEI.CreateUnit(team_id, player_id, unit_type, x, y)
local tag = DCEI.Tag("Banana")

DCEI.ApplyTag(unit, tag, -1, 5)
local tag_count = DCEI.GetUnitTagCount(unit, tag)
DCEI.LogMessage(tag_count)


DCEI.RemoveTag(unit, tag, 2)
tag_count = DCEI.GetUnitTagCount(unit, tag)
DCEI.LogMessage(tag_count)

Float2

Type Float2

Type Structure

Float2
{
float x
float y
}

Description


Usually use for Position 2D.

Example Usage

local pos = {x = 1, y = 1}
DCEI.SetUnitPosition2D(unit, pos.x, pos.y)

AbilityCost

Type AbilityCost

Type Structure

AbilityCost
{
float health
float mana
float gold
}

Description


Ability cost table.

Example Usage

function OnAbilityUse()
    local id = DCEI.TriggeringAbilityId
    local name = DCEI.TriggeringAbilityName
    DCEI.LogMessage(name .. " use")
    local cost = DCEI.GetAbilityCost(name)
    for key, value in pairs(cost) do
        DCEI.LogMessage(key .. " : " .. value)
    end
end

DCEI.TriggerAddUseAbilityEvent(DCEI.CreateUnitFilter({name = DCEI.Unit("Test Unit")}), OnAbilityUse)

GetAbilityCost

BehaviorModifier

Type BehaviorModifier

Type Structure

BehaviorModifier
{
float scaled
float unscaled
float additive_factor
float positive_unified_factor
float negative_unified_factor
float multiplier_factor
}

Description


Works in the same way as BehaviorModifier in behavior data.

Example Usage

local example_value = DCEI.ApplyModifier(
    {
        scaled = 5,
        unscaled = 0,
        additive_factor = 1,
        positive_unified_factor = 1,
        negative_unified_factor = 0,
        multiplier_factor = 1,
    },
    5
)
DCEI.LogMessage(example_value)

ApplyModifier

Damage

Type Damage

Type Structure

Damage
{
float damage_value
int style_index
int damage_type
float critical_damage_chance
float critical_damage_multiplier
int critical_damage_style_index
string stats_name
float duration_seconds
}

Description


Used for simple unit damage affinity.

Example Usage

In-develepment API
No example use yet

Float3

Type Float3

Type Structure

Float3
{
float x
float y
float z
}

Description


Can be used as Position 3D or Scale 3D.

Example Usage

local duration = 1
local ease = "Linear"
local k1 = {x = min_scale, y = min_scale, z = min_scale}
local k2 = {x = max_scale, y = max_scale, z = max_scale}
local anim = DCEI.AnimateFrameScale(layout.Frame, k1, k2, duration, ease)

EffectContext

Type EffectContext

Type Structure

EffectContext
{
unit caster
unit source
unit target
Float2 target_location
string damage_source_type
string damage_source_name
float return_value
}

Description


Get effect's context.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = DCEI.Unit("Standard MeleeUnit")
local x, y = 16, 17
local test_subject = DCEI.CreateUnit(team_id, player_id, unit_type, x, y)
local behavior_name = DCEI.Behavior("Damage Taken Half")

local function OnUnitBehaviorAdd(effect_context)
    DCEI.LogMessage(
        "target location x: "
            .. effect_context.target_location.x
            .. " target location y: "
            .. effect_context.target_location.y
    )
end

DCEI.TriggerAddBehaviorAddEvent(DCEI.CreateUnitFilter({name = DCEI.Unit("Test Unit")}), OnUnitBehaviorAdd, true)
DCEI.ApplyBehaviorToSelf(test_subject, behavior_name, 2)

UnitLabelOptions

Type UnitLabelOptions

Type Structure

UnitLabelOptions
{
Offset offset
bool center_at_unit_origin
bool center_at_unit_top
}

Description


Built in unit label option table.

Example Usage

local label_options = {offset = {right = 1, up = 1, front = 1}, center_at_unit_origin = true, center_at_unit_top = true}
DCEI.ShowUnitLabel(unit, "Unit", label_options)

ShowUnitLabel
HideUnitLabel

Offset

Type Offset

Type Structure

Offset
{
double right
double up
double front
}

Description


Helper table in some API for offset

Example Usage

local frame = DCEI.CreateTextFrame(DCEI.GetUiRootFrame())
DCEI.SetTextFrameText(frame, "Bob")

local unit = DCEI.CreateUnit(1, 1, DCEI.Unit("Standard MeleeUnit"), 16, 16, 0, -1)

local options = {
    offset = {up = 1.2},
    center_at_unit_origin = true
}

DCEI.AttachFrameToUnit(frame, unit, options)

AttachFrameToUnit

TextOptions

Type TextOptions

Type Structure

TextOptions
{
Offset offset
}

Description


Text option.

Example Usage

local float_text_pos = { x = 20, y = 2, z = 20 }
local text_options = { offset = { right = 1, up = 10, front = 10 } }
DCEI.ShowFloatingText(float_text_pos, "Floating Text", 5, 1, 5, text_options)

ExplicitOffset

Type ExplicitOffset

Type Structure

ExplicitOffset
{
double right
double up
double forward
}

Description


Offset is based on forward/right/up directions.

Example Usage

local parent_unit = DCEI.FindUnit("Ship")
local child_unit = DCEI.FindUnit("Archer")
DCEI.AttachUnit(
    child_unit,
    parent_unit,
    { explicit_offset = { forward = 3 }, use_child_facing = true, orientation_type = "WorldOrientation" }
)

PolarOffset

Type PolarOffset

Type Structure

PolarOffset
{
double yaw
double pitch
double distance
}

Description


Offset is based on angle and distance.

Example Usage

local parent_unit = DCEI.FindUnit("Ship")
local child_unit = DCEI.FindUnit("Archer")
DCEI.AttachUnit(
    child_unit,
    parent_unit,
    { polar_offset = { yaw = 3, distance = 2 }, use_child_facing = true, orientation_type = "WorldOrientation" }
)

ControllerMapEntry

Type ControllerMapEntry

Type Structure

ControllerMapEntry
{
ElementAssignmentEntry[] assignments
    ElementAssignmentEntry
    {
int key_id
int action_id
    }

}

Description

Example Usage

AttachOffsetOptions

Type AttachOffsetOptions

Type Structure

AttachOffsetOptions
{
ExplicitOffset explicit_offset
PolarOffset polar_offset
bool use_current_offset
bool use_child_facing
OrientationType orientation_type
}

Description


Options to customize how units attach.

Example Usage

local parent_unit = DCEI.FindUnit("Ship")
local child_unit = DCEI.FindUnit("Archer")
DCEI.AttachUnit(
    child_unit,
    parent_unit,
    { explicit_offset = { forward = 3 }, use_child_facing = true, orientation_type = "WorldOrientation" }
)


orientation_type:

ColorRGBA

Type ColorRGBA

Type Structure

ColorRGBA
{
float r
float g
float b
Nullable<float> a
}

Description


Color table. Notice the float is 0~1 instead of 0~255. APIs using this parameter also accept hex codes, such as "#32a852"

Example Usage

local frame = DCEI.CreateFrame(DCEI.GetUiRootFrame())
DCEI.SetFrameImageColor(frame, {r = 251/255, g = 79/255, b = 79/255, a = 1})
DCEI.SetFrameImageColor(frame, "#32a852") -- This also works
DCEI.SetFrameSize(frame, 100, 100)

ColorRGB

Type ColorRGB

Type Structure

ColorRGB
{
float r
float g
float b
}

Description


Color table. Notice the float is 0~1 instead of 0~255. Also accepts hex values such as "#32a852"

Example Usage

DCEI.SetTextFrameColorRGB(text_frame, { r = 0.5, g = 0.5, b = 0.5 })
DCEI.SetTextFrameColorRGB(text_frame, "#32a852") -- Also works

JoystickOptions

Type JoystickOptions

Type Structure

JoystickOptions
{
Float2 anchor
Float2 offset
bool disable_wasd
bool disable_arrow_keys
int joystick_id
bool dynamic_position
bool always_show
float radius
AreaOffset active_area_offset
string handle_icon
ColorRGBA handle_icon_color
string background_icon
ColorRGBA background_icon_color
bool handle_rotation
InGameUILayoutComponent parent
JoystickOptions Default
}

Description


All the joystick options for virtual joystick.

Example Usage

local unit = DCEI.CreateUnit(1, 1, "Standard MeleeUnit", 15, 15)

local function OnJoystickMove()
    local axes = DCEI.TriggeringJoystickAxes
    DCEI.DirectionalMove(unit, axes.x, axes.y)
end

local function CreateJoystick()
    local frame = DCEI.CreateFrame(DCEI.GetUiRootFrame())

    DCEI.SetFrameWidth(frame, 1500)
    DCEI.SetFrameHeight(frame, 1500)

    local joystick_options = {
        anchor = { x = 0, y = 0 },
        offset = { x = 0, y = 0 },
        disable_wasd = true,
        disable_arrow_keys = true,
        joystick_id = 1,
        dynamic_position = true,
        always_show = true,
        radius = 150,
        active_area_offset = {
            left = 500,
            right = 50,
            top = 500,
            bottom = 50,
            debug_draw_color = { r = 0, g = 1, b = 0, a = 0.5 },
        },
        handle_icon = DCEI.Texture("icon_arrow"),
        handle_icon_color = { r = 1, g = 0, b = 0, a = 0.5 },
        background_icon = DCEI.Texture("general_icon_wildsky_mall_light_circle"),
        background_icon_color = { r = 1, g = 0, b = 0, a = 0.5 },
        handle_rotation = true,
        parent = frame,
    }

    DCEI.TriggerAddJoystickEventWithJoystickOptions(OnJoystickMove, joystick_options)
end

CreateJoystick()

JoystickButtonOptions

Type JoystickButtonOptions

Type Structure

JoystickButtonOptions
{
string icon
bool hide
}

Description


All the joystick button options for virtual joystick.

Example Usage

function OnJoystickButton()
    local button_id = DCEI.TriggeringJoystickButtonId
    local button_event = DCEI.TriggeringJoystickButtonEventType

    -- button event 0 is for ButtonDown, event 1 is for ButtonUp
    if button_id == 0 and button_event == 0 then
        -- currently does not support targeted abilities
        -- movement commands will interrupt ability prep time / finish time, unless ability has "can cast while moving" flag checked
        DCEI.CastAbility(HERO_SLASH, HERO, HERO)
    end
end

DCEI.TriggerAddJoystickButtonEvent(0, OnJoystickButton, { icon = DCEI.Texture("icon_ingame_towerslot_barracks") })

BigHeadMessageOptions

Type BigHeadMessageOptions

Type Structure

BigHeadMessageOptions
{
bool pause
object on_dismiss
double delay
Color message_box_color
Color title_box_color
}

Description


Big head message options

Example Usage

local title = "Title"
local message = "Message"
local image = "bighead_hero_smith"
local big_head_options = {
    pause = true,
    on_dismiss = function()
        DCEI.LogMessage("Dismissed")
    end,
    delay = 5,
    message_box_color = { r = 255, g = 0, b = 255, a = 255 },
    title_box_color = { r = 255, g = 0, b = 255, a = 255 },
}
DCEI.ShowBigHeadMessage(title, message, image, big_head_options)

SetModelScaleActorAction

Type SetModelScaleActorAction

Type Structure

SetModelScaleActorAction
{
string actor
float model_scale
float duration
Ease ease
float ease_intensity
}

Description


A table of arguments for a model scale actor action.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = DCEI.Unit("Standard MeleeUnit")
local x, z = 16, 16
local target = DCEI.CreateUnit(team_id, player_id, unit_type, x, z)
local action = {
  actor = "",
  model_scale = 2.0,
  duration = 1.0,
  ease = "InBounce",
  ease_intensity = 1.0,
}

DCEI.SendSetModelScaleActorAction(target, action)

CreateActorAction

Type CreateActorAction

Type Structure

CreateActorAction
{
string actor
string host_site
List<string> host_site_operations
List<string> aliases
bool detached
}

Description


A table of arguments for a create actor actor action.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = DCEI.Unit("Standard MeleeUnit")
local x, z = 16, 16
local target = DCEI.CreateUnit(team_id, player_id, unit_type, x, z)
local action = {
  actor = "Test Model",
  host_site = {"SiteWeaponLeft"},
  host_site_operations = {"SOp Up Dot 1", "SOp Left Dot 5"},
  aliases = {},
  detached = false,
}

DCEI.SendCreateActorAction(target, action)

DestroyActorAction

Type DestroyActorAction

Type Structure

DestroyActorAction
{
string actor
}

Description


A table of arguments for a destroy actor actor action.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = DCEI.Unit("Standard MeleeUnit")
local x, z = 16, 16
local target = DCEI.CreateUnit(team_id, player_id, unit_type, x, z)
local action = {
  actor = "Test Model",
}

DCEI.SendDestroyActorAction(target, action)

SendCustomEventActorAction

Type SendCustomEventActorAction

Type Structure

SendCustomEventActorAction
{
string actor
string identifier
}

Description


A table of arguments for a send custom event actor action.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = DCEI.Unit("Standard MeleeUnit")
local x, z = 16, 16
local target = DCEI.CreateUnit(team_id, player_id, unit_type, x, z)
local action = {
  actor = "",
  identifier = "test_custom_event",
}

DCEI.SendSendCustomEventActorAction(target, action)

PlayAnimationActorAction

Type PlayAnimationActorAction

Type Structure

PlayAnimationActorAction
{
string clip_id
double duration
bool use_real_timer
}

Description


A table of arguments for a play animation actor action.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = DCEI.Unit("Standard MeleeUnit")
local x, z = 16, 16
local target = DCEI.CreateUnit(team_id, player_id, unit_type, x, z)
local action = {
  clip_id = "action",
  duration = 0.56,
  use_real_timer = false,
}

DCEI.SendPlayAnimationActorAction(target, action)

PauseAnimationActorAction

Type PauseAnimationActorAction

Type Structure

PauseAnimationActorAction
{
string clip_id
}

Description


A table of arguments for a pause animation actor action.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = DCEI.Unit("Standard MeleeUnit")
local x, z = 16, 16
local target = DCEI.CreateUnit(team_id, player_id, unit_type, x, z)
local action = {
  clip_id = "action",
}

DCEI.SendPauseAnimationActorAction(target, action)

SetVisibilityActorAction

Type SetVisibilityActorAction

Type Structure

SetVisibilityActorAction
{
string actor
bool visibility
}

Description


A table of arguments for a set visibility actor action.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = DCEI.Unit("Standard MeleeUnit")
local x, z = 16, 16
local target = DCEI.CreateUnit(team_id, player_id, unit_type, x, z)
local action = {
  actor = "",
  visibility = false,
}

DCEI.SendSetVisibilityActorAction(target, action)

SetTintColorActorAction

Type SetTintColorActorAction

Type Structure

SetTintColorActorAction
{
string actor
ColorRGBA color
float duration
Ease ease
float ease_intensity
}

Description


A table of arguments for a set tint color actor action.

Example Usage

local team_id = 1
local player_id = 1
local unit_type = DCEI.Unit("Standard MeleeUnit")
local x, z = 16, 16
local target = DCEI.CreateUnit(team_id, player_id, unit_type, x, z)
local action = {
  actor = "",
  color = {r = 1.0, g = 0.5, b = 0.5, a = 0.25},
  duration = 1.0,
  ease = "InBounce",
  ease_intensity = 1.0,
}

DCEI.SendSetTintColorActorAction(target, action)

AsyncPvpBot

Type AsyncPvpBot

Type Structure

AsyncPvpBot
{
string uuid
string tag
string name
string board
double elo
}

Description


Used for DCEI.AsyncPvp.UseBotOpponent()

Example Usage


Demo map with source code: https://platform.wildsky.dev/arcade/game/775

DCEI.SetOnClickCallback(
    use_bot_button,
    function()
        local bot = {uuid = "bot:1234", tag = "bx", name = "bx", elo = 0, board = "bb", board_win_count = 0, board_lose_count = 0, board_time = os.time()}
        DCEI.AsyncPvp.UseBotOpponent(
            session_info.id,
            bot,
            function(result)
                if not result then
                    return
                end
                session_info.current_opponent = bot
                controller:SetSessionInfo(session_info)
            end
        )
    end
)

Ease

Enum Ease

Enum Structure

Unset
Linear
InSine
OutSine
InOutSine
InQuad
OutQuad
InOutQuad
InCubic
OutCubic
InOutCubic
InQuart
OutQuart
InOutQuart
InQuint
OutQuint
InOutQuint
InExpo
OutExpo
InOutExpo
InCirc
OutCirc
InOutCirc
InElastic
OutElastic
InOutElastic
InBack
OutBack
InOutBack
InBounce
OutBounce
InOutBounce
Flash
InFlash
OutFlash
InOutFlash

Description


See https://easings.net/en for visual examples.

Example Usage

function AnimateSparkle(self, frame)
    local k1, k2 = 0, 1
    local duration = Core.Random.GetNumber(1, 2)
    local ease = "OutQuart"
    local animation = DCEI.AnimateFrameAlpha(frame, k1, k2, duration, ease)
    DCEI.SetFrameAnimationLoops(animation, -1, "Yoyo")

    local k1 = { x = 0.5, y = 0.5, z = 0.5 }
    local k2 = { x = 1.5, y = 1.5, z = 1.5 }
    local ease = "OutSine"
    local animation = DCEI.AnimateFrameScale(frame, k1, k2, duration, ease)
    DCEI.SetFrameAnimationLoops(animation, -1, "Yoyo")

    local start_rotation = math.random(1, 360)
    local k1, k2 = { z = start_rotation }, { z = start_rotation - 90 }
    local ease = "Linear"
    local duration = 1
    local duration = Core.Random.GetNumber(1.5, 2.5)
    local animation = DCEI.AnimateFrameRotation(frame, k1, k2, duration, ease)
    DCEI.SetFrameAnimationLoops(animation, -1, "Incremental")
end

LoopType

Enum LoopType

Enum Structure

Restart
Yoyo
Incremental

Description


Restart
When the animation finishes, it resets to the start. An animation rotating 15 degrees will reset to 0 degrees and animate back towards 15 degrees again.

Yoyo
When the animation finishes, it reverses and plays back to the start, then plays forwards again. An animation rotating 15 degrees will rotate back to 0 degrees, then forwards to 15 degrees, etc.

Incremental
When the animation finishes, it continues to play additively. An animation rotating 15 degrees will continue, rotating 30 degrees, 45 degrees, etc.

Example Usage

function AnimateSparkle(self, frame)
    local k1, k2 = 0, 1
    local duration = Core.Random.GetNumber(1, 2)
    local ease = "OutQuart"
    local animation = DCEI.AnimateFrameAlpha(frame, k1, k2, duration, ease)
    DCEI.SetFrameAnimationLoops(animation, -1, "Yoyo")

    local k1 = { x = 0.5, y = 0.5, z = 0.5 }
    local k2 = { x = 1.5, y = 1.5, z = 1.5 }
    local ease = "OutSine"
    local animation = DCEI.AnimateFrameScale(frame, k1, k2, duration, ease)
    DCEI.SetFrameAnimationLoops(animation, -1, "Yoyo")

    local start_rotation = math.random(1, 360)
    local k1, k2 = { z = start_rotation }, { z = start_rotation - 90 }
    local ease = "Linear"
    local duration = 1
    local duration = Core.Random.GetNumber(1.5, 2.5)
    local animation = DCEI.AnimateFrameRotation(frame, k1, k2, duration, ease)
    DCEI.SetFrameAnimationLoops(animation, -1, "Incremental")
end