Wiki

trigger · any_other_country_of

Definition

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

Description

Checks if any of the provided countries (except for the current country) fulfill the specified triggers.
The `target` supports script constants and `tooltip` supports bindable localization.

### Example

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

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

实战 · 配合 · 坑

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

实战用法

any_other_country_of 常用于联盟/阵营事件中,检查指定国家列表里是否有任意其他国家(排除当前 scope 国)满足特定条件,例如判断北欧诸国中是否有任何一国正处于防御战争。也适合用于脚本常量管理的国家组检测,避免写大量重复的 OR 块。

# 当北欧国家组中有任意其他国家(排除自身)处于战争时,本事件选项才可用
country_event = {
    id = nordic.1
    option = {
        name = nordic.1.a
        trigger = {
            any_other_country_of = {
                target = { SWE NOR FIN DEN }
                has_war = yes
            }
        }
        add_war_support = 0.05
    }
}

配合关系

  • has_war — 最典型的搭配,检测目标列表中是否有其他国家已进入战争状态,触发援助或外交事件。
  • has_defensive_war — 与 any_other_country_of 搭配,精确判断列表中是否有国家正在遭受侵略,区别于主动战争。
  • is_in_faction — 用于判断目标列表里是否有其他国家已加入阵营,辅助设计阵营扩张逻辑。
  • has_government — 配合使用可检查列表中是否有其他国家发生了政权变化,适合意识形态扩散类 mod。

常见坑

  1. 忘记"排除自身"的含义:该 trigger 会自动排除当前 scope 的国家,因此把自身也加入 target 列表是无效的——自身永远不会被计入判断,不需要额外写 NOT = { tag = ROOT } 来过滤,但若误以为自身也会被检测则会导致逻辑错误。
  2. target 只接受国家标签列表或 script constant,不能直接写 scope 关键字作为列表内容:例如写成 target = { ALLIES } 是无效的,ALLIES 并非合法国家标签;若需要动态国家集合应使用预先定义好的 constant: 脚本常量,否则条件将静默失败。

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_other_country_of is commonly used in alliance/faction events to check whether any country in a specified list — excluding the current scope country — meets certain conditions, such as determining whether any of the Nordic nations is currently engaged in a defensive war. It is also well-suited for country group checks in script constant management, avoiding the need to write large blocks of repetitive OR conditions.

# This event option is only available when any other country in the Nordic group (excluding self) is at war
country_event = {
    id = nordic.1
    option = {
        name = nordic.1.a
        trigger = {
            any_other_country_of = {
                target = { SWE NOR FIN DEN }
                has_war = yes
            }
        }
        add_war_support = 0.05
    }
}

Synergy

  • has_war — The most typical pairing: checks whether any other country in the target list has entered a state of war, triggering aid or diplomatic events.
  • has_defensive_war — Combined with any_other_country_of, this precisely determines whether any country in the list is currently under attack, as opposed to being the aggressor.
  • is_in_faction — Used to check whether any other country in the target list has already joined a faction, helping to design faction expansion logic.
  • has_government — Pairing these allows you to check whether any other country in the list has undergone a change of government, making it suitable for ideology-spread mods.

Common Pitfalls

  1. Misunderstanding the "excludes self" behavior: This trigger automatically excludes the current scope country, so adding yourself to the target list has no effect — the scope country is never counted in the evaluation. There is no need to manually write NOT = { tag = ROOT } to filter yourself out, but assuming you will be included in the check will lead to logic errors.
  2. target only accepts a list of country tags or script constants — scope keywords cannot be used as list entries: For example, writing target = { ALLIES } is invalid because ALLIES is not a legitimate country tag. If you need a dynamic set of countries, use a pre-defined constant: script constant; otherwise the condition will fail silently.