Wiki

effect · every_active_scientist

Definition

  • Supported scope:any
  • Supported target:none

Description

Executes children effects on every active scientist (or \"random_select_amount\" of random character if specified) of the country in scope, that fulfills the \"limit\" trigger.
	tooltip=key can be added to override tooltip title.
	By default the effects are only displayed once, you may display them for each matching character with display_individual_scopes.
	ex: GER = {
	  every_active_scientist = {
		tooltip = my_loc_key # Optional
		random_select_amount = 3 # Optional
		include_invisible = yes # Optional - default = no
		display_individual_scopes = yes # Optional - default = no
		... character scope effects ...
	  }
	}

实战 · 配合 · 坑

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

实战用法

every_active_scientist 常用于科研系统 mod 中,对当前国家所有正在活跃(已分配研究任务)的科学家批量施加特性、提升经验或调整等级,例如在某一国策完成后奖励所有在岗科学家。也可借助 random_select_amount 实现只随机挑选若干名科学家受益的限量奖励机制。

# 某国策完成后,为最多 2 名活跃科学家添加科研特性并给予经验
GER = {
    every_active_scientist = {
        tooltip = ger_scientist_bonus_tt
        random_select_amount = 2
        limit = {
            is_active_scientist = yes
        }
        add_scientist_trait = {
            slot = scientist_trait_slot_1
        }
        add_scientist_xp = 50
    }
}

配合关系

  • is_active_scientist:在 limit 块中配合使用,确保只筛选当前确实处于活跃状态的科学家,避免对已脱岗角色误操作。
  • add_scientist_trait:最常见的批量操作目标,用于为符合条件的科学家统一赋予特定科研特性。
  • add_scientist_xp:为活跃科学家批量增加经验值,适合在研究里程碑或国策节点触发时给予奖励。
  • has_trait:在 limit 块中进一步过滤,只对拥有(或不拥有)特定特性的科学家执行效果,实现精准定向操作。

常见坑

  1. 忽略 limit 为空时的范围过大问题:不写 limit 块时,效果会作用于所有活跃科学家,若搭配 random_select_amount 且总数较少,可能无法达到预期的「随机感」;建议始终明确 limit 条件,哪怕只写 is_active_scientist = yes 也能提高脚本可读性与安全性。
  2. every_active_scientist 用在非国家 scope 下:此命令虽支持 any scope,但实际查找的是「当前所处国家」的科学家列表;若外层 scope 不慎切换到了州或省份级别而未切回国家,会导致找不到任何科学家且不报错,效果静默失效。

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

every_active_scientist is commonly used in research-system mods to batch-apply traits, grant experience, or adjust levels to all currently active (assigned) scientists in a country — for example, rewarding all on-duty scientists upon completing a focus. You can also use random_select_amount to implement a limited-reward mechanic that randomly selects only a certain number of scientists to benefit.

# After a focus completes, add a research trait and grant XP to at most 2 active scientists
GER = {
    every_active_scientist = {
        tooltip = ger_scientist_bonus_tt
        random_select_amount = 2
        limit = {
            is_active_scientist = yes
        }
        add_scientist_trait = {
            slot = scientist_trait_slot_1
        }
        add_scientist_xp = 50
    }
}

Synergy

  • is_active_scientist: Use inside a limit block to ensure only scientists who are genuinely active are selected, preventing unintended effects on unassigned characters.
  • add_scientist_trait: The most common batch-operation target — uniformly assigns a specific research trait to all qualifying scientists.
  • add_scientist_xp: Grants experience to active scientists in bulk; ideal for triggering rewards at research milestones or focus nodes.
  • has_trait: Further filters inside a limit block to apply effects only to scientists who do (or do not) possess a specific trait, enabling precise targeted operations.

Common Pitfalls

  1. Omitting limit leads to an overly broad scope: Without a limit block, the effect applies to every active scientist. When combined with random_select_amount and a small pool, the result may not feel as "random" as intended. It is recommended to always specify limit conditions explicitly — even just is_active_scientist = yes improves both readability and safety.
  2. Using every_active_scientist outside a country scope: Although this effect supports any scope, it searches the scientist list belonging to the current country scope. If the outer scope has inadvertently switched to a state or province level without switching back, no scientists will be found and the effect will silently do nothing — no error is thrown.