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"
}
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
set_entity_animation 常用于 3D 地图实体的动态表现场景,例如让自定义建筑、装置或特效实体在特定事件触发后播放指定动画(如激光射击、爆炸闪光、旋转光柱等)。典型场景包括:剧情事件中触发某个地图标志物的动画演出,或玩家完成某科技后让对应设施实体进入"激活"动画状态。
# 触发某装置实体播放激活动画
country_event = {
id = my_mod.1
immediate = {
set_entity_animation = {
id = 101
animation = "activate_beam"
}
}
}
[create_entity](/wiki/effect/create_entity):先用 create_entity 在地图上生成实体并记录其 id,再用 set_entity_animation 对该实体指定动画,两者构成"创建→驱动"的标准流程。[set_entity_position](/wiki/effect/set_entity_position):在播放动画前通常需要将实体移至正确坐标,与 set_entity_animation 组合保证动画出现在正确位置。[set_entity_rotation](/wiki/effect/set_entity_rotation):朝向不对时动画视觉效果会错误,配合旋转命令可确保动画方向与场景一致。[destroy_entity](/wiki/effect/destroy_entity):动画播放结束后往往需要清理实体,用 destroy_entity 移除,避免地图上残留无用实体。id 必须是当前已存在于地图上的实体编号,若实体尚未创建或已被销毁,该命令将静默失败且不报错,新手容易误以为是动画名拼写错误而反复排查错误方向。animation 字段的字符串须与模型文件(.asset)中声明的动画名称一字不差,大小写敏感;随意填写动画名不会崩溃,但动画不会播放,调试时极易被忽略。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.