Wiki

effect · every_possible_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.
Difference with every_country is that it includes countries not yet present on the map.
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_possible_country = {
	tooltip = my_loc_key # Optional
	random_select_amount = 3 # Optional
	display_individual_scopes = yes # Optional - default = no
	... country scope effects ...
}

实战 · 配合 · 坑

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

实战用法

every_possible_country 常用于需要对所有潜在国家(包括尚未生成到地图上的国家)批量施加效果的场景,例如全局事件、科技扩散、或在特定条件下给予每个国家某种思潮加成。与 every_country 的关键区别在于它能覆盖未出现的国家,适合 mod 中重置全局状态或广播外交关系。

# 示例:向所有存在且处于战争中的国家添加一个 idea
every_possible_country = {
    limit = {
        exists = yes
        has_war = yes
    }
    add_ideas = war_economy_boost
}

配合关系

  • exists — 通常在 limit 中搭配使用,过滤掉尚未实际出现在地图上的国家,避免对幽灵国家执行无意义操作。
  • has_government — 在 limit 中按政体筛选目标国家,实现只对特定意识形态的所有国家批量施加效果。
  • set_country_flag — 配合 every_possible_country 批量打标记,用于后续事件触发条件的检测。
  • add_stability — 常见的批量施加效果命令,用于全局稳定度调整类事件或 mod 脚本初始化。

常见坑

  1. 忘记加 limit = { exists = yes }:不加限制时该命令会遍历游戏内所有可能存在的国家标签(包括从未出现的),在大型 mod 中极易造成严重性能卡顿甚至崩溃,务必根据需求添加 exists = yes 等过滤条件。
  2. every_country 混用场景搞错:若你的逻辑只需要处理当前已在地图上的国家,应优先使用 every_country 而非此命令;every_possible_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

every_possible_country is typically used when you need to apply effects to all potential countries in bulk — including those that have not yet been spawned on the map — such as in global events, technology diffusion, or granting every country an ideology modifier under certain conditions. The key distinction from every_country is that it covers countries that have not yet appeared, making it well-suited for resetting global state or broadcasting diplomatic relationships across a mod.

# Example: add an idea to all existing countries that are at war
every_possible_country = {
    limit = {
        exists = yes
        has_war = yes
    }
    add_ideas = war_economy_boost
}

Synergy

  • exists — Typically paired inside a limit block to filter out countries that have not yet actually appeared on the map, preventing meaningless operations from being applied to ghost countries.
  • has_government — Used inside limit to filter target countries by government type, allowing bulk effects to be applied only to countries of a specific ideology.
  • set_country_flag — Combine with every_possible_country to set flags in bulk, which can then be checked as conditions in subsequent event triggers.
  • add_stability — A commonly used bulk effect command, often seen in global stability adjustment events or mod script initialization.

Common Pitfalls

  1. Forgetting to add limit = { exists = yes }: Without a limiting condition, this command iterates over every country tag that could possibly exist in the game — including ones that never appear. In large mods this can easily cause severe performance stutters or even crashes. Always add filter conditions such as exists = yes as appropriate.
  2. Confusing the use cases of every_possible_country and every_country: If your logic only needs to handle countries currently present on the map, prefer every_country over this command. The extra iteration overhead of every_possible_country is pure waste when you have no need to cover countries that have not yet spawned.