Wiki

effect · add_scientist_xp

Definition

  • Supported scope:CHARACTER
  • Supported target:none

Description

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

#### Example

ex: my_character = { add_scientist_xp = { experience = 2 # accepts variables specialization = specialization_nuclear } }

实战 · 配合 · 坑

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

实战用法

add_scientist_xp 常用于核武器、火箭或特殊项目 mod 中,当科学家完成某阶段任务或触发特定事件时,给其累积专项经验以加速特殊项目进度。例如,可在国家焦点完成后为指定科学家的核物理专精加经验:

# 在国家焦点 completion_reward 中
my_nuclear_scientist = {
    add_scientist_xp = {
        experience = 5
        specialization = specialization_nuclear
    }
}

配合关系

  • [is_active_scientist](/wiki/trigger/is_active_scientist) — 在执行前判断角色是否处于激活状态的科学家,避免对非科学家角色错误调用。
  • [add_scientist_level](/wiki/effect/add_scientist_level) — 经验累积到一定程度后可配合此命令直接提升科学家等级,实现"经验→升级"的连贯逻辑。
  • [add_scientist_trait](/wiki/effect/add_scientist_trait) — 科学家在获得足够经验后,常同时授予专属特质,强化特定研究方向的叙事表现。
  • [has_scientist_level](/wiki/trigger/has_scientist_level) — 用于检查科学家当前等级,配合条件判断决定是否需要继续追加经验。

常见坑

  1. scope 指向错误:此命令必须在 CHARACTER scope 下执行,新手常在 COUNTRY scope 中直接调用,导致脚本报错或静默无效。务必先用 my_character = { ... } 进入对应角色的 scope。
  2. specialization 填写不合法specialization 字段必须填写游戏内定义的合法专精标签(如 specialization_nuclear),填写自造字符串不会报错但经验会被丢弃,难以排查。

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_scientist_xp is commonly used in nuclear weapons, rocket, or special project mods to accumulate specialized experience for scientists when they complete milestone tasks or trigger specific events, thereby accelerating special project progress. For example, you can add nuclear physics specialization experience to a designated scientist after a national focus completes:

# In national focus completion_reward
my_nuclear_scientist = {
    add_scientist_xp = {
        experience = 5
        specialization = specialization_nuclear
    }
}

Synergy

  • [is_active_scientist](/wiki/trigger/is_active_scientist) — Check whether the character is an active scientist before execution, preventing erroneous calls on non-scientist characters.
  • [add_scientist_level](/wiki/effect/add_scientist_level) — After experience accumulates to a certain threshold, pair with this command to directly promote scientist level, creating coherent "experience → promotion" logic.
  • [add_scientist_trait](/wiki/effect/add_scientist_trait) — Once a scientist acquires sufficient experience, commonly grant exclusive traits in tandem to enhance narrative impact in specific research directions.
  • [has_scientist_level](/wiki/trigger/has_scientist_level) — Check the scientist's current level and use conditional logic to determine whether additional experience needs to be awarded.

Common Pitfalls

  1. Incorrect scope targeting: This command must execute within CHARACTER scope; beginners often call it directly in COUNTRY scope, causing script errors or silent failures. Always enter the appropriate character scope first using my_character = { ... }.
  2. Invalid specialization values: The specialization field must use a valid specialization tag defined in the game (such as specialization_nuclear); entering arbitrary strings won't error but the experience will be discarded and difficult to debug.