Wiki

effect · add_max_trait

Definition

  • Supported scope:CHARACTER
  • Supported target:none

Description

Adds a max assignable trait slot for a general
Example: add_max_trait = 1

实战 · 配合 · 坑

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

实战用法

add_max_trait 常用于为特定将领解锁额外的特质槽位,例如在完成特殊任务、国策或事件后奖励一名精英将领,使其能够装备更多特质。典型场景包括"王牌将领成长"类 mod,通过积累战功逐步扩展将领的特质上限。

# 在一个事件 option 中,奖励特定将领额外的特质槽
character_event = {
    id = my_mod.10
    option = {
        name = my_mod.10.a
        # scope 已在 FROM 或 characters 中锁定到目标 CHARACTER
        add_max_trait = 1
        add_skill_level = 1
    }
}

配合关系

  • [add_trait](/wiki/effect/add_trait):扩展了特质槽上限后,立即为将领附加一个新特质,两者配合才能让新槽位"有意义"地被填满。
  • [add_skill_level](/wiki/effect/add_skill_level):通常和能力提升一同作为高级奖励发放,给人"全面成长"的设计感,避免单独提升槽位显得突兀。
  • [can_select_trait](/wiki/trigger/can_select_trait):在给予槽位之前用于条件判断,确认该将领当前是否仍有可用特质槽,防止在逻辑上重复叠加或溢出。
  • [has_trait](/wiki/trigger/has_trait):常作为前置条件检查,只有当将领已拥有某个特定特质时,才触发进一步的槽位扩展,实现"特质晋升链"设计。

常见坑

  1. Scope 错误add_max_trait 只能在 CHARACTER scope 下执行,新手容易在 COUNTRY scope(如 capital_scopeany_country_with_original_tag)里直接调用,导致脚本报错或静默无效;务必先通过 characters = { ... }= { } 将 scope 切换到具体的角色。
  2. 与特质槽数量混淆:该命令增加的是最大可分配槽位数,而不是直接为将领添加特质,新手常误以为执行后将领会自动获得新特质,实际上仍需配合 add_trait 手动指定,否则槽位增加了却什么都没填入,产生"白加"的困惑。

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_max_trait is commonly used to unlock additional trait slots for specific characters, such as rewarding an elite general with expanded capacity after completing special missions, national focuses, or events. Typical use cases include "ace pilot progression" style mods, where characters gradually expand their trait slot limits by accumulating combat achievements.

# In an event option, reward a specific character with an additional trait slot
character_event = {
    id = my_mod.10
    option = {
        name = my_mod.10.a
        # scope is already locked to the target CHARACTER in FROM or characters
        add_max_trait = 1
        add_skill_level = 1
    }
}

Synergy

  • [add_trait](/wiki/effect/add_trait): After expanding the trait slot limit, immediately assign a new trait to the character. Using both effects together ensures the new slot is meaningfully filled.
  • [add_skill_level](/wiki/effect/add_skill_level): Typically awarded alongside ability improvements as a high-tier reward, creating a "comprehensive growth" design feel and avoiding the awkwardness of raising slots in isolation.
  • [can_select_trait](/wiki/trigger/can_select_trait): Used for condition checking before granting slots, confirming whether the character currently has available trait slots and preventing logical duplication or overflow.
  • [has_trait](/wiki/trigger/has_trait): Often serves as a prerequisite check, triggering further slot expansion only when the character already possesses a specific trait, enabling "trait promotion chain" mechanics.

Common Pitfalls

  1. Scope Errors: add_max_trait only executes in CHARACTER scope. Beginners often call it directly in COUNTRY scope (such as capital_scope or any_country_with_original_tag), resulting in script errors or silent failures. Always switch scope to a specific character first using characters = { ... } or = { }.
  2. Confusion with Trait Slot Count: This command increases the maximum assignable slot count, not the direct addition of traits to a character. Beginners often mistakenly believe the character automatically gains a new trait after execution, but add_trait must be called separately to specify which trait fills the slot. Otherwise, the slot increases but remains empty, creating "wasted allocation" confusion.