Hands-On Usage
delete_units is commonly used in scripted events or focus completion to remove specific division templates from the map—such as when a civil war ends, a ceasefire takes effect, or at special historical moments to erase temporary armed forces. Combined with disband = yes, equipment can be salvaged back into the national stockpile, suitable for narrative scenarios of "forces dispersed but supplies retained"; whereas the default disband = no simulates units being completely wiped out or vanishing into thin air.
# Civil war conclusion event: disband rebel infantry template and recover equipment
country_event = {
id = civil_war.5
immediate = {
delete_units = {
division_template = "Rebel Infantry"
disband = yes
}
}
}
Synergy
[division_template](/wiki/effect/division_template): First define or modify a template using division_template, then use delete_units to remove all instances of it—together they form a complete lifecycle management of "create-then-clear."
[add_manpower](/wiki/effect/add_manpower): When disband = no, personnel vanish directly; you can use add_manpower in the same event block to compensate for manpower loss, simulating the logic of soldiers surrendering and being discharged back home.
[any_country_division](/wiki/trigger/any_country_division): Before executing deletion, use this trigger to check whether units of that template exist, avoiding invalid calls or logic errors caused by a non-existent template.
[delete_unit_template_and_units](/wiki/effect/delete_unit_template_and_units): If the goal is to completely remove the template itself and all its units, follow up delete_units with this command; they have different responsibilities—the former deletes only units, the latter deletes both template and units.
Common Pitfalls
- Template name capitalization and spelling must match the
division_template definition exactly—even a single extra space or incorrect letter case will cause silent failure in-game. Units will not be deleted and no error message will appear, making it extremely difficult to debug.
- The default value of
disband is no, and equipment will vanish completely—newcomers often forget to write disband = yes, resulting in valuable equipment stockpile loss for no reason. This is especially costly when clearing elite templates with superior gear.