Wiki

trigger · unit_strength

Definition

  • Supported scope:(none)
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

Check scope unit strength status 0-1: Example unit_strength < 1

实战 · 配合 · 坑

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

实战用法

unit_strength 常用于判断某省份或地块上的部队是否已被削弱到特定阈值,从而触发事件、解锁决策或改变 AI 行为。例如在入侵事件链中,当占领区守军强度低于满编的一定比例时,才允许触发后续决策:

available = {
    unit_strength < 0.3
}

上例表示:只有当当前 scope 内的部队强度不足 30% 时,该决策才可用。

配合关系

由于当前白名单中无可引用的 effect 或 trigger 命令,暂无可列出的交叉引用项。建议在实际 mod 中结合省份、国家 scope 切换命令一同使用,以确保 scope 指向正确的检测目标。

常见坑

  1. scope 指向错误unit_strength 的 scope 列表为空(即不限定于特定 scope 类型),但实际使用时必须确保当前 scope 是一个有意义的省份或地块,否则条件将始终返回假或报错,新手容易忘记用 CONTROLLER/OWNER 等目标切换到正确的 scope 再做判断。
  2. 阈值理解偏差:数值范围是 0 到 1(0 代表无兵力,1 代表满编),新手有时误填大于 1 的数值(如 unit_strength < 50),导致条件逻辑永远为真或产生非预期结果。

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

unit_strength is commonly used to determine whether units in a given province or state have been weakened below a specific threshold, thereby triggering events, unlocking decisions, or altering AI behavior. For example, in an invasion event chain, subsequent decisions may only be triggered when the garrison strength of occupied territory falls below a certain percentage of full strength:

available = {
    unit_strength < 0.3
}

The above example indicates that the decision is only available when the unit strength within the current scope is less than 30%.

Synergy

Since there are currently no referential effects or trigger commands in the whitelist, there are no cross-reference items to list. It is recommended to combine this with province and country scope-switching commands in actual mods to ensure the scope points to the correct detection target.

Common Pitfalls

  1. Incorrect scope targeting: unit_strength has an empty scope list (meaning it is not restricted to a specific scope type), but in actual usage you must ensure the current scope is a meaningful province or state, otherwise the condition will always return false or produce an error. Beginners often forget to use CONTROLLER/OWNER and similar target-switching commands to switch to the correct scope before making the check.
  2. Threshold value misunderstanding: The numeric range is 0 to 1 (0 represents no troops, 1 represents full strength). Beginners sometimes mistakenly enter values greater than 1 (such as unit_strength < 50), causing the condition logic to always evaluate to true or produce unintended results.