Wiki

trigger · any_country_of

Definition

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

Description

Checks if any of the provided countries fulfill the specified triggers.
The `target` supports script constants and `tooltip` supports bindable localization.

### Example

any_country_of = { tooltip = my_loc # Optional bindable localization target = { SWE NOR FIN DEN ICE } has_defensive_war = yes }

any_country_of = { tooltip = my_loc # Optional bindable localization target = constant:country_groups:nordics has_defensive_war = yes }

实战 · 配合 · 坑

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

实战用法

any_country_of 常用于北欧联盟、轴心/同盟国专属事件等需要对一组特定国家做整体判断的场景,例如检查某个阵营内是否有任何一方正在进行防御战,从而触发援助决议。与 any_allied_country 不同,它允许开发者精确指定一个硬编码国家列表或脚本常量,不依赖运行时阵营状态。

# 如果苏联、美国或英国中有任何一国已经宣战,则可用
available = {
    any_country_of = {
        target = { SOV USA ENG }
        has_offensive_war = yes
    }
}

配合关系

  • has_defensive_war — 最典型的搭配,判断指定国家组中是否有任何一国正承受进攻方战争,常用于援助或结盟决策的解锁条件。
  • has_war_with — 与 any_country_of 联用可精确判断指定国家组中是否有某国与另一特定国交战,而非泛泛检查是否有战争。
  • is_in_faction — 通常在 any_country_of 外层或内层搭配使用,用来过滤"列表中加入了某阵营"的国家子集。
  • has_government — 在列出的国家中检查是否至少有一国拥有特定意识形态,常用于意识形态传播或阵营形成的触发判断。

常见坑

  1. target 必须是花括号列表或 constant: 引用,不能直接写单个标签。新手常写成 target = GER 而不是 target = { GER },导致脚本解析报错或静默失败。
  2. 内部的条件块针对的是 target 列表里的每个国家 scope,而非当前 scope。新手常误以为内部的 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

any_country_of is commonly used in scenarios that require an overall check against a specific set of countries — such as Nordic union events, Axis/Allies-exclusive events, or checking whether any member of a given group is currently fighting a defensive war in order to unlock an aid resolution. Unlike any_allied_country, it lets developers explicitly specify a hard-coded country list or a scripted constant, with no dependency on runtime faction state.

# Usable when any one of the Soviet Union, the United States, or the United Kingdom has declared war
available = {
    any_country_of = {
        target = { SOV USA ENG }
        has_offensive_war = yes
    }
}

Synergy

  • has_defensive_war — The most typical pairing: checks whether any country in the specified group is currently on the receiving end of an offensive war. Commonly used as an unlock condition for aid or alliance decisions.
  • has_war_with — Combined with any_country_of, this lets you precisely check whether any country in the specified group is at war with another particular country, rather than broadly checking for the existence of any war.
  • is_in_faction — Often used outside or inside any_country_of to filter down to the subset of listed countries that have joined a particular faction.
  • has_government — Checks whether at least one country in the listed set holds a specific ideology. Frequently used in triggers for ideology spread or faction formation.

Common Pitfalls

  1. target must be a brace-enclosed list or a constant: reference — a bare single tag is not valid. A common beginner mistake is writing target = GER instead of target = { GER }, which causes a script parse error or a silent failure.
  2. The condition block inside evaluates against the scope of each country in the target list, not the current scope. Beginners often assume the inner triggers still execute under the original country scope and write conditions about their own country inside the block — in reality, those conditions are evaluated one by one against each target country, producing entirely different logic.