Wiki

trigger · all_country

Definition

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

Description

check if all countries meets the trigger. tooltip=key can be defined to override title

实战 · 配合 · 坑

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

实战用法

all_country 常用于需要检查所有国家都满足某一条件才触发的全局事件或决议,例如验证所有主要国家是否已签署停火、所有派系成员是否处于战争状态等场景。它在 availabletrigger 块中充当全局性门控条件,避免玩家或 AI 在条件不成熟时提前触发关键剧情节点。

# 示例:只有当世界上所有国家都不处于战争状态时,该决议才可用
available = {
    all_country = {
        NOT = { has_war = yes }
    }
}
# 示例:检查所有国家都持有某个 idea(如世界和平协定)时触发事件
trigger = {
    all_country = {
        has_idea = world_peace_accord
    }
}

配合关系

  • any_enemy_countryall_country 检查全体是否满足条件,any_enemy_country 检查是否存在至少一个敌国满足条件,两者语义互补,常用于构建"全部/至少一个"的逻辑组合。
  • has_warall_country 最常见的内部判断之一,用来检查是否所有国家都处于或脱离战争状态,是全局和平/战争条件判断的核心搭配。
  • has_government:在联盟或意识形态扩散场景中,配合 all_country 检查所有国家是否完成了政体统一,常见于意识形态胜利条件的编写。
  • is_in_faction:用于派系相关判断,搭配 all_country 可以检查是否所有国家都已加入某一派系,常用于派系霸权成就触发条件。

常见坑

  1. 作用域混淆all_country 的内部 scope 会切换到被遍历的每一个国家,新手容易在内部继续使用 ROOT 以为指向当前国家,但实际上应当用 ROOT 引用脚本原始国家、而用不带前缀的命令引用被遍历国家——需要明确区分,否则条件逻辑会静默地判断错误对象。
  2. 性能与范围误判all_country 会遍历游戏中所有存在的国家(包括微小国家和傀儡),在复杂 trigger 中频繁调用会带来不必要的性能开销;若只需检查特定范围(如派系成员),应优先考虑更精确的遍历 trigger 而非用 all_country 加大量 limit 过滤。

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

all_country is commonly used in global events or decisions that should only fire when every country meets a given condition — for example, verifying that all major countries have signed a ceasefire, or that all faction members are at war. Inside an available or trigger block it acts as a global gate, preventing players or the AI from triggering critical story nodes before the conditions are truly met.

# Example: the decision is only available when no country in the world is at war
available = {
    all_country = {
        NOT = { has_war = yes }
    }
}
# Example: fire an event only when every country holds a specific idea (e.g. world_peace_accord)
trigger = {
    all_country = {
        has_idea = world_peace_accord
    }
}

Synergy

  • any_enemy_country: all_country checks whether all countries satisfy a condition, while any_enemy_country checks whether at least one enemy country does. The two are semantically complementary and are often combined to build "all / at least one" logic.
  • has_war: One of the most common inner checks used with all_country. It determines whether every country is in — or out of — a war, making it the go-to pairing for global peace/war condition checks.
  • has_government: In alliance or ideology-spread scenarios, pair this with all_country to verify that every country has unified under a single government type. Frequently seen when scripting ideology-victory conditions.
  • is_in_faction: Used for faction-related checks. Combined with all_country, it can verify that every country has joined a particular faction — a common requirement for faction-hegemony achievement triggers.

Common Pitfalls

  1. Scope confusion: Inside all_country the scope shifts to each country being iterated. Beginners often assume ROOT still refers to the "current" country in the usual sense, but ROOT actually points to the original scripting country, while unqualified commands refer to the country currently being iterated. Failing to keep this distinction straight causes condition logic to silently evaluate the wrong target.
  2. Performance and scope over-reach: all_country iterates over every country that exists in the game, including minor nations and puppets. Calling it frequently inside complex triggers introduces unnecessary performance overhead. If you only need to check a specific subset of countries (such as faction members), prefer a more targeted iteration trigger rather than using all_country with heavy limit filtering.