Wiki

trigger · any_active_scientist

Definition

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

Description

Checks if at least one active scientist of the Country in scope matches the triggers.
ex: GER = {
  any_active_scientist = {
	tooltip = my_loc_key # Optional
    ... Character scope triggers ...
  }
}

实战 · 配合 · 坑

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

实战用法

any_active_scientist 常用于科研类 mod 中,检测国家是否存在满足特定条件的在职科学家,例如限制某个决策只有在拥有特定特质或等级的科学家时才能触发。它也适用于事件的 trigger 块,判断某国是否具备足够的科研人才来解锁特殊研究路线。

# 检查德国是否有至少一名拥有 nuclear_scientist 特质的在职科学家
GER = {
    any_active_scientist = {
        has_scientist_level = {
            level > 2
        }
        has_trait = nuclear_scientist
    }
}

配合关系

  • every_active_scientist:与 any_active_scientist 逻辑互补,前者用于遍历并对所有符合条件的在职科学家执行 effect,常在条件满足后的 effect 块中配对使用。
  • has_scientist_level:在 any_active_scientist 内部过滤科学家等级,是最常见的内部筛选条件之一。
  • has_trait:在科学家 scope 内检查其特质,与 any_active_scientist 结合可精确定位特定专长的科学家。
  • is_active_scientist:单独用于 character scope 时判断某角色是否处于在职状态,与 any_active_scientist 配合可在不同层级做双重验证。

常见坑

  1. scope 用错any_active_scientist 只能在 COUNTRY scope 下使用,若写在 STATE 或 CHARACTER scope 内会导致脚本报错或静默失败,需确保外层是国家 scope(如 GER = { ... }ROOT = {(ROOT 为国家时)。
  2. 内部写国家级 triggerany_active_scientist 的花括号内已自动切换到 CHARACTER scope,不能在里面直接写国家级 trigger(如 tag = GER),应只使用角色相关的 trigger(如 has_traithas_scientist_level 等)。

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

any_active_scientist is commonly used in research-focused mods to check whether a country has at least one active scientist meeting specific conditions — for example, restricting a decision so it can only fire when a scientist with a particular trait or skill level is present. It is equally useful inside event trigger blocks to determine whether a country has sufficient scientific talent to unlock a special research path.

# Check whether Germany has at least one active scientist with the nuclear_scientist trait and a level above 2
GER = {
    any_active_scientist = {
        has_scientist_level = {
            level > 2
        }
        has_trait = nuclear_scientist
    }
}

Synergy

  • every_active_scientist: The logical counterpart to any_active_scientist. Where any_active_scientist tests a condition, every_active_scientist iterates over all qualifying active scientists and applies an effect — the two are frequently paired together, with the former in the trigger block and the latter in the effect block.
  • has_scientist_level: Filters scientists by skill level inside any_active_scientist; one of the most common inner conditions used with this trigger.
  • has_trait: Checks a scientist's trait within the character scope. Combined with any_active_scientist, it allows precise targeting of scientists with a specific specialisation.
  • is_active_scientist: Used in a character scope to check whether a specific character is currently active. Pairing it with any_active_scientist enables double verification across different scope levels.

Common Pitfalls

  1. Wrong scope: any_active_scientist can only be used inside a COUNTRY scope. Placing it inside a STATE or CHARACTER scope will cause a script error or a silent failure. Always ensure the enclosing scope is a country scope (e.g. GER = { ... } or ROOT = { where ROOT resolves to a country).
  2. Writing country-level triggers inside the block: The braces of any_active_scientist automatically switch the scope to CHARACTER. Country-level triggers such as tag = GER cannot be used directly inside it — only character-relevant triggers (e.g. has_trait, has_scientist_level) are valid there.