Wiki

effect · every_country

Definition

  • Supported scope:any
  • Supported target:none

Description

Executes children effects on every Country (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:
every_country = {
	tooltip = my_loc_key # Optional
	random_select_amount = 3 # Optional
	display_individual_scopes = yes # Optional - default = no
	... country scope effects ...
}

实战 · 配合 · 坑

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

实战用法

every_country 常用于事件或国策效果中,对所有满足条件的国家批量执行操作,例如在一个阵营解散时让所有成员国都失去某个 idea,或者在全球事件触发时给多个国家同步施加战争支持度变化。

# 示例:对所有处于战争且不是玩家国的国家添加一个威胁值
every_country = {
    limit = {
        has_war = yes
        is_ai = yes
        has_war_support > 0.5
    }
    add_named_threat = {
        threat = 1
        name = global_war_escalation
    }
    add_war_support = -0.05
}

配合关系

  • has_war:作为 limit 内的筛选条件,只对正在交战的国家执行效果,避免误操作和平国家。
  • has_government:在 limit 中按政府类型过滤目标国,常用于意识形态扩散类 mod 场景。
  • add_ideas:对筛选出的所有国家批量添加国家理念,是 every_country 最高频的子效果之一。
  • set_country_flag:给每个匹配国家打上标记,供后续事件或触发器追踪已处理的国家列表。

常见坑

  1. 忘记 limit 导致效果作用于所有存在的国家:不加 limitevery_country 会遍历游戏中全部国家(包括已亡国但存在 tag 的国家),性能开销大且容易产生意外副作用,建议始终用 limit = { exists = yes } 作为最基础的过滤。
  2. 误以为 scope 自动切换every_country 内部 scope 已经是被迭代的那个国家,直接写子效果即可;新手容易在里面再套 ROOT / THIS 来引用当前国家却搞混指向,需要引用触发国时应明确使用 ROOT = { ... } 包裹相应效果。

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_country is commonly used in event or focus effects to batch-apply operations to all countries that meet certain conditions — for example, stripping a shared idea from every member when a faction dissolves, or simultaneously applying war support changes to multiple countries when a global event fires.

# Example: add threat to every country that is at war, is AI-controlled, and has war support above 50%
every_country = {
    limit = {
        has_war = yes
        is_ai = yes
        has_war_support > 0.5
    }
    add_named_threat = {
        threat = 1
        name = global_war_escalation
    }
    add_war_support = -0.05
}

Synergy

  • has_war: Used as a filter inside limit to restrict effects to countries currently at war, preventing unintended changes to peaceful nations.
  • has_government: Filters target countries by government type inside limit; commonly used in ideology-spread mod scenarios.
  • add_ideas: Batch-adds national ideas to all matched countries — one of the most frequently used child effects inside every_country.
  • set_country_flag: Stamps a flag on each matched country so that subsequent events or triggers can track which countries have already been processed.

Common Pitfalls

  1. Forgetting limit, causing the effect to apply to every country in the game: Without a limit, every_country iterates over all countries — including those that have been defeated but still have an existing tag — resulting in significant performance overhead and potential unintended side effects. It is strongly recommended to always include limit = { exists = yes } as a bare-minimum filter.
  2. Assuming the scope switches automatically: Inside every_country, the scope is already the country being iterated; you can write child effects directly against it. A common beginner mistake is nesting ROOT or THIS references inside the loop and getting confused about what they point to. When you genuinely need to reference the initiating country, explicitly wrap the relevant effects in ROOT = { ... }.