Wiki

trigger · has_annex_war_goal

Definition

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

Description

Checks a country has annex war goal on another country

实战 · 配合 · 坑

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

实战用法

has_annex_war_goal 常用于判断某国是否已对目标国持有吞并战争目标,从而触发相关事件、决策或 AI 策略调整。例如在国家事件中,当玩家发现自己被强国盯上时弹出警告,或在决策的 available 块中限制只有被针对时才能寻求外援。

# 某国被大国列为吞并目标时,允许激活"紧急动员"决策
available = {
    any_enemy_country = {
        has_annex_war_goal = ROOT
    }
}

配合关系

  • [any_enemy_country](/wiki/trigger/any_enemy_country):遍历所有敌国,配合 has_annex_war_goal 检测是否有任意敌国持有对本国的吞并目标,是最常见的组合模式。
  • [has_defensive_war](/wiki/trigger/has_defensive_war):通常同时检查是否处于防御战状态,确认吞并威胁已落地为实际战争。
  • [create_wargoal](/wiki/effect/create_wargoal):当检测到对方持有吞并目标后,可用此 effect 反向为本国创建对等战争目标,实现"以牙还牙"的脚本逻辑。
  • [add_ideas](/wiki/effect/add_ideas):在确认被吞并威胁后,给予国家特定的"背水一战"类国策 idea,增强代入感。

常见坑

  1. scope 混淆has_annex_war_goal 的主体是"持有战争目标的国家",target 是"被针对的国家"——新手容易把两者颠倒,写成在被威胁国的 scope 下直接调用,实际上需要先进入发动吞并的那一方 scope 才能正确判断。
  2. 战争目标尚未创建即判断:在战争宣布前通过 declare_war_on 触发的战争,战争目标的注册时序与事件触发顺序可能存在一帧延迟,导致紧跟在宣战 effect 之后的 trigger 判断返回假,应将相关检查放在独立事件或 on_action 回调中。

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

has_annex_war_goal is commonly used to determine whether a country currently holds an annexation war goal against a target nation, enabling you to trigger related events, decisions, or AI strategy adjustments. For example, you might display a warning event when the player discovers they've been targeted by a major power, or restrict a decision's available block so that seeking foreign aid is only permitted when under such threat.

# Allow activation of the "Emergency Mobilization" decision when this country is marked for annexation by a major power
available = {
    any_enemy_country = {
        has_annex_war_goal = ROOT
    }
}

Synergy

  • [any_enemy_country](/wiki/trigger/any_enemy_country): Iterates through all enemy countries; combined with has_annex_war_goal, it checks whether any enemy holds an annexation goal against your nation—the most common usage pattern.
  • [has_defensive_war](/wiki/trigger/has_defensive_war): Often checked simultaneously to verify that you are in a defensive war state, confirming that the annexation threat has materialized into actual combat.
  • [create_wargoal](/wiki/effect/create_wargoal): After detecting that an opponent holds an annexation goal against you, use this effect to create a reciprocal war goal for your nation, enabling a "tit-for-tat" scripting logic.
  • [add_ideas](/wiki/effect/add_ideas): Once you confirm the annexation threat, grant your nation a specific "fight to the last" type national idea to enhance immersion.

Common Pitfalls

  1. Scope confusion: The subject of has_annex_war_goal is "the country holding the war goal," while the target is "the country being targeted"—beginners often reverse these, calling the trigger directly under the threatened nation's scope when they actually need to first enter the scope of the nation issuing the annexation to judge correctly.
  2. Checking before war goal is created: Wars declared via declare_war_on may experience a one-frame delay between war goal registration timing and event trigger order, causing a trigger check immediately following the declare war effect to return false. Move such checks into separate events or on_action callbacks instead.