Wiki

effect · set_entity_position

Definition

  • Supported scope:any
  • Supported target:any

Description

sets the position of existing entity
set_entity_position = {
  id = 123 # id of entity 
  # position can be set using following 
  x = 42 
  y = 21 
  province = 123 
  state = 42 
  z = 3 #if wanted you can specify a z to shift height of the entity
}

实战 · 配合 · 坑

实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。

实战用法

set_entity_position 常用于自定义地图实体(如特效装饰物、战场标志物)的动态重定位,例如在某个事件触发后将一个视觉实体移动到指定省份或州来配合叙事演出。配合 create_entity 创建实体后,可立即用本命令将其精确放置到目标位置;也常见于循环逻辑中,随着游戏进程推进实体在地图上"移动"。

# 将 id=101 的实体移动到省份 3080(巴黎)上方
set_entity_position = {
    id = 101
    province = 3080
}

配合关系

  • [create_entity](/wiki/effect/create_entity) — 先创建实体再用本命令定位,是最典型的"创建后立即放置"工作流。
  • [set_entity_rotation](/wiki/effect/set_entity_rotation) — 移动实体后通常需要同步调整朝向,两者搭配实现完整的姿态控制。
  • [set_entity_animation](/wiki/effect/set_entity_animation) — 重定位后切换动画状态,使实体在新位置呈现正确的视觉效果。
  • [destroy_entity](/wiki/effect/destroy_entity) — 在实体完成任务、需要从新位置清除时配合使用,形成"移动→展示→销毁"完整生命周期。

常见坑

  1. id 填错导致静默失败id 必须对应一个已经存在(通过 create_entity 创建)的实体编号,填入不存在的 id 不会报错但完全无效,新手容易误以为命令本身有问题。
  2. 坐标系混用导致位置偏移x/y 是地图世界坐标,province/state 是基于游戏数据的定位方式,两者不能随意混搭期望叠加效果——同时填写时游戏只会按内部优先级取其一,应明确选择其中一种定位方式。

Hands-On Notes

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.

Hands-On Usage

set_entity_position is commonly used to dynamically reposition custom map entities (such as visual effects, decorative objects, or battlefield markers). For example, you can trigger an event to move a visual entity to a specified province or state to enhance narrative presentation. When combined with create_entity to spawn an entity, you can immediately use this command to place it precisely at the target location. It's also frequently seen in loop logic, where entities appear to "move" across the map as the game progresses.

# Move entity with id=101 to province 3080 (Paris)
set_entity_position = {
    id = 101
    province = 3080
}

Synergy

  • [create_entity](/wiki/effect/create_entity) — Create the entity first, then use this command to position it. This is the most typical "create-then-place" workflow.
  • [set_entity_rotation](/wiki/effect/set_entity_rotation) — After repositioning an entity, you typically need to adjust its rotation simultaneously. Use both commands together to achieve complete pose control.
  • [set_entity_animation](/wiki/effect/set_entity_animation) — Switch animation states after repositioning to ensure the entity displays the correct visual effects at its new location.
  • [destroy_entity](/wiki/effect/destroy_entity) — Use this in conjunction when the entity completes its purpose and needs to be removed from its new position, forming a complete lifecycle of "move → display → destroy".

Common Pitfalls

  1. Silent failure from incorrect id — The id must correspond to an entity that already exists (created via create_entity). Providing a non-existent id won't trigger an error but will have no effect whatsoever. New players often mistakenly think the command itself is broken.
  2. Position offset from mixing coordinate systemsx/y are map world coordinates, while province/state are game-data-based positioning methods. You cannot freely mix them expecting cumulative effects — when both are specified, the game will only use one according to its internal priority. Always choose one positioning method explicitly.