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
- 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.
- 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.