Wiki

trigger · all_neighbor_state

Definition

  • Supported scope:STATE
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

check if all neighbor states meets the trigger. tooltip=key can be defined to override title

实战 · 配合 · 坑

实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。

实战用法

all_neighbor_state 常用于判断某省份或地区是否已被完全包围,例如检查某国是否已控制/占领目标州的所有邻接州,以解锁特定决策或事件分支。也可用于判断某战略要地的缓冲区是否已全部纳入核心范围,从而触发领土整合逻辑。

# 检查所有邻接州均由同一国家控制,才允许某决策可用
available = {
    all_neighbor_state = {
        is_controlled_by = ROOT
    }
}
# 在 STATE scope 中,要求所有邻接州均为本国核心
trigger = {
    all_neighbor_state = {
        is_core_of = FROM
    }
}

配合关系

  • any_neighbor_stateall_neighbor_state 要求全部邻接州满足条件,any_neighbor_state 只要求至少一个满足,二者常配合构成"全包围/部分接触"的多段判断逻辑。
  • is_controlled_by:在 all_neighbor_state 内部用于验证每个邻接州的实际控制国,是最典型的内层条件。
  • is_core_of:配合 all_neighbor_state 检查邻接州的归属性质,常用于领土主张或合并前置判断。
  • every_neighbor_state:当 all_neighbor_state 判断为真后,用 every_neighbor_state 对这些相邻州批量执行效果(如转移控制权),形成"先判断后操作"的标准写法。

常见坑

  1. Scope 混用all_neighbor_state 必须在 STATE scope 下调用,如果当前 scope 是 COUNTRY,需要先通过 capital_scope 或具体州名切换到 STATE scope,否则脚本会静默报错且 trigger 始终不生效。
  2. any_neighbor_state 语义混淆:新手常误把"我想检查是否存在任一邻接州满足条件"写成 all_neighbor_state,导致条件过严而永远返回假;应仔细区分"全部满足"(all_neighbor_state)与"至少一个满足"(any_neighbor_state)的语义差别。

Hands-On Notes

Hands-on notes are AI-generated and checked against the vanilla command vocabulary — treat them as a starting point, not authoritative reference. The definition above is the game's own documentation.

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

  1. 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.
  2. 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).