Wiki

trigger · is_corps_commander

Definition

  • Supported scope:CHARACTER
  • Supported target:none

Description

is_corps_commander = yes/no - Checks if the current character is a corps commander

实战 · 配合 · 坑

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

实战用法

is_corps_commander 常用于 mod 中限制某些特质、升阶事件或顾问任命,确保只对军团指挥官生效而不误触野战元帅或海军将领。例如在晋升事件中,先校验角色身份再决定是否授予特质或触发对应效果:

# 仅当角色是军团指挥官时才允许获得该特质
add_trait = {
    token = trait_aggressive_assaulter
    available = {
        is_corps_commander = yes
    }
}

也可用在 limit 块内,过滤 any_character 循环,确保批量操作只作用于军团指挥官群体。


配合关系

  • [is_field_marshal](/wiki/trigger/is_field_marshal) — 常与 is_corps_commander 并列写在互斥分支里,区分军团指挥官与野战元帅,决定走哪条逻辑路径。
  • [add_corps_commander_role](/wiki/effect/add_corps_commander_role) — 在角色尚未担任军团指挥官时(is_corps_commander = no)搭配使用,补充角色角色定义。
  • [promote_leader](/wiki/effect/promote_leader) — 触发晋升前先用 is_corps_commander = yes 做前置校验,防止对非军团指挥官角色误调用升阶逻辑。
  • [has_trait](/wiki/trigger/has_trait) — 通常与身份判断组合,实现"是军团指挥官且拥有某特质"的双重条件过滤。

常见坑

  1. 作用域写错:该 trigger 必须在 CHARACTER scope 下调用。若直接写在国家 scope(如 country_event 的顶层 trigger 块)而未先用 any_character/random_character 等转入角色 scope,会导致条件永远不成立且不报错,极难排查。
  2. is_unit_leader 混淆:新手有时用 is_unit_leader = yes 来代替本 trigger,但 is_unit_leader 对野战元帅、海军将领等同样返回真,无法精确锁定军团指挥官;需要严格区分兵种或职级时务必使用专用 trigger。

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

is_corps_commander is commonly used in mods to restrict certain traits, promotion events, or advisor appointments, ensuring effects apply only to corps commanders rather than field marshals or naval leaders. For example, in a promotion event, verify the character's role first before granting traits or triggering corresponding effects:

# Only allow this trait to be granted when the character is a corps commander
add_trait = {
    token = trait_aggressive_assaulter
    available = {
        is_corps_commander = yes
    }
}

It can also be used within limit blocks to filter any_character loops, ensuring bulk operations apply only to the corps commander population.


Synergy

  • [is_field_marshal](/wiki/trigger/is_field_marshal) — Often paired with is_corps_commander in mutually exclusive branches to distinguish between corps commanders and field marshals, determining which logic path to execute.
  • [add_corps_commander_role](/wiki/effect/add_corps_commander_role) — Used alongside when a character has not yet assumed a corps commander role (is_corps_commander = no), to supplement character definitions.
  • [promote_leader](/wiki/effect/promote_leader) — Perform a prerequisite check with is_corps_commander = yes before triggering promotion to prevent mistakenly invoking promotion logic on non-corps-commander characters.
  • [has_trait](/wiki/trigger/has_trait) — Typically combined with role checks to implement dual-condition filtering like "is a corps commander and possesses a certain trait."

Common Pitfalls

  1. Incorrect scope: This trigger must be called within CHARACTER scope. If written directly in country scope (such as the top-level trigger block of a country_event) without first transitioning to character scope using any_character/random_character, the condition will never be met and no error will be reported, making it extremely difficult to debug.
  2. Confusion with is_unit_leader: Beginners sometimes use is_unit_leader = yes as a substitute for this trigger, but is_unit_leader returns true for field marshals, naval leaders, and others alike, failing to precisely target corps commanders. When strict unit type or rank distinction is needed, always use the dedicated trigger.