Wiki

trigger · any_state_division

Definition

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

Description

check if any division meets the trigger. tooltip=key can be defined to override title

实战 · 配合 · 坑

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

实战用法

any_state_division 常用于检查某个州内是否存在满足特定条件的师团,例如判断敌方驻军是否含有装甲师、或己方某州是否存在战力低下的残兵,从而触发事件或决议。典型场景包括:边境战争前检查驻防质量、或在事件中根据州内师团模板决定选项是否可用。

# 检查某州内是否有任何师团组织度低于阈值,若有则事件选项不可用
available = {
    ROOT = {
        any_state_division = {
            unit_organization < 0.3
        }
    }
}

上例中 ROOT 为某国家 scope,通过 OWNERCONTROLLER 目标可进一步缩小到州的占领方或控制方的驻军。

配合关系

  • unit_organization:最常与 any_state_division 搭配,用于筛选组织度不足的师团,判断州内防御是否薄弱。
  • unit_strength:配合使用可检查师团当前兵力比例,识别受损残部是否仍驻扎在该州。
  • division_has_majority_template:用于在 any_state_division 内部判断师团模板类型,区分步兵师与装甲师等。
  • custom_trigger_tooltip:当检查逻辑较复杂时,包裹 any_state_division 以提供玩家可读的本地化提示,避免 tooltip 显示原始条件堆叠。

常见坑

  1. Scope 混淆any_state_division 只能在 STATE scope 下调用,若当前 scope 为国家或省份,需先通过 any_state/all_state 或事件目标转换到 STATE scope,否则脚本报错或静默失效。
  2. target 指向错误导致检查范围偏差:默认检查 THIS(即当前州)的师团,但若想检查控制方的师团需显式指定 controller = { any_state_division = { ... } },遗漏目标转换会导致检查的是占领方而非控制方,产生与预期不符的结果。

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_state_division is commonly used to check whether any division within a given state meets specific conditions — for example, determining whether an enemy garrison contains armored divisions, or whether a friendly state still holds battered remnants with low strength. This makes it useful for triggering events or decisions. Typical scenarios include checking garrison quality before a border war, or gating event options based on the division templates present in a state.

# Check whether any division in the state has organization below a threshold;
# if so, the event option is unavailable
available = {
    ROOT = {
        any_state_division = {
            unit_organization < 0.3
        }
    }
}

In the example above, ROOT is a country scope. By targeting OWNER or CONTROLLER instead, you can further narrow the check to the divisions belonging to the state's occupier or controller respectively.

Synergy

  • unit_organization: The most frequent companion to any_state_division — used to filter divisions with insufficient organization and assess whether a state's defenses are dangerously weak.
  • unit_strength: Pair this with any_state_division to check a division's current strength ratio and identify whether damaged remnants are still present in the state.
  • division_has_majority_template: Used inside any_state_division to evaluate division template types, distinguishing infantry divisions from armored divisions and so on.
  • custom_trigger_tooltip: When the check logic is complex, wrap any_state_division inside this trigger to provide players with a readable localized tooltip, preventing the UI from displaying a raw stack of raw conditions.

Common Pitfalls

  1. Scope confusion: any_state_division can only be called within a STATE scope. If the current scope is a country or province, you must first transition into a STATE scope via any_state/all_state or an event target — otherwise the script will either throw an error or silently fail.
  2. Incorrect target leading to wrong check coverage: By default the trigger checks divisions belonging to THIS (i.e., the current state). If you want to check the divisions of the controller specifically, you must explicitly write controller = { any_state_division = { ... } }. Omitting the scope transition means you end up checking the occupier rather than the controller, producing results that differ from what you intended.