Wiki

trigger · all_unit_leader

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Checks if all Unit Leaders of the Country in scope match the triggers.
tooltip=key can be defined to override title.
ex: GER = {
  all_unit_leader = {
	tooltip = my_loc_key # Optional
	include_invisible = yes # Optional - default = no
    ... character scope triggers ...
  }
}

实战 · 配合 · 坑

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

实战用法

all_unit_leader 常用于检查某国所有将领是否满足特定条件,例如在事件或决策的 available 块中要求所有指挥官均达到一定技能阈值,或者在 focus 的 bypass 中判断是否所有将领都已具备某特质。

# 示例:只有当德国所有将领都拥有 "trickster" 特质时,决策才可用
GER = {
    available = {
        all_unit_leader = {
            has_trait = trickster
        }
    }
}
# 示例:检查本国所有将领攻击技能是否均达到 3 级及以上
all_unit_leader = {
    attack_skill_level > 2
}

配合关系

  • has_trait:最常见的内层检查,用于判断每位将领是否持有特定将领特质,与 all_unit_leader 配合实现"全员特质检查"。
  • skill:检查将领综合技能等级,与 all_unit_leader 配合可确认全国将领整体水准是否达标。
  • is_field_marshal:在 all_unit_leader 内部过滤身份,结合 not 可排除元帅,只对陆军指挥官做批量判断。
  • has_unit_leader_flag:检查将领是否被标记了特定 flag,与 all_unit_leader 配合可追踪所有将领的自定义状态。

常见坑

  1. any_unit_leader 语义混淆all_unit_leader 要求所有将领同时满足条件才返回真;若本意是"至少一名将领满足",应改用 any_unit_leader,否则条件永远不会触发或过于苛刻。
  2. 忘记 scope 必须是 COUNTRY:该 trigger 只能在国家 scope 下调用,若写在 character scope(如 unit_leader_event 的事件选项内直接使用而未先切换到国家 scope),会导致脚本报错或静默失效,需用 owner = { all_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

all_unit_leader is commonly used to check whether all unit leaders of a country meet certain conditions — for example, requiring every commander to reach a specific skill threshold in a decision's available block, or checking whether all leaders already possess a particular trait in a focus's bypass block.

# Example: the decision is only available when all German unit leaders have the "trickster" trait
GER = {
    available = {
        all_unit_leader = {
            has_trait = trickster
        }
    }
}
# Example: check whether all unit leaders in the current country have an attack skill level of 3 or higher
all_unit_leader = {
    attack_skill_level > 2
}

Synergy

  • has_trait: The most common inner check — used to determine whether each leader holds a specific trait. Pair it with all_unit_leader to enforce a "all-leaders trait check".
  • skill: Checks a leader's overall skill level. Combined with all_unit_leader, this lets you verify whether every leader in the country meets a minimum competency threshold.
  • is_field_marshal: Filters by leader type inside all_unit_leader. Use it with not to exclude field marshals and apply batch checks only to army commanders.
  • has_unit_leader_flag: Checks whether a leader has been assigned a specific flag. Paired with all_unit_leader, this lets you track custom states across all leaders in a country.

Common Pitfalls

  1. Confusing it with any_unit_leader: all_unit_leader returns true only when every leader satisfies the condition simultaneously. If your intent is "at least one leader satisfies the condition", use any_unit_leader instead — otherwise the condition will either never trigger or be far too restrictive.
  2. Forgetting that the scope must be COUNTRY: This trigger can only be called from within a country scope. If it is written inside a character scope (for example, directly inside an event option of a unit_leader_event without first switching scope), the script will either throw an error or silently fail. Use a construct such as owner = { all_unit_leader = { ... } } to enter the country scope first.