Hands-On Usage
every_neighbor_state is commonly used in territorial expansion mods — for example, automatically adding cores or claims to all neighboring states after a country occupies one, or synchronously setting surrounding states to a high resistance level during resistance movement events. It is also well-suited for map-redrawing scripts that bulk-transfer ownership of adjacent states.
# When a country occupies a state, add claims to all neighboring states controlled by the enemy
42 = {
every_neighbor_state = {
limit = {
is_owned_by = GER
NOT = { is_core_of = ROOT }
}
add_core_of = ROOT
add_resistance = 15
}
}
Synergy
- any_neighbor_state: Checks on the trigger side whether any neighboring state meets the specified conditions. Pairing this with
every_neighbor_state gives you the classic pattern of checking before acting, preventing effects from being applied to an empty set.
- random_neighbor_state: Use this when you only need to apply an effect to a single randomly selected neighboring state. It and
every_neighbor_state are counterparts — "all" versus "one at random."
- add_core_of: Bulk-adding cores to neighboring states is the most common use case, typically called inside the child block of
every_neighbor_state.
- transfer_state_to: Combining this with
every_neighbor_state enables chain-transferring ownership of adjacent states, frequently seen in post-war peace scripts or event outcome handling.
Common Pitfalls
- Forgetting scope restrictions:
every_neighbor_state can only be called within a STATE scope. Using it directly inside a COUNTRY scope will cause script errors or unexpected behavior — you must first enter a specific state scope via something like capital_scope.
- Accidentally placing effect commands inside
limit: Beginners often write effects such as add_resistance inside a limit = { } block. limit only accepts triggers; all executable operations must be placed in the child block outside of limit.