Wiki

trigger · any_allied_country

Definition

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

Description

Check if any allied country meets the trigger. Does not include the country itself. tooltip=key can be defined to override title

实战 · 配合 · 坑

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

实战用法

any_allied_country 常用于检查当前国家的至少一个盟友是否满足某个条件,例如判断是否有盟友已经拥有某项科技、处于战争状态或达到特定政治倾向,从而触发联动事件或解锁决策。典型场景是同盟外交 mod 中,当盟友中存在法西斯政权时阻止某些民主合作选项。

# 检查是否有任何盟友正在进行战争,并且是主要国家
available = {
    any_allied_country = {
        has_war = yes
        is_major = yes
    }
}

配合关系

  • is_ally_with:直接检查与某具体国家的同盟关系,配合 any_allied_country 可先确认盟友范围再做精确筛选。
  • has_government:在 any_allied_country 内部用于筛选特定意识形态的盟友,常见于判断阵营政治生态。
  • is_in_faction:与 any_allied_country 配合可区分"阵营成员"与"双边同盟"两种不同的盟友类型,避免逻辑混淆。
  • has_war_with:在盟友循环内检查某盟友是否与特定国家交战,用于判断是否需要触发参战事件链。

常见坑

  1. 误以为包含自身any_allied_country 明确不包含当前 scope 的国家本身,若需要同时检查自身条件,须在外层单独添加对应 trigger,不能依赖此命令覆盖自身。
  2. 与阵营成员混淆:该 trigger 检查的是双边同盟关系(is_ally_with 语义),而非阵营(faction)成员关系;阵营内的国家不一定互为盟友,若想遍历阵营成员应改用 all_allied_country 结合 is_in_faction 或直接对阵营逻辑单独处理。

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_allied_country is commonly used to check whether at least one of the current country's allies meets a given condition — for example, whether any ally has already researched a specific technology, is at war, or has reached a particular political alignment — in order to fire chained events or unlock decisions. A typical use case in alliance-diplomacy mods is blocking certain democratic cooperation options when a fascist regime exists among the player's allies.

# Check whether any ally is currently at war and is a major country
available = {
    any_allied_country = {
        has_war = yes
        is_major = yes
    }
}

Synergy

  • is_ally_with: Directly checks the alliance relationship with a specific country. Pair it with any_allied_country to first narrow down the ally pool and then apply precise filtering.
  • has_government: Used inside any_allied_country to filter allies by ideology, commonly seen when evaluating the political landscape of a coalition.
  • is_in_faction: When combined with any_allied_country, helps distinguish between "faction members" and "bilateral allies" — two distinct ally types — preventing logical confusion.
  • has_war_with: Used inside an ally loop to check whether a given ally is at war with a specific country, useful for determining whether a chain of war-entry events should fire.

Common Pitfalls

  1. Assuming it includes the current country: any_allied_country explicitly excludes the country in the current scope. If you also need to evaluate conditions on the country itself, add the relevant trigger separately in the outer scope — you cannot rely on this trigger to cover the current country.
  2. Confusing allies with faction members: This trigger checks bilateral alliance relationships (in the sense of is_ally_with), not faction membership. Countries within the same faction are not necessarily mutual allies. If you want to iterate over faction members, use all_allied_country in combination with is_in_faction, or handle faction logic separately.