Hands-On Usage
every_owned_state is commonly used after a war ends to batch-process all territories belonging to the victor — for example, clearing flags, setting building levels, or transferring cores. It is also used during game startup initialization to bulk-add resources or compliance to every state owned by a specific country.
# Example: After victory, clear temporary flags and raise compliance across all owned states
GER = {
every_owned_state = {
limit = {
is_controlled_by = GER
has_state_flag = temp_occupation_flag
}
clr_state_flag = temp_occupation_flag
add_compliance = 10
}
}
Synergy
- is_controlled_by: Used inside a
limit block to filter for states actually controlled by the country, preventing unintended operations on occupied or contested territory.
- set_building_level: After iterating over all owned states, bulk-sets specific buildings to a target level — ideal for mod initialization scenarios or post-war reconstruction events.
- add_resistance: In resistance-related events, uniformly adjusts resistance values across all qualifying occupied states; pair with has_active_resistance inside
limit to narrow down the targets.
- transfer_state_to: Combined with
limit conditions, transfers multiple states meeting specific criteria to another country in a single pass — commonly seen in peace deal scripts or decision effects.
Common Pitfalls
- Forgetting
limit and accidentally affecting every state: every_owned_state iterates over all states owned by the country. Without a limit block, the effect applies to every single state including core homeland states, which can easily cause large-scale unintended changes. Always make it a habit to include a limit.
- Scope confusion causing field errors:
every_owned_state enters STATE scope. Inside it, you cannot directly use commands that belong exclusively to COUNTRY scope (such as add_ideas). You must switch back to COUNTRY scope first via owner = { ... } or a similar construct before executing country-level commands.