Wiki

effect · random_active_scientist

Definition

  • Supported scope:any
  • Supported target:none

Description

Executes children effects on random scientists that fulfills the "limit" trigger. tooltip=key can be added to override tooltip title

实战 · 配合 · 坑

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

实战用法

random_active_scientist 常用于科研类 mod 中,对当前正在执行研究任务的随机一位科学家施加奖励或惩罚,例如在某事件触发后给符合条件的科学家添加特质或提升经验。配合 limit 块可以精确筛选目标,例如只针对某特定领域的科学家。

# 某科研事故事件:随机对一名活跃科学家造成伤害
random_active_scientist = {
    limit = {
        is_active_scientist = yes
        has_scientist_level = {
            level > 1
        }
    }
    injure_scientist_for_days = {
        days = 30
    }
}

配合关系

  • is_active_scientist — 在 limit 块内用于确认科学家当前处于激活(研究中)状态,避免误选未分配的科学家。
  • add_scientist_trait — 筛选到目标科学家后,为其添加特质,是最常见的后续动作之一。
  • add_scientist_xp — 用于给命中的随机科学家增加经验值,配合等级筛选实现分层奖励逻辑。
  • has_scientist_level — 在 limit 中按科学家等级过滤,确保效果只作用于满足条件的科学家。

常见坑

  1. 忘写 limit 导致随机结果不可控:不加 limit 时该命令会从所有活跃科学家中无差别随机选取,若 mod 中有多个国家或多个科学家并存,可能产生意料之外的目标,建议至少用 is_active_scientist = yes 做基础过滤。
  2. random_scientist 混淆random_scientist 作用于所有科学家(包括未分配任务的),而 random_active_scientist 仅针对当前正在执行研究的科学家;若逻辑上需要影响"正在工作"的科学家,误用前者会让效果作用到闲置角色上。

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

random_active_scientist is commonly used in research-focused mods to apply bonuses or penalties to a randomly selected scientist who is currently assigned to a research slot — for example, adding a trait or granting experience to a qualifying scientist when a particular event fires. Pairing it with a limit block lets you narrow the target precisely, such as restricting the effect to scientists working in a specific field.

# Research accident event: randomly injure one active scientist
random_active_scientist = {
    limit = {
        is_active_scientist = yes
        has_scientist_level = {
            level > 1
        }
    }
    injure_scientist_for_days = {
        days = 30
    }
}

Synergy

  • is_active_scientist — Used inside a limit block to confirm that the scientist is currently active (i.e., assigned to research), preventing unintended selection of unassigned scientists.
  • add_scientist_trait — Adds a trait to the matched scientist after selection; one of the most common follow-up actions.
  • add_scientist_xp — Grants experience to the randomly selected scientist; combine with level filtering to implement tiered reward logic.
  • has_scientist_level — Filters by scientist level inside limit, ensuring the effect only applies to scientists who meet the required threshold.

Common Pitfalls

  1. Omitting limit leads to unpredictable results: Without a limit block, the command picks blindly from all active scientists. In mods where multiple countries or scientists coexist, this can produce unintended targets. At a minimum, add is_active_scientist = yes as a baseline filter.
  2. Confusing it with random_scientist: random_scientist targets all scientists, including those not currently assigned to any research slot, whereas random_active_scientist only considers scientists actively conducting research. If your intent is to affect scientists who are "on the job," mistakenly using the former will cause the effect to land on idle characters instead.