Hands-On Usage
all_neighbor_state is commonly used to determine whether a province or region has been fully encircled — for example, checking whether a country controls or occupies all states adjacent to a target state in order to unlock a specific decision or event branch. It can also be used to verify that the entire buffer zone around a strategic location has been brought within core territory, thereby triggering territorial consolidation logic.
# Only allow a decision to be available when all neighboring states are controlled by ROOT
available = {
all_neighbor_state = {
is_controlled_by = ROOT
}
}
# Within a STATE scope, require all neighboring states to be cores of FROM
trigger = {
all_neighbor_state = {
is_core_of = FROM
}
}
Synergy
- any_neighbor_state:
all_neighbor_state requires all neighboring states to meet the condition, while any_neighbor_state requires only at least one to do so. The two are often used together to build multi-stage logic for "full encirclement vs. partial contact" checks.
- is_controlled_by: Used inside
all_neighbor_state to verify the actual controller of each neighboring state — the most typical inner condition.
- is_core_of: Paired with
all_neighbor_state to check the ownership nature of neighboring states; commonly used as a prerequisite for territorial claims or annexation.
- every_neighbor_state: Once
all_neighbor_state evaluates to true, use every_neighbor_state to apply effects in bulk to those neighboring states (e.g., transferring control), forming the standard "check first, then act" pattern.
Common Pitfalls
- Scope mismatch:
all_neighbor_state must be called within a STATE scope. If the current scope is COUNTRY, you must first switch to a STATE scope via capital_scope or a specific state name; otherwise the script will fail silently and the trigger will never fire.
- Semantic confusion with
any_neighbor_state: Beginners often mistakenly write all_neighbor_state when they actually want to check whether any neighboring state meets a condition, resulting in an overly strict condition that always returns false. Always distinguish carefully between "all must satisfy" (all_neighbor_state) and "at least one must satisfy" (any_neighbor_state).