Wiki

effect · add_trait

Definition

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

Description

add trait from specified list to character.
add_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 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。

实战用法

add_trait 最常用于剧情事件或国策完成后,给特定角色动态赋予特质,例如让某将领在完成特殊任务后获得"天才战略家"特质,或在政治顾问就任时附加额外能力。也可用于内战、政变等剧情节点,给新生成的国家领袖绑定对应意识形态特质。

# 国策完成后给德国某将领添加特质
complete_national_focus = GER_eastern_campaign
country_event = {
    id = ger.42
}

# 在事件 option 中:
GER_manstein = {
    add_trait = {
        trait = brilliant_strategist
    }
}

# 若在国家 scope 下需指定 character:
add_trait = {
    character = GER_manstein
    trait = brilliant_strategist
}

配合关系

  • [remove_trait](/wiki/effect/remove_trait):与 add_trait 互为逆操作,常用于先移除旧特质再添加新特质,实现特质"升级"或替换逻辑。
  • [add_country_leader_trait](/wiki/effect/add_country_leader_trait):当目标是国家领袖且需要添加领袖专属特质(而非通用角色特质)时配合使用,两者覆盖不同的特质列表。
  • [promote_character](/wiki/effect/promote_character):先将角色晋升到某个职位,再用 add_trait 赋予与该职位匹配的特质,确保逻辑顺序正确。
  • [can_select_trait](/wiki/trigger/can_select_trait):在添加特质前用此触发器检查角色是否满足条件,避免脚本报错或逻辑混乱。

常见坑

  1. 在国家 scope 下忘写 character 字段:只有在已进入角色自身 scope(如 GER_manstein = { ... })时才可省略 character,否则必须显式指定,否则游戏无法确定目标角色,效果静默失败。
  2. 顾问/领袖特质缺少 slotideology 字段:为处于顾问职位的角色添加特质时必须填写 slot,为国家领袖添加特质时必须填写 ideology,缺少这两个字段会导致 UI 不更新甚至报错,是新手最常忽略的细节。

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

add_trait is most commonly used in scripted events or after national focus completion to dynamically assign traits to specific characters. For example, you might grant a general the "brilliant_strategist" trait after completing a special mission, or attach additional abilities to a political advisor upon appointment. It can also be used at narrative junctures like civil wars or coups to bind corresponding ideological traits to newly spawned national leaders.

# Add a trait to a German general after focus completion
complete_national_focus = GER_eastern_campaign
country_event = {
    id = ger.42
}

# Within an event option:
GER_manstein = {
    add_trait = {
        trait = brilliant_strategist
    }
}

# If you need to specify the character from a country scope:
add_trait = {
    character = GER_manstein
    trait = brilliant_strategist
}

Synergy

  • [remove_trait](/wiki/effect/remove_trait): The inverse operation of add_trait, commonly used to remove an old trait before adding a new one, implementing trait "upgrades" or replacement logic.
  • [add_country_leader_trait](/wiki/effect/add_country_leader_trait): Used when the target is a national leader and you need to add leader-exclusive traits (rather than generic character traits); these two cover different trait pools.
  • [promote_character](/wiki/effect/promote_character): First promote a character to a specific position, then use add_trait to assign traits matching that role, ensuring correct logical order.
  • [can_select_trait](/wiki/trigger/can_select_trait): Check whether a character meets the conditions before adding a trait using this trigger, preventing script errors or logical confusion.

Common Pitfalls

  1. Forgetting the character field when in a country scope: The character field can only be omitted when already within the character's own scope (such as GER_manstein = { ... }). Otherwise, you must explicitly specify it; failure to do so means the game cannot determine the target character, and the effect silently fails.
  2. Missing slot or ideology fields for advisor/leader traits: When adding a trait to a character in an advisor position, you must fill in slot; when adding a trait to a national leader, you must fill in ideology. Omitting these two fields results in the UI not updating or even errors—this is the detail most commonly overlooked by newcomers.