Wiki

effect · create_unit

Definition

  • Supported scope:any
  • Supported target:none

Description

Create unit effect, just like in OOB, example: 
create_unit = { 
	# unit detauls 
	division = "name = \"1. Northern Redemption Army\" division_template = \"Redemption Army\" start_experience_factor = 0.5" 
	# country to spawn unit for 
	owner = MAN 
	 
	 
	# a prov id can be specified 
	prioritize_location = 12406 
	 
	# can be set to yes to be able to spawn units on enemy provs. 
	allow_spawning_on_enemy_provs = no 
	# province controllers can be scored using this scorer. otherwise it will prio your owned provs first, friendly provs second.  
	# it will also prio provs with scores and less units firstl 
	country_score = { 
		base = 100 
		 
		modifier = { 
			tag = MAN 
			add = 100 
		} 
	} 
   count = 1 # can be specified to spawn more than one units 
   id = 42 # an id can be given to delete units later on   divisional_commander_xp = 4 # give the division commander experience on unit creation }

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_unit is commonly used in scripted events and national focus trees to spawn historically-themed units for a nation upon completion—for example, generating an elite division out of thin air at the end of a focus chain for the player, or reinforcing an AI nation's frontline when an event triggers. Combined with prioritize_location, units can be deployed preferentially to a specified province, making it ideal for recreating the opening setup of a particular campaign scenario.

# Spawn an elite infantry division for Manchukuo upon focus completion
MAN = {
    create_unit = {
        division = "name = \"关東守備第一師\" division_template = \"Infantry Division\" start_experience_factor = 0.3"
        owner = MAN
        prioritize_location = 12406
        allow_spawning_on_enemy_provs = no
        count = 1
        divisional_commander_xp = 2
    }
}

Synergy

  • [hidden_effect](/wiki/effect/hidden_effect): Wrap create_unit inside a hidden block to suppress irrelevant notifications in the event interface when units spawn, keeping the narrative clean.
  • [damage_units](/wiki/effect/damage_units): First spawn units with create_unit, then apply damage_units to simulate the narrative effect of those units having already endured bitter combat and entering the field depleted.
  • [save_event_target_as](/wiki/effect/save_event_target_as): Save the target nation as an event target before spawning to ensure the owner field points to the correct dynamic nation—especially critical in multi-nation coordinated scripts.
  • [any_state](/wiki/trigger/any_state): Check province ownership or existence at the trigger condition level to confirm the precondition is met before executing create_unit, preventing units from spawning in invalid locations.

Common Pitfalls

  1. The division template name in the division field must exactly match an existing division template for the target nation (case and spacing must be perfect), otherwise the game fails silently—no error is thrown, but the unit simply won't spawn. Newcomers often mistake this for the script not executing at all.
  2. Omitting owner or specifying a country that no longer exists causes unit ownership confusion or direct errors. In dynamic nation scripts, always use [country_exists](/wiki/trigger/country_exists) to confirm the nation exists before executing the creation command.