Wiki

trigger · any_enemy_country

Definition

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

Description

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

实战 · 配合 · 坑

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

实战用法

any_enemy_country 常用于检测当前国家是否正在与某类特定敌国交战,例如判断敌人中是否有大国或拥有某意识形态的国家,从而触发决策或事件。也常见于联盟/派系 mod 中,根据交战对象的状态动态解锁特殊选项。

# 检测是否有任何敌国是法西斯大国,满足则允许某决策
available = {
    any_enemy_country = {
        has_government = fascism
        is_major = yes
    }
}

配合关系

  • has_war_with — 与 any_enemy_country 互补:前者用于检测与指定国家是否交战,后者用于检测任意敌国是否满足条件,两者结合可精细控制条件范围。
  • has_war — 通常作为 any_enemy_country 的前置守卫判断,先确认本国处于战争状态再检测敌国属性,避免在和平时期产生意外结果。
  • is_major — 在 any_enemy_country 内部使用,用于筛选敌国中的大国,常用于战略决策的解锁条件。
  • has_government — 在 any_enemy_country 内部使用,按意识形态筛选敌国,是意识形态对抗类 mod 的核心搭配。

常见坑

  1. scope 方向混淆any_enemy_country 的 scope 是 COUNTRY,内部子块自动切换到被遍历的敌国 scope,若在子块内仍写针对原国家的条件(如检测己方科技),需要用 ROOTPREV 显式引用,否则会错误地检测敌国自身。
  2. all_enemy_country 语义混淆any_enemy_country 只要有一个敌国满足即返回真,而 all_enemy_country 要求所有敌国都满足才返回真;新手常将两者写反,导致条件过严或过松而行为异常。

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_enemy_country is commonly used to check whether the current country is at war with a specific type of enemy — for example, whether any enemy is a major power or follows a particular ideology — in order to trigger decisions or events. It also appears frequently in alliance/faction mods to dynamically unlock special options based on the state of current enemies.

# Check if any enemy country is a fascist major power; if so, make a decision available
available = {
    any_enemy_country = {
        has_government = fascism
        is_major = yes
    }
}

Synergy

  • has_war_with — Complements any_enemy_country: the former checks whether the country is at war with a specific nation, while the latter checks whether any enemy meets a condition. Combining the two allows for fine-grained control over trigger scope.
  • has_war — Typically used as a prerequisite guard before any_enemy_country, confirming that the country is actually at war before evaluating enemy properties, which prevents unexpected results during peacetime.
  • is_major — Used inside any_enemy_country to filter for major powers among enemies; a common unlock condition for high-level strategic decisions.
  • has_government — Used inside any_enemy_country to filter enemies by ideology; a core pairing in ideology-conflict mods.

Common Pitfalls

  1. Scope direction confusion: any_enemy_country operates in the COUNTRY scope, and the inner block automatically switches to the scope of each iterated enemy country. If you need to reference conditions on the original country inside the block (e.g., checking your own technology), you must explicitly use ROOT or PREV — otherwise the check will incorrectly evaluate against the enemy country itself.
  2. Confusing any_enemy_country with all_enemy_country: any_enemy_country returns true as long as at least one enemy satisfies the condition, whereas all_enemy_country requires every enemy to satisfy it. Beginners often mix the two up, resulting in conditions that are either far too strict or far too loose, causing unexpected behavior.