Trigger API Reference\DCEI Functions\Actor
int GetAnimationClipId(string name)
int GetAnimationClipId(string name)
Description
Get animation clip Id according to the clip name.
Parameters
- string
name
animation clip name.
Example Usage
local id = DCEI.GetAnimationClipId("attack")
DCEI.CompileActorAction('{"playAnimation": {"clipId": ' .. tostring(id) .. '}}')
void SendSetModelScaleActorAction(unit unit, SetModelScaleActorAction action, string targetActorName = null)
void SendSetModelScaleActorAction(unit unit, SetModelScaleActorAction action, string targetActorName = null)
Description
Send a model scale actor action to a unit's actor (or an actor in its scope).
Parameters
- unit
unit
the unit whose actor (or an actor in it's scope) receives the sent actor action. - SetModelScaleActorAction
action
the actor action sent to the actor. - string
targetActorName
the name of the actor to which the actor action is sent. Default value is null/nil, which falls back to the unit's actor.
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)
void SendCreateActorAction(unit unit, CreateActorAction action, string targetActorName = null)
void SendCreateActorAction(unit unit, CreateActorAction action, string targetActorName = null)
Description
Send a create actor actor action to a unit's actor (or an actor in its scope).
Parameters
- unit
unit
the unit whose actor (or an actor in it's scope) receives the sent actor action. - CreateActorAction
action
the actor action sent to the actor. - string
targetActorName
the name of the actor to which the actor action is sent. Default value is null/nil, which falls back to the unit's actor.
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)
void SendDestroyActorAction(unit unit, DestroyActorAction action, string targetActorName = null)
void SendDestroyActorAction(unit unit, DestroyActorAction action, string targetActorName = null)
Description
Send a destroy actor actor action to a unit's actor (or an actor in its scope).
Parameters
- unit
unit
the unit whose actor (or an actor in it's scope) receives the sent actor action. - DestroyActorAction
action
the actor action sent to the actor. - string
targetActorName
the name of the actor to which the actor action is sent. Default value is null/nil, which falls back to the unit's actor.
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)
void SendSendCustomEventActorAction(unit unit, SendCustomEventActorAction action, string targetActorName = null)
void SendSendCustomEventActorAction(unit unit, SendCustomEventActorAction action, string targetActorName = null)
Description
Send a send custom event actor action to a unit's actor (or an actor in its scope).
Parameters
- unit
unit
the unit whose actor (or an actor in it's scope) receives the sent actor action. - SendCustomEventActorAction
action
the actor action sent to the actor. - string
targetActorName
the name of the actor to which the actor action is sent. Default value is null/nil, which falls back to the unit's actor.
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)
void SendPlayAnimationActorAction(unit unit, PlayAnimationActorAction action, string targetActorName = null)
void SendPlayAnimationActorAction(unit unit, PlayAnimationActorAction action, string targetActorName = null)
Description
Send a play animation actor action to a unit's actor (or an actor in its scope).
Parameters
- unit
unit
the unit whose actor (or an actor in it's scope) receives the sent actor action. - PlayAnimationActorAction
action
the actor action sent to the actor. - string
targetActorName
the name of the actor to which the actor action is sent. Default value is null/nil, which falls back to the unit's actor.
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)
void SendPauseAnimationActorAction(unit unit, PauseAnimationActorAction action, string targetActorName = null)
void SendPauseAnimationActorAction(unit unit, PauseAnimationActorAction action, string targetActorName = null)
Description
Send a pause animation actor action to a unit's actor (or an actor in its scope).
Parameters
- unit
unit
the unit whose actor (or an actor in it's scope) receives the sent actor action. - PauseAnimationActorAction
action
the actor action sent to the actor. - string
targetActorName
the name of the actor to which the actor action is sent. Default value is null/nil, which falls back to the unit's actor.
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)
void SendSetVisibilityActorAction(unit unit, SetVisibilityActorAction action, string targetActorName = null)
void SendSetVisibilityActorAction(unit unit, SetVisibilityActorAction action, string targetActorName = null)
Description
Send a set visibility actor action to a unit's actor (or an actor in its scope).
Parameters
- unit
unit
the unit whose actor (or an actor in it's scope) receives the sent actor action. - SetVisibilityActorAction
action
the actor action sent to the actor. - string
targetActorName
the name of the actor to which the actor action is sent. Default value is null/nil, which falls back to the unit's actor.
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)
void SendSetTintColorActorAction(unit unit, SetTintColorActorAction action, string targetActorName = null)
void SendSetTintColorActorAction(unit unit, SetTintColorActorAction action, string targetActorName = null)
Description
Send a set tint color actor action to a unit's actor (or an actor in its scope).
Parameters
- unit
unit
the unit whose actor (or an actor in it's scope) receives the sent actor action. - SetTintColorActorAction
action
the actor action sent to the actor. - string
targetActorName
the name of the actor to which the actor action is sent. Default value is null/nil, which falls back to the unit's actor.
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)
void SetVfxPriorityLevel(int level)
void SetVfxPriorityLevel(int level)
Description
Discard some VFX for better performance on low-end devices. The priority levels are 1, 2, and 3, and all VFX with priority lower than the priority level will not display. The actor's priority can be set in the editor's actor data tab.
Parameters
- int
level
the level of VFX to discard.
Example Usage
local button_layout = GMUI.Layout.New({
parent = DCEI.GetUiRootFrame(),
name = "Standard/Button/Button",
})
DCEI.SetOnClickCallback(button_layout.Button, function()
DCEI.SetVfxPriorityLevel(2)
end)
void UseAlternativeActorResource(string actor)
void UseAlternativeActorResource(string actor)
Description
Allows actors of the specified type to use an alternate asset, as defined in its actor data. Intended for use in abtesting variant assets.
Parameters
- string
actor
the actor type that will use an alternative resource.
Example Usage
DCEI.UseAlternativeActorResource("Hero Ness")
-- Now all instances of Hero Ness will use an alternative resource defined in its data.