Wiki

effect · every_enemy_country

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Executes children effects on every enemy Country of the country in scope (or \"random_select_amount\" of random country if specified) that fulfills the \"limit\" trigger.
tooltip=key can be added to override tooltip title.
By default the effects are only displayed once, you may display them for each matching country with display_individual_scopes.
ex:
SOV = {
	every_enemy_country = {
		tooltip = my_loc_key # Optional
		random_select_amount = 3 # Optional
		display_individual_scopes = yes # Optional - default = no
		... country scope effects ...
	}
}

实战 · 配合 · 坑

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

实战用法

every_enemy_country 常用于战争相关的 mod 事件中,例如某国触发核威慑或战略轰炸时,对所有交战国同步施加惩罚(如降低战争支持度、施加 idea 等)。也适合在胜利条件脚本里对所有敌国批量执行白和平或移除战争目标。

GER = {
    every_enemy_country = {
        limit = {
            has_war_support < 0.3
            is_major = no
        }
        add_war_support = -0.05
        add_ideas = demoralized_nation  # idea 需在 ideas 文件中预先定义
    }
}

配合关系

  • any_enemy_country:先用 any_enemy_country 做条件检测,确认存在满足条件的敌国后,再用 every_enemy_country 批量执行效果,避免无效触发。
  • white_peace:在战争结束事件中配合使用,对每一个敌国分别执行白和平。
  • set_country_flag:对每个敌国打上标记,供后续事件或决策用 has_country_flag 过滤。
  • has_war_with:在 limit 块内搭配使用,精确筛选当前仍处于交战状态的目标国,防止作用于已停战的前敌国。

常见坑

  1. scope 指向错误every_enemy_country 的"敌国"判定基于 scope 内的国家,而非书写该 effect 的文件所属国。若在一个事件的 option 里直接写而未显式切换 scope(如 GER = { ... }),敌国集合来自事件的 FROMROOT,与预期不符时需用 ROOT = { every_enemy_country = { ... } } 明确指定。
  2. limit 内误用 effect 命令:新手有时把 add_war_supportadd_ideas 等 effect 命令写进 limit = { } 块,导致脚本报错或静默失效;limit 内只能使用 trigger(如 has_waris_majorhas_idea 等)。

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

every_enemy_country is commonly used in war-related mod events — for example, when a country triggers nuclear deterrence or strategic bombing, applying penalties (such as reduced war support or adding ideas) to all belligerents simultaneously. It is also well-suited for victory condition scripts that need to bulk-apply white peace or strip war goals from every enemy country at once.

GER = {
    every_enemy_country = {
        limit = {
            has_war_support < 0.3
            is_major = no
        }
        add_war_support = -0.05
        add_ideas = demoralized_nation  # idea must be defined in the ideas file beforehand
    }
}

Synergy

  • any_enemy_country: Use any_enemy_country first as a condition check to confirm that at least one qualifying enemy exists, then use every_enemy_country to apply effects in bulk — this avoids unnecessary triggers firing on an empty set.
  • white_peace: Pair with this in war-ending events to execute white peace against each enemy country individually.
  • set_country_flag: Stamp a flag on each enemy country so that subsequent events or decisions can filter by has_country_flag.
  • has_war_with: Use inside a limit block to precisely target countries that are still actively at war, preventing the effect from applying to former enemies whose wars have already ended.

Common Pitfalls

  1. Wrong scope target: The "enemy countries" resolved by every_enemy_country are determined relative to the country in the current scope, not the country that owns the file where the effect is written. If you write it directly inside an event option without explicitly switching scope (e.g. GER = { ... }), the enemy set is derived from the event's FROM or ROOT. When that does not match your intent, use ROOT = { every_enemy_country = { ... } } to make the scope explicit.
  2. Using effect commands inside limit: Beginners sometimes write effect commands such as add_war_support or add_ideas inside a limit = { } block, causing script errors or silent failures. The limit block only accepts triggers (e.g. has_war, is_major, has_idea); effects are never valid there.