Wiki

effect · remove_unit_leader_trait

Definition

  • Supported scope:CHARACTER
  • Supported target:none

Description

Remove trait from unit leader
Example: SOV_konstantin_rokossovsky = { remove_unit_leader_trait = media_personality }

实战 · 配合 · 坑

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

实战用法

remove_unit_leader_trait 常用于剧情事件或决策中,动态调整将领的特质,例如当某位将领经历特定事件后失去某个正面或负面特质。比如在一个"将领改革"事件中,移除其过时的战术风格特质,再赋予新的特质,实现角色成长弧线。

# 事件触发:将领从游击战专家转型
character_event = {
    id = my_mod.101
    hidden = yes
    immediate = {
        SOV_vasily_chuikov = {
            remove_unit_leader_trait = guerrilla_fighter
            add_unit_leader_trait = urban_assault_specialist
        }
    }
}

配合关系

  • [add_unit_leader_trait](/wiki/effect/add_unit_leader_trait):最直接的搭档,先移除旧特质再添加新特质,实现特质的"替换"逻辑(注意也可以直接用 [replace_unit_leader_trait](/wiki/effect/replace_unit_leader_trait) 一步完成)。
  • [has_trait](/wiki/trigger/has_trait):在执行移除前用此触发器检查将领是否真的拥有该特质,避免因特质不存在引发脚本报错或逻辑混乱。
  • [add_timed_unit_leader_trait](/wiki/effect/add_timed_unit_leader_trait):与本命令组合可实现"临时特质到期后移除、换上永久特质"的进阶效果。
  • [is_corps_commander](/wiki/trigger/is_corps_commander) / [is_field_marshal](/wiki/trigger/is_field_marshal):在 if 条件块中确认角色当前的将领类型,确保移除的特质对该角色类型有效。

常见坑

  1. 对不存在的特质执行移除不会报错但会静默失败:如果将领当前并没有该特质,命令不会崩溃,但也不会有任何效果。建议在执行前用 [has_trait](/wiki/trigger/has_trait) 包裹一层 limitif 判断,保证逻辑清晰可追溯。
  2. 作用域必须是 CHARACTER 本身而非国家:新手常在国家 scope 下直接写 remove_unit_leader_trait,导致命令无效。必须先通过 SOV_xxx = { ... }random_unit_leader 等方式进入正确的 CHARACTER 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

remove_unit_leader_trait is commonly used in scripted events or decisions to dynamically adjust a general's traits. For example, when a general experiences a specific event and loses a positive or negative trait. In a "general reform" event, you might remove an outdated tactical doctrine trait and assign a new one, creating a character arc.

# Event trigger: General transitions from guerrilla warfare expert
character_event = {
    id = my_mod.101
    hidden = yes
    immediate = {
        SOV_vasily_chuikov = {
            remove_unit_leader_trait = guerrilla_fighter
            add_unit_leader_trait = urban_assault_specialist
        }
    }
}

Synergy

  • [add_unit_leader_trait](/wiki/effect/add_unit_leader_trait): The most direct companion—remove the old trait first, then add the new one to implement trait "replacement" logic (note that you can also use [replace_unit_leader_trait](/wiki/effect/replace_unit_leader_trait) to accomplish this in one step).
  • [has_trait](/wiki/trigger/has_trait): Use this trigger before executing the removal to verify that the general actually possesses the trait, preventing script errors or logic confusion from non-existent traits.
  • [add_timed_unit_leader_trait](/wiki/effect/add_timed_unit_leader_trait): Combine with this command to achieve advanced effects like "remove temporary trait after expiration and assign permanent trait."
  • [is_corps_commander](/wiki/trigger/is_corps_commander) / [is_field_marshal](/wiki/trigger/is_field_marshal): Confirm the general's current type within an if condition block to ensure the removed trait is valid for that general type.

Common Pitfalls

  1. Removing a non-existent trait will not error but will silently fail: If the general doesn't currently have the trait, the command won't crash, but it will have no effect. It's recommended to wrap the execution with [has_trait](/wiki/trigger/has_trait) in a limit or if check to ensure clear and traceable logic.
  2. The scope must be CHARACTER itself, not the country: Beginners often write remove_unit_leader_trait directly under a country scope, causing the command to have no effect. You must first enter the correct CHARACTER scope via SOV_xxx = { ... } or random_unit_leader for the command to work.