Wiki

trigger · is_promoted_from_unit

Definition

  • Supported scope:CHARACTER
  • Supported target:none

Description

Checks if a unit leader was promoted from a unit (division or ship).

### Example

any_unit_leader = { is_promoted_from_unit = yes }

实战 · 配合 · 坑

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

实战用法

is_promoted_from_unit 常用于区分"由师/舰自动晋升"与"通过事件/focus直接创建"的将领,从而在 mod 中为晋升出身的将领提供专属特质或奖励。例如,在自定义将领成长系统中,可以限定只有从部队晋升的指挥官才能触发某些事件或获得特定加成。

# 为所有从部队晋升的陆军指挥官添加专属特质
every_unit_leader = {
    limit = {
        is_promoted_from_unit = yes
        is_corps_commander = yes
    }
    add_unit_leader_trait = veteran_promotee
}

配合关系

  • is_corps_commander:与 is_promoted_from_unit 联用,可精确筛选"从师晋升的军长",排除直接委任的将领。
  • is_army_leader:联用后可判断从部队晋升的野战军指挥官,用于区分不同级别晋升来源。
  • add_unit_leader_trait:确认将领为晋升出身后,随即赋予特质,是最常见的后续效果操作。
  • has_trait:在已用 is_promoted_from_unit 筛选后,进一步检查该将领是否已持有某特质,避免重复添加。

常见坑

  1. scope 用错is_promoted_from_unit 必须在 CHARACTER scope 下使用,直接写在国家 scope(如 country_event 的 trigger 块顶层)会报错或静默失败,需先通过 any_unit_leader/every_unit_leader 等进入角色 scope。
  2. 误以为区分兵种:该 trigger 只判断将领"是否从部队晋升"这一来源,并不区分来自陆军师还是海军舰船,若需进一步区分应搭配 is_army_leaderis_navy_leader 共同判断。

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_promoted_from_unit is commonly used to distinguish between commanders who were promoted automatically from a division or vessel and those who were created directly via events or focuses. This lets modders grant exclusive traits or bonuses only to organically promoted leaders. For example, in a custom commander progression system you can restrict certain events or stat bonuses so that only field-promoted officers are eligible.

# Add an exclusive trait to all corps commanders who were promoted from a unit
every_unit_leader = {
    limit = {
        is_promoted_from_unit = yes
        is_corps_commander = yes
    }
    add_unit_leader_trait = veteran_promotee
}

Synergy

  • is_corps_commander: Combine with is_promoted_from_unit to precisely filter for corps commanders who rose through the ranks, excluding any directly appointed leaders.
  • is_army_leader: Pair together to identify field army commanders who were promoted from a unit, useful for distinguishing promotion sources across different command tiers.
  • add_unit_leader_trait: The most common follow-up effect — once a leader is confirmed as field-promoted, immediately assign a trait.
  • has_trait: After filtering with is_promoted_from_unit, use this to check whether the leader already holds a particular trait, preventing it from being added more than once.

Common Pitfalls

  1. Wrong scope: is_promoted_from_unit must be used inside a CHARACTER scope. Writing it at the top level of a country scope (e.g., the trigger block of a country_event) will cause an error or silent failure. You must first enter a character scope via iterators such as any_unit_leader or every_unit_leader.
  2. Mistaking it for a branch filter: This trigger only checks whether a leader was promoted from a unit — it does not distinguish between an army division and a naval vessel. If you need to tell the two apart, combine it with is_army_leader or is_navy_leader accordingly.