Hands-On Usage
all_active_scientists is commonly used inside available/trigger blocks for decisions, focuses, or events to check whether every currently active scientist meets a specific condition before the block evaluates to true — for example, requiring all scientists to have reached a certain skill level or to possess a particular trait. It is also frequently used inside limit blocks alongside loops to validate the state of all scientists before performing bulk operations.
# Example: the decision is only available when all active scientists in GER possess the "scientist_trait_physics_expert" trait
available = {
GER = {
all_active_scientists = {
has_scientist_level = {
level > 2
}
}
}
}
Synergy
- is_active_scientist: Use this trigger first to confirm that a character is in an active state, then perform more granular condition checks inside the
all_active_scientists block — the two complement each other logically.
- has_scientist_level: The most common inner check used within
all_active_scientists, used to verify whether each active scientist meets a required skill level threshold.
- has_trait: Used inside the block to check whether every active scientist holds a specific trait — the quintessential pattern for bulk trait validation.
- every_active_scientist: Once the
all_active_scientists condition evaluates to true, it is standard practice to immediately follow up with every_active_scientist to apply bulk effects to all active scientists, forming the classic "check first, then act" pattern.
Common Pitfalls
- Confusing semantics with
any_active_scientist: all_active_scientists requires every active scientist to satisfy the condition before returning true. If only one scientist needs to qualify, use any_of_scopes with a scientist iterator or the corresponding any_* iterator instead. Treating the two as synonyms results in conditions far stricter than intended, causing extremely low trigger rates that are difficult to notice.
- Forgetting to scope correctly: Writing
all_active_scientists = { ... } bare at the top level of a trigger block without explicitly wrapping it in a country scope (e.g. ROOT = { ... }) will cause the script to fail silently or throw an error if the current context scope is not of type COUNTRY. Always confirm that the enclosing scope is a COUNTRY scope.