effect · set_entity_animation
Definition
- Supported scope:
any - Supported target:
any
Description
sets the rotation of existing entity
set_entity_animation = {
id = 123 # id of entity
animation = "shoot_lasers"
}
set_entity_animationanyanysets the rotation of existing entity
set_entity_animation = {
id = 123 # id of entity
animation = "shoot_lasers"
}
Hands-on notes are AI-generated and checked against the vanilla command vocabulary — treat them as a starting point, not authoritative reference. The definition above is the game's own documentation.
set_entity_animation is commonly used for dynamic visual effects on 3D map entities, such as triggering custom buildings, installations, or visual effect entities to play specific animations after certain events occur (e.g., laser fire, explosion flashes, rotating light pillars, etc.). Typical scenarios include: triggering animation sequences for map landmarks in story events, or placing corresponding facility entities into an "activated" animation state after the player completes a technology.
# Trigger a facility entity to play activation animation
country_event = {
id = my_mod.1
immediate = {
set_entity_animation = {
id = 101
animation = "activate_beam"
}
}
}
[create_entity](/wiki/effect/create_entity): First use create_entity to spawn an entity on the map and record its id, then use set_entity_animation to assign an animation to that entity. Together they form the standard "create → drive" workflow.[set_entity_position](/wiki/effect/set_entity_position): Before playing the animation, you typically need to move the entity to the correct coordinates. Combined with set_entity_animation, this ensures the animation appears in the right location.[set_entity_rotation](/wiki/effect/set_entity_rotation): Incorrect orientation will break the visual effect of the animation. Pairing with rotation commands ensures the animation direction matches the scene.[destroy_entity](/wiki/effect/destroy_entity): After the animation finishes playing, the entity usually needs to be cleaned up. Use destroy_entity to remove it and prevent orphaned entities from cluttering the map.id must be a valid entity ID currently existing on the map. If the entity has not been created yet or has already been destroyed, this command will silently fail without error reporting. Beginners often mistakenly assume it's an animation name typo and waste time investigating the wrong direction.animation field must precisely match the animation name declared in the model file (.asset), and is case-sensitive. Entering an arbitrary animation name won't crash the game, but the animation won't play either, making it easy to overlook during debugging.