Wiki

trigger · is_guaranteed_by

Definition

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

Description

check if guaranteed by specified country

实战 · 配合 · 坑

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

实战用法

is_guaranteed_by 常用于判断某国是否受到指定国家的保障独立,从而触发外交事件或阻止特定战争目标的生成。例如在小国剧本中,当玩家试图吞并某国时,可以先检查其是否受大国保障,以决定是否弹出警告事件或修改 AI 决策逻辑。

# 检查当前国家是否受德国保障,若是则触发外交警告事件
trigger = {
    is_guaranteed_by = GER
}

配合关系

  • [any_guaranteed_country](/wiki/trigger/any_guaranteed_country):可遍历所有被本国保障的国家,与 is_guaranteed_by 形成"保障关系"的双向查询——一个查"谁保障了我",一个查"我保障了谁"。
  • [has_defensive_war_with](/wiki/trigger/has_defensive_war_with):保障触发的连锁参战往往带来防御战,配合此 trigger 可进一步判断保障国是否已实际介入战争。
  • [can_declare_war_on](/wiki/trigger/can_declare_war_on):在宣战条件块中搭配使用,当目标国受大国保障时禁止或限制 AI 发动进攻,避免触发不合理的连锁战争。
  • [give_guarantee](/wiki/effect/give_guarantee):在 effect 侧建立保障关系后,常在后续 trigger 块用 is_guaranteed_by 验证保障是否已成功建立,形成"写入—校验"闭环。

常见坑

  1. scope 混淆is_guaranteed_by 的 scope 必须是被保障的国家,新手容易在州(state)scope 或角色(character)scope 下调用,导致脚本报错或静默失败。检查前务必确认当前 scope 已切换到目标国家。
  2. 单向性误解:此 trigger 只检查"当前 scope 国家是否被指定国保障",而非双向关系;若想检查"我是否保障了别人",需切换 scope 或改用 any_guaranteed_country / 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

is_guaranteed_by is commonly used to check whether a nation is protected by a guarantee from a specified country, enabling the triggering of diplomatic events or preventing the generation of certain war goals. For example, in a minor nation scenario, when a player attempts to annex another country, you can first check whether it is guaranteed by a major power to decide whether to display a warning event or modify AI decision logic.

# Check if the current nation is guaranteed by Germany; if so, trigger a diplomatic warning event
trigger = {
    is_guaranteed_by = GER
}

Synergy

  • [any_guaranteed_country](/wiki/trigger/any_guaranteed_country): Iterates through all countries guaranteed by this nation, forming a bidirectional query relationship with is_guaranteed_by — one checks "who guarantees me," the other checks "whom do I guarantee."
  • [has_defensive_war_with](/wiki/trigger/has_defensive_war_with): The chain participation triggered by a guarantee often results in defensive wars; combine with this trigger to further check whether the guarantor has actually entered the war.
  • [can_declare_war_on](/wiki/trigger/can_declare_war_on): Use alongside war declaration condition blocks; when the target nation is guaranteed by a major power, restrict or prevent AI from launching attacks, avoiding unreasonable chain wars.
  • [give_guarantee](/wiki/effect/give_guarantee): After establishing a guarantee relationship in the effect block, commonly use is_guaranteed_by in subsequent trigger blocks to verify whether the guarantee has been successfully established, forming a "write-and-verify" loop.

Common Pitfalls

  1. Scope Confusion: The scope of is_guaranteed_by must be the guaranteed nation; beginners often call it under state scope or character scope, leading to script errors or silent failures. Always confirm the current scope has switched to the target nation before checking.
  2. Unidirectional Misunderstanding: This trigger only checks "whether the current scope nation is guaranteed by the specified nation," not a bidirectional relationship; if you want to check "whether I guarantee someone else," you need to switch scope or use any_guaranteed_country / all_guaranteed_country instead.