Wiki

trigger · all_allied_country

Definition

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

Description

Check if all allied countries meet the trigger. Does not include the country itself. tooltip=key can be defined to override title

实战 · 配合 · 坑

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

实战用法

all_allied_country 适合在事件或决议的 trigger 块中检验"所有盟友是否同时满足某个条件",例如确认联盟内所有成员都已完成某项科技或稳定度达标后才触发特殊奖励。也常用于和平协议或外交事件的 available 条件,确保所有盟友都不处于战争状态才允许执行。

# 当所有盟友都不处于战争且稳定度在基准以上时,触发外交事件
country_event = {
    id = my_mod.1
    trigger = {
        all_allied_country = {
            NOT = { has_war = yes }
            has_stability > 0.5
        }
    }
}

配合关系

  • any_allied_countryall_allied_country 要求所有盟友满足条件,而 any_allied_country 只需至少一个满足,两者常对比使用来区分"全体达标"与"存在达标"两种逻辑分支。
  • is_ally_with:在外层先用 is_ally_with 确认与特定国家的盟友关系存在,再用 all_allied_country 对整个盟友集合做批量检查,逻辑更严谨。
  • has_war:最常见的内层条件,用来检测盟友群体中是否全员处于(或全员不处于)战争状态,是 all_allied_country 最高频的搭配。
  • has_stability:配合稳定度检查,常用于判断整个同盟阵营的"集体状态"是否健康,是外交类事件触发条件的典型组合。

常见坑

  1. 误以为包含本国自身all_allied_country 只遍历盟友,不包括使用该 trigger 的国家本身。若需要同时约束本国,必须在同一 trigger 块内额外单独写对应条件,否则本国状态不会被校验。
  2. 在 scope 不是 COUNTRY 时使用:该 trigger 仅支持 COUNTRY scope,若在 state、province 等 scope 下调用会静默失效或报错,需确保外层 scope 已通过 OWNERCONTROLLER 等切换到国家 scope 后再使用。

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_allied_country is well-suited for use inside trigger blocks in events or decisions when you need to verify that every ally simultaneously meets a given condition — for example, confirming that all alliance members have researched a specific technology or reached a stability threshold before granting a special reward. It is also commonly used in available conditions for peace-deal or diplomatic events to ensure that no ally is currently at war before the effect is allowed to fire.

# Fire a diplomatic event only when all allies are not at war and have stability above the baseline
country_event = {
    id = my_mod.1
    trigger = {
        all_allied_country = {
            NOT = { has_war = yes }
            has_stability > 0.5
        }
    }
}

Synergy

  • any_allied_country: all_allied_country requires every ally to satisfy the condition, whereas any_allied_country requires only at least one. The two are frequently used side by side to distinguish between "all qualify" and "at least one qualifies" logic branches.
  • is_ally_with: Use is_ally_with in the outer scope first to confirm that an alliance relationship with a specific country actually exists, then use all_allied_country to run a bulk check across the entire ally set — this makes the logic more airtight.
  • has_war: The most common inner condition. It checks whether every member of the ally group is (or is not) at war, making it the single most frequent pairing with all_allied_country.
  • has_stability: Paired with a stability check, this combination is typically used to assess whether an entire alliance bloc is in a "collectively healthy" state, and is a classic trigger condition for diplomatic events.

Common Pitfalls

  1. Assuming the trigger includes the country itself: all_allied_country iterates over allies only — it does not include the country that owns the trigger. If you also need to constrain the executing country, you must write the corresponding conditions separately in the same trigger block; otherwise the executing country's state will never be evaluated.
  2. Using the trigger outside a COUNTRY scope: This trigger is only valid in a COUNTRY scope. Calling it from a state, province, or any other scope will cause it to silently fail or throw an error. Make sure the outer scope has already been switched to a country scope via OWNER, CONTROLLER, or a similar accessor before using this trigger.