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
- 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.
- 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.