Wiki

trigger · ai_liberate_desire

Definition

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

Description

check what liberation desire the country has towards a specified country

实战 · 配合 · 坑

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

实战用法

ai_liberate_desire 常用于制作解放战争、傀儡独立相关的 AI 决策脚本中,判断当前国家是否对某个目标国家存在解放意愿,从而决定是否触发相关外交或战争目标逻辑。例如在一个"解放运动"决策的 available 块中,可以用它来限制只有对目标国有足够解放欲望的 AI 才能执行该决策:

available = {
    ai_liberate_desire = {
        target = FROM
        value > 50
    }
}

配合关系

  • [has_defensive_war](/wiki/trigger/has_defensive_war):常结合使用,先判断本国是否处于防御战争状态,再检查解放意愿,避免 AI 在错误战争情境下触发解放逻辑。
  • [create_wargoal](/wiki/effect/create_wargoal):当解放意愿满足条件后,在 effect 块中配合使用,让 AI 对目标国创建解放性战争目标。
  • [any_allied_country](/wiki/trigger/any_allied_country):用于检查同盟中是否有成员对某国有解放意愿,配合 ai_liberate_desire 可实现联合解放的条件判断。
  • [has_country_flag](/wiki/trigger/has_country_flag):配合国家旗帜标记,确保解放意愿触发逻辑只执行一次,防止重复激活。

常见坑

  1. 忘记指定 target 字段ai_liberate_desire 必须明确写出 target(如 FROMROOT 等),省略 target 会导致脚本报错或行为未定义,新手常误以为它和普通数值比较一样可以省略对象。
  2. 在 COUNTRY scope 以外使用:该 trigger 只能在国家 scope 下生效,若不小心写在 STATE 或 UNIT_LEADER 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

ai_liberate_desire is commonly used in AI decision scripts related to liberation wars and puppet independence, to determine whether the current country has liberation intent toward a target nation, thereby deciding whether to trigger related diplomatic or war goal logic. For example, in the available block of a "liberation movement" decision, it can be used to restrict execution to only AI with sufficient liberation desire toward the target:

available = {
    ai_liberate_desire = {
        target = FROM
        value > 50
    }
}

Synergy

  • [has_defensive_war](/wiki/trigger/has_defensive_war): Often used together to first check whether the country is in a defensive war state, then verify liberation intent, preventing the AI from triggering liberation logic in incorrect war scenarios.
  • [create_wargoal](/wiki/effect/create_wargoal): When liberation intent meets conditions, use in conjunction within the effect block to have the AI create a liberation war goal against the target nation.
  • [any_allied_country](/wiki/trigger/any_allied_country): Used to check whether any alliance member has liberation intent toward a nation; combined with ai_liberate_desire, it enables condition checking for joint liberation.
  • [has_country_flag](/wiki/trigger/has_country_flag): Paired with country flag markers to ensure liberation intent trigger logic executes only once, preventing repeated activation.

Common Pitfalls

  1. Forgetting to specify the target field: ai_liberate_desire must explicitly write target (such as FROM, ROOT, etc.); omitting target causes script errors or undefined behavior. Beginners often mistakenly assume it works like ordinary numeric comparisons and can omit the object.
  2. Using outside COUNTRY scope: This trigger only functions under country scope. If accidentally written in STATE or UNIT_LEADER scope condition blocks, the game won't report obvious errors but the condition will never evaluate correctly, making debugging quite obscure.