Wiki

trigger · any_neighbor_country

Definition

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

Description

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

实战 · 配合 · 坑

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

实战用法

any_neighbor_country 常用于检查某国是否被敌对大国包围、是否拥有已开战的邻国,或用于限制某个决策只在周边有特定政体的国家时才可用。例如,在一个"民主扩张"的决策中,只有当至少一个邻国是民主政府时才允许触发:

available = {
    any_neighbor_country = {
        has_government = democratic
        has_war = no
    }
}

也可结合 tooltip 参数为玩家提供更清晰的 UI 提示:

trigger = {
    any_neighbor_country = {
        tooltip = NEIGHBOR_IS_AT_WAR_TT
        has_war = yes
        is_major = yes
    }
}

配合关系

  • is_neighbor_of:与 any_neighbor_country 互为补充,前者在某国 scope 内判断自身是否与指定国相邻,后者遍历所有邻国,组合使用可精确限定双向边界关系。
  • has_government:在 any_neighbor_country 块内判断邻国政体,是构造"意识形态包围"类触发条件的核心组合。
  • has_war_with:在邻国块内检查该邻国是否正与特定国交战,用于判断周边战况是否影响本国决策。
  • is_in_faction:在邻国块内确认邻国是否已加入某阵营,常用于联盟扩张或外交事件的前置条件。

常见坑

  1. 误用 scopeany_neighbor_country 只能在 COUNTRY scope 下使用。若在 STATEPROVINCE scope 内直接调用,脚本会静默失败或报错,需先通过 OWNER / CONTROLLER 等跳转回国家 scope 再使用。
  2. 混淆"邻国"定义:该 trigger 判断的是陆地或短海峡相连的邻国,并非所有有外交关系的国家。若目标国与本国仅隔大洋相望,不会被计入邻国,切勿用它替代对远距离国家的检查。

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

any_neighbor_country is commonly used to check whether a country is surrounded by hostile major powers, whether any of its neighbors are at war, or to restrict a decision so it is only available when nearby countries meet certain political criteria. For example, in a "democratic expansion" decision, the trigger fires only when at least one neighbor is a democratic government at peace:

available = {
    any_neighbor_country = {
        has_government = democratic
        has_war = no
    }
}

You can also pair it with the tooltip parameter to give players clearer UI feedback:

trigger = {
    any_neighbor_country = {
        tooltip = NEIGHBOR_IS_AT_WAR_TT
        has_war = yes
        is_major = yes
    }
}

Synergy

  • is_neighbor_of: Complements any_neighbor_country — the former checks, within a given country's scope, whether that country is adjacent to a specific nation, while the latter iterates over all neighbors. Used together, they allow precise control over bidirectional border relationships.
  • has_government: Checks a neighbor's ideology inside an any_neighbor_country block; the core pairing for constructing "ideological encirclement" trigger conditions.
  • has_war_with: Checks inside a neighbor block whether that neighbor is currently at war with a specific country, useful for determining whether surrounding conflicts should influence the player's own decisions.
  • is_in_faction: Confirms inside a neighbor block whether the neighbor has already joined a faction; commonly used as a prerequisite for alliance expansion or diplomatic events.

Common Pitfalls

  1. Wrong scope: any_neighbor_country can only be used within a COUNTRY scope. Calling it directly inside a STATE or PROVINCE scope will cause the script to fail silently or throw an error. You must first transition back to a country scope via OWNER, CONTROLLER, or similar before using it.
  2. Misunderstanding what "neighbor" means: This trigger considers only countries connected by land or a short strait — not every country with which a diplomatic relationship exists. If the target country is separated from the current country by an ocean, it will not be counted as a neighbor. Do not use this trigger as a substitute for checks targeting distant nations.