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}

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.