Wiki

trigger · num_owned_neighbour_states

Definition

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

Description

Checks if a country owns the amount of states neighbouring the scoped state

实战 · 配合 · 坑

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

实战用法

num_owned_neighbour_states 常用于判断某个州是否被某国大量包围,适合在占领、决策或事件中检测战略包围圈。例如在"孤立飞地"决策里,判断某州四周邻接州是否全归同一敌国所有,从而触发特殊外交或投降选项。

# 决策 available 示例:当某州被目标国包围时才可用
available = {
    ROOT = {  # ROOT 为当前州
        num_owned_neighbour_states = {
            count > 3
            owner = FROM  # FROM 为触发决策的国家
        }
    }
}

配合关系

  • [any_neighbor_state](/wiki/trigger/any_neighbor_state):先用 any_neighbor_state 遍历逐一检查邻州属性,再用本 trigger 统计数量,两者组合可实现"邻州满足特定条件的数量"逻辑。
  • [is_owned_by](/wiki/trigger/is_owned_by):在 any_neighbor_stateall_neighbor_state 内搭配 is_owned_by,与本 trigger 互相印证,确认具体归属关系。
  • [every_neighbor_state](/wiki/effect/every_neighbor_state):当本 trigger 判断为真后,使用 every_neighbor_state 对所有满足条件的邻州批量施加效果,形成"检测→执行"的完整流程。
  • [is_core_of](/wiki/trigger/is_core_of):与本 trigger 并列使用,在判断包围数量的同时额外限定邻州必须是某国核心州,用于更精确的领土主张场景。

常见坑

  1. scope 位置写错:本 trigger 必须置于 STATE scope 下才能生效,直接写在国家 scope 里会静默失败或报错,新手常忘记先用 capital_scope 或具体州 scope 切换进去。
  2. target 字段误用owner 字段所填的 target(如 ROOTFROM)是相对于调用该 trigger 时所在的上下文解析的,若嵌套层级较深,ROOT/FROM 指向的国家可能并非预期目标,需仔细追踪 scope 链。

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

num_owned_neighbour_states is commonly used to determine whether a state is heavily surrounded by a particular country, making it ideal for detecting strategic encirclement in occupation mechanics, decisions, or events. For example, in an "isolated enclave" decision, you can check whether all neighboring states adjacent to a target state are controlled by the same enemy nation, thereby triggering special diplomatic options or surrender mechanics.

# Decision available example: only available when a state is surrounded by the target nation
available = {
    ROOT = {  # ROOT refers to the current state
        num_owned_neighbour_states = {
            count > 3
            owner = FROM  # FROM refers to the country that triggered the decision
        }
    }
}

Synergy

  • [any_neighbor_state](/wiki/trigger/any_neighbor_state): Use any_neighbor_state to iterate through and check each neighboring state's properties first, then use this trigger to count the total, and combining both achieves "number of neighbor states meeting specific conditions" logic.
  • [is_owned_by](/wiki/trigger/is_owned_by): Pair is_owned_by within any_neighbor_state or all_neighbor_state alongside this trigger to cross-verify and confirm specific ownership relationships.
  • [every_neighbor_state](/wiki/effect/every_neighbor_state): Once this trigger evaluates to true, use every_neighbor_state to apply effects in bulk to all neighboring states meeting the conditions, forming a complete "detect→execute" workflow.
  • [is_core_of](/wiki/trigger/is_core_of): Use in parallel with this trigger to simultaneously limit neighbor states to being cores of a specific nation while judging encirclement count, suited for more precise territorial claim scenarios.

Common Pitfalls

  1. Incorrect scope placement: This trigger must be placed within a STATE scope to take effect; placing it directly in a country scope will silently fail or throw an error. Beginners often forget to switch scope first using capital_scope or an explicit state scope.
  2. Misusing the target field: The target values filled in the owner field (such as ROOT, FROM) are resolved relative to the context in which this trigger is invoked. If nesting levels are deep, ROOT/FROM may not point to the intended nation, requiring careful tracking of the scope chain.