effect · random_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
random_scientistanynoneExecutes children effects on random scientists that fulfills the "limit" trigger. tooltip=key can be added to override tooltip title
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
random_scientist 常用于科研相关 mod 中,对满足条件的随机一名科学家执行奖励或惩罚,例如在某国完成特定国策后随机提升一名科学家的等级或添加特质。它与 every_active_scientist 的区别在于只作用于单个随机目标,适合"抽签式"奖励设计。
# 当某国完成科研国策时,随机给一名科学家添加特质并提升等级
focus = {
id = research_breakthrough
...
completion_reward = {
random_scientist = {
limit = {
is_active_scientist = yes
has_scientist_level = { level < 3 }
}
add_scientist_trait = { slot = research_speed_factor trait = scientific_genius }
add_scientist_level = 1
}
}
}
limit 块中过滤出当前处于激活状态的科学家,避免对未分配或未激活的角色生效。random_scientist 配合实现随机科学家升级奖励。limit 导致作用范围过宽:不加 limit 时 random_scientist 会从所有科学家(包括已退休或未激活的)中随机选取,建议始终配合 is_active_scientist = yes 等触发器收窄范围,避免效果作用在不符合预期的角色上。random_scientist 内部已自动切换到科学家 scope,无需也不应在其内部再写角色 scope 切换命令(如再嵌套 every_active_scientist),否则会造成 scope 嵌套错误或重复执行。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.
random_scientist is commonly used in research-focused mods to apply a reward or penalty to a single randomly selected scientist who meets the specified conditions — for example, boosting a random scientist's level or adding a trait after a country completes a particular national focus. The key difference from every_active_scientist is that it targets only one random individual, making it well-suited for "lottery-style" reward designs.
# When a country completes a research-related focus, add a trait and increase the level of one random scientist
focus = {
id = research_breakthrough
...
completion_reward = {
random_scientist = {
limit = {
is_active_scientist = yes
has_scientist_level = { level < 3 }
}
add_scientist_trait = { slot = research_speed_factor trait = scientific_genius }
add_scientist_level = 1
}
}
}
limit block to filter for scientists who are currently active, preventing the effect from applying to unassigned or inactive characters.random_scientist.random_scientist to grant a random scientist a level-up reward.limit leads to an overly broad target pool: Without a limit block, random_scientist draws from all scientists, including retired or inactive ones. Always narrow the pool with a trigger such as is_active_scientist = yes to ensure the effect only applies to intended characters.random_scientist automatically switches into the scientist scope internally — you do not need to, and should not, add another scope-switching command inside it (such as nesting every_active_scientist). Doing so will cause scope-nesting errors or unintended repeated execution.