Wiki

trigger · all_guaranteed_country

Definition

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

Description

check if every country with current scoped country guarantees. Example:
all_country_with_original_tag = { 
  # ... triggers to check 
}

实战 · 配合 · 坑

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

实战用法

all_guaranteed_country 常用于检查当前国家是否保证了所有特定条件的国家,例如在事件或决策中验证"我所有的被保证国都已加入阵营"或"所有被保证国都存在"时触发后续逻辑。典型场景是大国外交 mod 中,当玩家履行了对所有小国的保证义务时解锁特殊决策。

# 检查当前国家保证的每一个国家是否都已存在且未被占领
activate_decision = {
    decision = my_special_decision
    available = {
        all_guaranteed_country = {
            exists = yes
            has_war = no
        }
    }
}

配合关系

  • is_guaranteed_by:反向视角检查,all_guaranteed_country 从保证方遍历被保证国,is_guaranteed_by 则在被保证国 scope 内确认保证关系,二者常配合做双向验证。
  • has_war:在 all_guaranteed_country 块内判断被保证国是否处于战争状态,用于检测保证链是否面临触发风险。
  • exists:在遍历被保证国时最常用的基础检查,防止脚本对已亡国的标签求值报错。
  • give_guarantee:在 effect 块中配合使用,当 trigger 检查通过后向目标补发保证,形成"检查→补全"的外交逻辑闭环。

常见坑

  1. scope 方向混淆all_guaranteed_country 遍历的是"当前 scope 国家所保证的国家",而非"保证当前国家的国家",新手常将其与 is_guaranteed_by 的语义搞反,导致条件永远为假或意外为真。
  2. 空集陷阱:若当前国家没有保证任何国家,all_guaranteed_country 会对空集返回 true(全称命题对空集成立),新手误以为此时条件应为假,从而写出逻辑相反的判断;应先用 any_* 系列确认至少存在一个被保证国,再用 all_guaranteed_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

all_guaranteed_country is commonly used to check whether every country that the current country has guaranteed meets certain conditions — for example, verifying in an event or decision that "all of my guaranteed countries have joined the faction" or "all guaranteed countries still exist" before triggering follow-up logic. A typical use case in diplomacy-focused mods is unlocking a special decision once the player has fulfilled their guarantee obligations to all smaller nations.

# Check that every country currently guaranteed by this country exists and is not at war
activate_decision = {
    decision = my_special_decision
    available = {
        all_guaranteed_country = {
            exists = yes
            has_war = no
        }
    }
}

Synergy

  • is_guaranteed_by: The reverse-perspective check. While all_guaranteed_country iterates over guaranteed countries from the guarantor's scope, is_guaranteed_by confirms the guarantee relationship from within the guaranteed country's scope. The two are often paired for bidirectional validation.
  • has_war: Used inside an all_guaranteed_country block to check whether any guaranteed country is at war, helping detect whether the guarantee chain is at risk of being triggered.
  • exists: The most fundamental check when iterating over guaranteed countries — prevents the script from evaluating tags that no longer exist (i.e., already-annexed nations) and causing errors.
  • give_guarantee: Used in an effect block after the trigger check passes to issue a guarantee to a target country, completing a "check → fill in the gap" diplomatic logic loop.

Common Pitfalls

  1. Scope direction confusion: all_guaranteed_country iterates over the countries guaranteed by the current scope country, not the countries that guarantee the current country. Beginners frequently mix up its semantics with is_guaranteed_by, resulting in conditions that are always false or unexpectedly true.
  2. Empty-set trap: If the current country has not guaranteed any other country, all_guaranteed_country returns true over the empty set (a universal quantifier over an empty set is vacuously true). Beginners often assume the condition should be false in this case and end up writing inverted logic. The correct approach is to first use an any_* variant to confirm that at least one guaranteed country exists, then use all_guaranteed_country to perform the full check.