Wiki

trigger · all_active_scientist

Definition

  • Supported scope:COUNTRY
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

Checks if all active scientists of the Country in scope matches the triggers.
ex: GER = {
  all_active_scientists = {
	tooltip = my_loc_key # Optional
     ... Character scope triggers ...
  }
}

实战 · 配合 · 坑

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

实战用法

all_active_scientist 常用于在某个决议、焦点或事件的 available/trigger 块中,检查所有在职科学家是否都满足特定条件才能触发,例如要求所有科学家均已达到特定技能等级或拥有某特质。也常用在 limit 里配合循环过滤,确保批量操作前先验证全体科学家状态。

# 示例:只有当德国所有在职科学家都拥有 "scientist_trait_physics_expert" 特质时,决议才可用
available = {
    GER = {
        all_active_scientists = {
            has_scientist_level = {
                level > 2
            }
        }
    }
}

配合关系

  • is_active_scientist:先用此 trigger 确认角色处于活跃状态,再在 all_active_scientists 块内做更细粒度的条件判断,逻辑互为补充。
  • has_scientist_level:在 all_active_scientists 的内层最常见的具体检查手段,用于验证每位在职科学家的等级是否达标。
  • has_trait:在内层检查每位在职科学家是否都持有某一特定特质,是最典型的批量特质验证搭配。
  • every_active_scientist:当 all_active_scientists 的条件判断为真后,通常紧接着用 every_active_scientist 对全体在职科学家执行批量 effect 操作,形成"先判断、后执行"的标准模式。

常见坑

  1. any_active_scientist 语义混淆all_active_scientists 要求所有在职科学家都满足条件才返回真;若只需其中一人满足,应改用 any_of_scopes 配合科学家迭代,或使用对应的 any_* 迭代器——把两者当作同义词会导致条件远比预期严苛,触发率极低却难以察觉。
  2. 忘记限定 scope:直接在顶层 trigger 块裸写 all_active_scientists = { ... } 而没有明确指定国家 scope(如 ROOT = { ... } 包裹)时,若上下文 scope 不是 COUNTRY 类型,脚本会静默失败或报错,务必确认外层 scope 为 COUNTRY。

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

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

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