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
- 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.
- 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.