Wiki

effect · create_entity

Definition

  • Supported scope:any
  • Supported target:any

Description

creates an entity on map
create_entity = {
  entity = entity_name #gfx entry 
  id = 123 # can be ommitted. if given you can use this id to access entity in later times. will replace existing entity if it exists
  var = var_name # can be ommitted. if given the id will be stored in this value so the entity can be accessed in later times 
  # position can be set using following. you can specify a province/state or can enter a manual coordinate. you can do both and the coordinate will shift the state/province coordinate 
  x = 42 
  y = 21 
  province = 123 
  state = 42 
  z = 3 #if wanted you can specify a z to shift height of the entity
  rotation = 1.2 # angle in radians 
  scale = 10.0 # scale of entity 
  min_zoom = 100.0 # min zoom needed to show entity 
  visible = scripted_trigger_name # a scripted trigger name to show or hide an entity. scope is player country}

实战 · 配合 · 坑

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

实战用法

create_entity 常用于在地图上动态生成装饰性或功能性实体,例如在某国完成特定国策后在首都省份召唤一个纪念碑模型,或在事件触发时于指定坐标生成战场特效标记。下面是一个在事件中于特定省份生成实体并将其 id 存入变量的典型片段:

immediate = {
    create_entity = {
        entity = my_monument_entity
        province = 3614
        var = my_monument_id
        rotation = 0.0
        scale = 1.0
        visible = my_monument_visible_trigger
    }
}

配合关系

  • [set_entity_position](/wiki/effect/set_entity_position):实体创建后可随时调用此命令将其移动到新坐标,常用于需要跟随战线变化的动态标记。
  • [set_entity_animation](/wiki/effect/set_entity_animation):配合使用可在实体生成后立即播放指定动画,使视觉表现更生动。
  • [destroy_entity](/wiki/effect/destroy_entity):通过 varid 记录实体后,在另一个触发器或事件里销毁它,实现"生成—显示—销毁"的完整生命周期管理。
  • [set_entity_rotation](/wiki/effect/set_entity_rotation):在生成后根据脚本逻辑动态修正朝向,适合需要面向特定目标的实体。

常见坑

  1. entity 字段填写的是 GFX 条目名称,不是模型文件名。新手常把 .mesh 文件路径或本地化名直接填进去,导致游戏找不到条目而静默失败,实体不会出现在地图上,也不会报错提示。
  2. 省份坐标系与手动坐标系可以叠加但方向容易搞错x/z 是相对于 province/state 中心的偏移量,若同时指定了省份又填了很大的手动坐标偏移,实体会被推到意想不到的位置,甚至移出地图边界。建议调试时先只用 province,确认位置后再微调偏移值。

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

create_entity is commonly used to dynamically spawn decorative or functional entities on the map, such as summoning a monument model in the capital province after a nation completes a specific focus, or generating a battlefield effect marker at specified coordinates when an event fires. Below is a typical example of spawning an entity at a specific province within an event and storing its id in a variable:

immediate = {
    create_entity = {
        entity = my_monument_entity
        province = 3614
        var = my_monument_id
        rotation = 0.0
        scale = 1.0
        visible = my_monument_visible_trigger
    }
}

Synergy

  • [set_entity_position](/wiki/effect/set_entity_position): After an entity is created, this command can be called at any time to move it to new coordinates, commonly used for dynamic markers that need to track changing front lines.
  • [set_entity_animation](/wiki/effect/set_entity_animation): When used together, you can play a specified animation immediately after the entity is spawned for more vivid visual effects.
  • [destroy_entity](/wiki/effect/destroy_entity): After recording the entity via var or id, you can destroy it in another trigger or event, achieving a complete lifecycle management of "spawn—display—destroy".
  • [set_entity_rotation](/wiki/effect/set_entity_rotation): After spawning, dynamically correct the orientation based on script logic, suitable for entities that need to face a specific target.

Common Pitfalls

  1. The entity field takes a GFX entry name, not a model filename. Beginners often directly paste .mesh file paths or localization names, causing the game to silently fail to find the entry without any error message, and the entity will never appear on the map.
  2. Province coordinates and manual coordinates can stack but direction is easy to get wrong: x/z are offsets relative to the center of a province/state. If you specify both a province and large manual coordinate offsets, the entity may end up at an unexpected location or even outside the map boundary. It is recommended to debug using only province first, then fine-tune the offset values after confirming the position.