Wiki

effect · add_scientist_level

Definition

  • Supported scope:CHARACTER
  • Supported target:none

Description

Add levels to a special project specialization for a scientist character in scope.
The `level` parameter is a scoped variable

#### Example

my_character = { add_scientist_level = { level = 2 # accepts variables specialization = specialization_nuclear } }

实战 · 配合 · 坑

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

实战用法

在涉及科学家成长系统的 mod 中,add_scientist_level 常用于任务完成奖励、科研事件结果或国策完成后提升特定科学家的专业化等级,从而推动特殊项目进度加速。例如,当某个核武器研发任务链完成后,为负责人加级:

# 在某个 focus 或 event 的 option 中
my_nuclear_scientist = {
    add_scientist_level = {
        level = 1
        specialization = specialization_nuclear
    }
}

配合关系

  • [has_scientist_level](/wiki/trigger/has_scientist_level):在加级前先判断科学家当前等级,避免超出设计上限或执行冗余逻辑。
  • [add_scientist_xp](/wiki/effect/add_scientist_xp):与加级配合,可在提升等级的同时补充经验值,使成长曲线更自然流畅。
  • [add_scientist_trait](/wiki/effect/add_scientist_trait):等级提升后同步附加对应专业特性,强化科学家角色的专业身份定位。
  • [is_active_scientist](/wiki/trigger/is_active_scientist):确认角色当前处于活跃科学家状态再执行加级,防止对未激活角色误操作。

常见坑

  1. scope 未切换到 CHARACTER:直接在 COUNTRY scope 下写 add_scientist_level 会报错,必须先通过角色标签(如 my_character = { ... })将 scope 切换到对应的 CHARACTER,否则命令无效甚至导致脚本崩溃。
  2. specialization 字段填写了不存在的键值:游戏只识别已在特殊项目系统中注册的专业化类型,若填写了自定义 mod 未正确声明的 specialization,等级不会实际提升且通常不会有明显报错提示,极难排查。

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

In mods involving the scientist progression system, add_scientist_level is commonly used for task completion rewards, event outcomes, or national focus completions to advance a specific scientist's specialization level, thereby accelerating progress on special projects. For example, after completing a nuclear weapons research task chain, you can advance the project lead:

# In an option within a focus or event
my_nuclear_scientist = {
    add_scientist_level = {
        level = 1
        specialization = specialization_nuclear
    }
}

Synergy

  • [has_scientist_level](/wiki/trigger/has_scientist_level): Check the scientist's current level before advancing to avoid exceeding design caps or executing redundant logic.
  • [add_scientist_xp](/wiki/effect/add_scientist_xp): Pair with level advancement to supplement experience points simultaneously, creating a smoother and more natural growth curve.
  • [add_scientist_trait](/wiki/effect/add_scientist_trait): Sync specialized traits after level advancement to reinforce the scientist's professional identity and role positioning.
  • [is_active_scientist](/wiki/trigger/is_active_scientist): Confirm the character is in active scientist status before executing the level gain, preventing accidental operations on inactive characters.

Common Pitfalls

  1. Scope not switched to CHARACTER: Writing add_scientist_level directly under COUNTRY scope will cause an error. You must first switch the scope to the corresponding CHARACTER through character tags (e.g., my_character = { ... }), otherwise the command fails or causes script crashes.
  2. specialization field contains non-existent key values: The game only recognizes specialization types registered in the special projects system. If you use a custom mod's undeclared specialization, the level will not actually advance and typically no obvious error message appears, making it extremely difficult to debug.