Hands-On Usage
Commonly used in country events or decisions to clean up division templates that are no longer needed—for example, disbanding temporary militia templates after a civil war ends, or removing obsolete armor templates when switching tech trees. When disband = yes, equipment and manpower can be recovered, making it suitable for resource-constrained scenarios; disband = no is used to completely destroy a force without giving the player any compensation.
country_event = {
id = cleanup.1
option = {
name = cleanup.1.a
# Civil war ends, disband temporary militia template and recover resources
delete_unit_template_and_units = {
division_template = "People's Militia"
disband = yes
}
}
}
Synergy
[division_template](/wiki/effect/division_template): First use division_template to dynamically create a temporary template, then use this command to delete both the template and its units together, forming a complete "create-destroy" lifecycle.
[add_manpower](/wiki/effect/add_manpower): When disband = no causes manpower to disappear without compensation, you can add manpower in the same option to offset the player's losses.
[has_country_flag](/wiki/trigger/has_country_flag): Check a flag before executing the deletion to ensure the template has actually been created, avoiding script errors or unexpected behavior when the template doesn't exist.
[delete_units](/wiki/effect/delete_units): If you only want to remove units while preserving the template for later reuse, use delete_units instead; comparing the two allows precise control over whether to keep the template definition.
Common Pitfalls
- Template name capitalization must match the definition exactly: The
division_template field value is string-matched; even a single extra space or incorrect capitalization will cause silent failure—the template and units won't be deleted, and no error will be reported, making it extremely difficult to troubleshoot.
- Mistaking
disband = no as the safe default option: disband = no (the default value) will directly destroy the units and all their carried equipment and manpower with no compensation; using it in player-visible event options without clear explanation easily creates a jarring experience gap. It's recommended to make an explicit choice between disband = yes and no based on narrative logic and inform the player in the description text.