Wiki

trigger · any_guaranteed_country

Definition

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

Description

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

实战 · 配合 · 坑

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

实战用法

any_guaranteed_country 常用于判断当前国家是否对某一类国家存在保证关系,例如在外交事件或国策中检测"是否保证了任意一个处于战争状态的国家",从而触发相应的外交警告或战争支持度变化。也可用于成就/决策的 available 块,限制只有当玩家正在保证至少一个大国时才能触发某决策。

# 检查当前国家是否保证了任意一个正处于战争中的国家
# 若是,则该决策可用
decision_example = {
    available = {
        any_guaranteed_country = {
            has_war = yes
        }
    }
}
# 在事件触发条件中:当前国家保证的某个国家已被占领首都
trigger = {
    any_guaranteed_country = {
        has_capitulated = yes
    }
}

配合关系

  • has_guaranteedhas_guaranteed 检查当前 scope 是否被某一特定国家保证,与 any_guaranteed_country(检查我保证的国家)方向相反,两者配合可双向验证保证链关系。
  • has_war:在 any_guaranteed_country 的子块中使用,判断被保证国是否已陷入战争,是触发保证履行逻辑最常见的内层条件。
  • is_subject_of:配合使用可排除附属国,确保保证逻辑只针对独立主权国家。
  • give_guarantee:与之配合用于 effect 侧,在事件或国策中主动给予保证,而 any_guaranteed_country 在 trigger 侧验证保证是否已经存在。

常见坑

  1. 作用域方向搞反any_guaranteed_country 遍历的是"当前 scope 国家所保证的国家",而非"保证了当前国家的国家"。若要检查"谁保证了我",应改用 [is_guaranteed_by](/wiki/trigger/is_guaranteed_by),两者新手极易混淆。
  2. 在非 COUNTRY scope 下使用:该 trigger 仅在 COUNTRY scope 下有效,若误用在 STATE scope(如 any_owned_state 的子块内部)而未切换回国家 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

any_guaranteed_country is commonly used to check whether the current country has a guarantee relationship with any country of a given type — for example, in diplomatic events or national focuses, detecting whether the country "has guaranteed at least one nation currently at war," which can then trigger diplomatic warnings or changes to war support. It can also be used in the available block of achievements or decisions to restrict a decision so that it only fires when the player is actively guaranteeing at least one major power.

# Check whether the current country has guaranteed any country that is currently at war
# If so, this decision becomes available
decision_example = {
    available = {
        any_guaranteed_country = {
            has_war = yes
        }
    }
}
# In an event trigger condition: a country guaranteed by the current country has had its capital occupied
trigger = {
    any_guaranteed_country = {
        has_capitulated = yes
    }
}

Synergy

  • has_guaranteed: has_guaranteed checks whether the current scope is guaranteed by a specific country — the opposite direction from any_guaranteed_country (which checks countries I am guaranteeing). Used together, they allow bidirectional verification of guarantee chain relationships.
  • has_war: Used inside the sub-scope of any_guaranteed_country to check whether a guaranteed country has already entered a war. This is the most common inner condition for implementing guarantee-fulfillment logic.
  • is_subject_of: Can be combined to exclude subjects, ensuring that guarantee logic only applies to independent sovereign nations.
  • give_guarantee: Works in tandem on the effect side — used in events or national focuses to actively grant a guarantee — while any_guaranteed_country handles the trigger side to verify whether a guarantee already exists.

Common Pitfalls

  1. Scope direction reversed: any_guaranteed_country iterates over "countries that the current scope country is guaranteeing," not "countries that are guaranteeing the current country." If you need to check "who is guaranteeing me," use is_guaranteed_by instead. This distinction trips up new modders very easily.
  2. Used outside a COUNTRY scope: This trigger is only valid within a COUNTRY scope. If it is mistakenly used inside a STATE scope — for instance, nested within an any_owned_state block — without switching back to a country scope first, the script will either silently error out or return false, making the bug very difficult to track down during debugging.