Hands-On Usage
every_state_division is commonly used in mods to apply bulk state changes to all units within a given state — for example, reducing the organization of defending forces after a state-level event, swapping division templates, or destroying specific faction garrisons during occupation or liberation events. Pairing it with limit lets you precisely filter which divisions are affected, preventing friendly fire.
# In a STATE scope event, destroy all weak enemy (non-controller) units in the state
state_event = {
id = my_mod.1
immediate = {
every_state_division = {
limit = {
unit_strength < 0.3
}
destroy_unit = yes
}
}
}
If you only want to process a handful of units at random, add random_select_amount = 2 to apply the effect to just 2 randomly chosen divisions — useful for simulating a localized raid scenario.
Synergy
- unit_strength: Used inside a
limit block to filter divisions below a strength threshold. This is the most common filtering condition, preventing unnecessary effects from being applied to full-strength units.
- destroy_unit: Works directly alongside this command to destroy the filtered divisions. Frequently used in liberation or disaster events to clear out garrisoning forces.
- set_unit_organization: Batch-resets the organization of all units in a state — for instance, zeroing out the organization of every encircled division after a pocket event.
- damage_units: Deals manpower and equipment losses to filtered divisions. A softer alternative to
destroy_unit, well-suited for simulating attrition warfare or post-bombardment effects.
Common Pitfalls
-
Scope confusion: every_state_division must be called within a STATE scope. If you write it at the top level of a country scope (e.g., inside SOV = { ... }) without first entering a state scope, the script will silently fail or throw an error. Use capital_scope = { } or reference a specific state to enter the correct scope first.
-
Using country-level triggers inside limit: The limit block runs in division scope, so country-level conditions (such as tag = GER) cannot be written directly inside it. If you need to check which country a division belongs to, handle it through nested scope methods such as any_of_scopes, or use an if block at the country level as a prerequisite check before the every_state_division call.