Wiki

trigger · is_neighbor_of

Definition

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

Description

check if neighbor ( controlled territory ) with specified country

实战 · 配合 · 坑

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

实战用法

is_neighbor_of 常用于判断某国与目标国是否接壤(以实际控制领土为准),适合在外交事件、决策可用条件或战争目标脚本中限定触发范围。例如,当玩家想让某个决策只对相邻的敌国开放时,可以这样写:

available = {
    is_neighbor_of = GER
    has_defensive_war = yes
}

配合关系

  • [any_neighbor_country](/wiki/trigger/any_neighbor_country):当需要对"任意邻国"进行批量条件检查时,与 is_neighbor_of 配合使用,前者遍历所有邻国,后者精确锁定某一具体国家。
  • [has_defensive_war_with](/wiki/trigger/has_defensive_war_with):判断与特定邻国是否处于防御战争状态,两者结合可限定"与该邻国正在交战"的触发条件。
  • [can_declare_war_on](/wiki/trigger/can_declare_war_on):在宣战决策的 available 块中,先用 is_neighbor_of 确认领土接壤再判断是否可宣战,逻辑更严谨。
  • [create_wargoal](/wiki/effect/create_wargoal):在达成邻国接壤条件后生成战争目标,常见于扩张型决策链。

常见坑

  1. 以控制领土而非主权领土判断:该 trigger 检测的是"实际控制区域"是否接壤,而非该国"拥有"的核心州或主权州。如果目标国领土被第三方占领导致控制区不再与你相邻,条件会意外返回假,需注意占领状态对判断结果的影响。
  2. scope 写错位置is_neighbor_of 只能在 COUNTRY scope 下使用,新手有时在 STATE scope 的 limit 块内直接写此 trigger,导致脚本报错或静默失效,应确保外层 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

is_neighbor_of is commonly used to check whether a country shares a border with a target country (based on actually controlled territory), making it ideal for diplomatic events, decision availability conditions, or war goal scripts to restrict trigger scope. For example, when you want a decision to apply only to adjacent enemy nations, you can write it like this:

available = {
    is_neighbor_of = GER
    has_defensive_war = yes
}

Synergy

  • [any_neighbor_country](/wiki/trigger/any_neighbor_country): When you need to perform batch condition checks on "any neighboring country," use it together with is_neighbor_of—the former iterates through all neighbors while the latter pinpoints a specific nation.
  • [has_defensive_war_with](/wiki/trigger/has_defensive_war_with): Checks whether you are in a defensive war with a specific neighbor. Combined with is_neighbor_of, you can restrict the trigger condition to "currently at war with that neighbor."
  • [can_declare_war_on](/wiki/trigger/can_declare_war_on): In the available block of a war declaration decision, first use is_neighbor_of to confirm territorial adjacency, then check if war can be declared—this creates more rigorous logic.
  • [create_wargoal](/wiki/effect/create_wargoal): After meeting the neighbor adjacency condition, generate a war goal. This is commonly seen in expansionist decision chains.

Common Pitfalls

  1. Checking controlled territory, not sovereign territory: This trigger detects whether "actually controlled areas" are adjacent, not whether the target country "owns" core states or claimed states. If the target's territory is occupied by a third party such that the controlled region no longer borders you, the condition may unexpectedly return false. Pay attention to how occupation status affects the judgment result.
  2. Scope placed in the wrong location: is_neighbor_of can only be used under COUNTRY scope. Beginners sometimes place this trigger directly in the limit block of STATE scope, causing script errors or silent failures. Always ensure the outer scope is a country, not a state.