Wiki

effect · remove_trait

Definition

  • Supported scope:COUNTRY, CHARACTER
  • Supported target:none

Description

remove trait from specified list to character.
remove_trait = {
	character = GER_character_token # optional if inside character scope
	trait = brilliant_strategist
	slot = political_advisor #Only required for updating advisor
	ideology = fascism_ideology #Only required for updating country leader
}

实战 · 配合 · 坑

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

实战用法

remove_trait 常用于事件或决议触发后动态调整角色属性,例如某将领因战败被剥夺"天才战略家"特质,或顾问因政治立场变化而失去特定 ideology 特质。在角色扮演类 mod 中,也常用来做特质"升级替换"——先移除旧特质,再添加新特质,实现成长系统。

# 在国家事件中,将领因战败被剥夺特质
country_event = {
    id = my_mod.5
    option = {
        name = my_mod.5.a
        remove_trait = {
            character = GER_von_manstein
            trait = brilliant_strategist
        }
    }
}

# 替换国家领袖的意识形态特质时需指定 ideology
remove_trait = {
    character = GER_hitler
    trait = fascist_demagogue
    ideology = fascism_ideology
}

配合关系

  • [add_trait](/wiki/effect/add_trait):最常见的搭档,移除旧特质后紧接着添加新特质,实现特质替换升级逻辑。
  • [remove_advisor_role](/wiki/effect/remove_advisor_role):当顾问特质被移除后,若需同步解除其顾问职务,配合此命令确保 slot 状态一致。
  • [add_country_leader_trait](/wiki/effect/add_country_leader_trait) / [remove_country_leader_trait](/wiki/effect/remove_country_leader_trait):处理国家领袖专属特质时,这两个命令与 remove_trait 分工明确——领袖 trait 建议优先使用专用命令以避免歧义。
  • [has_character](/wiki/trigger/has_character):在执行移除前先判断目标角色是否存在于该国,防止因角色不存在导致脚本报错。

常见坑

  1. 忘记填写 slotideology 字段:对顾问角色移除特质时若不填 slot,游戏不会正确更新顾问栏位状态;修改国家领袖特质时不填 ideology 同样会导致效果不生效,这是最高频的漏写错误。
  2. 在 COUNTRY scope 下忘记指定 character:只有在 CHARACTER scope 内(如 every_character 循环体中)才可省略 character 字段;直接写在国家事件 option 里时必须显式指定目标角色 token,否则命令无效且不报错,难以排查。

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_trait is commonly used to dynamically adjust character attributes after events or decisions trigger—for example, a general loses the "brilliant_strategist" trait after a military defeat, or an advisor loses an ideology-specific trait due to political shift. In roleplay-oriented mods, it's also frequently used for trait "upgrade replacement"—remove the old trait first, then add a new one to implement a progression system.

# In a country event, a general loses a trait after defeat
country_event = {
    id = my_mod.5
    option = {
        name = my_mod.5.a
        remove_trait = {
            character = GER_von_manstein
            trait = brilliant_strategist
        }
    }
}

# When replacing a country leader's ideology trait, specify ideology
remove_trait = {
    character = GER_hitler
    trait = fascist_demagogue
    ideology = fascism_ideology
}

Synergy

  • [add_trait](/wiki/effect/add_trait): The most common companion—after removing an old trait, immediately add a new one to implement trait replacement and upgrade logic.
  • [remove_advisor_role](/wiki/effect/remove_advisor_role): When an advisor's trait is removed, if you need to simultaneously revoke their advisor position, pair this command to ensure slot consistency.
  • [add_country_leader_trait](/wiki/effect/add_country_leader_trait) / [remove_country_leader_trait](/wiki/effect/remove_country_leader_trait): When handling leader-exclusive traits, these commands have clear division of labor with remove_trait—it's recommended to prioritize the dedicated commands for leader traits to avoid ambiguity.
  • [has_character](/wiki/trigger/has_character): Check whether the target character exists in the country before execution to prevent script errors caused by a non-existent character.

Common Pitfalls

  1. Forgetting to fill in the slot or ideology field: When removing a trait from an advisor character without slot, the game won't correctly update the advisor position state; similarly, modifying a country leader's trait without ideology causes the effect to not apply—this is the most frequent omission error.
  2. Forgetting to specify character under COUNTRY scope: You can only omit the character field within CHARACTER scope (such as inside an every_character loop); when writing directly in a country event option, you must explicitly specify the target character token, otherwise the command silently fails with no error message, making it difficult to debug.