Wiki

effect · every_operative

Definition

  • Supported scope:COUNTRY, OPERATION
  • Supported target:none

Description

Executes children effects on every operative (or \"random_select_amount\" of random operatives if specified) that fulfills the \"limit\" trigger.
tooltip=key can be added to override tooltip title.
By default the effects are only displayed once, you may display them for each matching operative with display_individual_scopes.
ex: GER = {
  every_operative = {
	tooltip = my_loc_key # Optional
	random_select_amount = 3 # Optional
    display_individual_scopes = yes # Optional - default = no
    ... character scope effects ...
  }
}

实战 · 配合 · 坑

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

实战用法

every_operative 常用于间谍系统相关的 mod 场景,例如在某事件触发时批量给本国所有特工提升技能、添加特质,或清除特定标记。也可配合 random_select_amount 随机选取若干特工执行奖惩,适合模拟"情报泄露后部分特工被召回"等剧情。

GER = {
    every_operative = {
        tooltip = ger_operative_purge_tt
        random_select_amount = 3
        limit = {
            is_operative = yes
            has_trait = operative_tough
        }
        add_trait = { trait = operative_well_connected }
        add_skill_level = 1
    }
}

配合关系

  • is_operative — 在 limit 块内用于确保只筛选特工角色,避免与其他 character scope 混用时误伤。
  • has_trait — 常放入 limit 中,按特工已有特质精确筛选执行对象。
  • add_unit_leader_trait — 与 every_operative 配合批量为符合条件的特工添加单位领导人特质,实现集体能力升级。
  • kill_operative — 在事件惩罚逻辑中,对满足条件的特工直接执行消除,配合 limit 控制范围以防误杀。

常见坑

  1. 忘记 is_operative 限制导致 scope 错误every_operative 在 COUNTRY scope 下会遍历所有 character,若 limit 不加 is_operative = yes 的过滤,某些针对特工专属的 effect(如 kill_operative)作用在非特工角色上会静默失败或报错,务必在 limit 中明确限定。
  2. 误以为 OPERATION scope 行为与 COUNTRY scope 相同:在 OPERATION scope 下调用 every_operative 时,遍历范围仅限参与该行动的特工,而非国家全部特工,切勿将两种用法的脚本直接互换,否则筛选集合会截然不同。

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

every_operative is commonly used in spy-system mods — for example, bulk-upgrading skills, adding traits, or clearing specific flags for all of a country's operatives when an event fires. It also works with random_select_amount to randomly select a subset of operatives for rewards or punishments, making it well-suited for storylines like "some operatives are recalled after an intelligence leak."

GER = {
    every_operative = {
        tooltip = ger_operative_purge_tt
        random_select_amount = 3
        limit = {
            is_operative = yes
            has_trait = operative_tough
        }
        add_trait = { trait = operative_well_connected }
        add_skill_level = 1
    }
}

Synergy

  • is_operative — Used inside a limit block to ensure only operative characters are targeted, preventing accidental hits when other character scopes are in play.
  • has_trait — Commonly placed in limit to filter operatives precisely by traits they already possess.
  • add_unit_leader_trait — Pairs with every_operative to bulk-add unit leader traits to qualifying operatives, enabling collective capability upgrades.
  • kill_operative — Used in event punishment logic to eliminate operatives who meet certain conditions; combine with limit to control scope and avoid unintended removals.

Common Pitfalls

  1. Forgetting the is_operative restriction causes scope errors: every_operative in a COUNTRY scope iterates over all characters. If limit does not include is_operative = yes, operative-exclusive effects such as kill_operative applied to non-operative characters will either fail silently or throw an error. Always explicitly restrict the scope inside limit.
  2. Assuming OPERATION scope behaves the same as COUNTRY scope: When every_operative is called from an OPERATION scope, it only iterates over the operatives participating in that specific operation — not all operatives belonging to the country. Never swap scripts written for one scope directly into the other, as the resulting selection sets will be entirely different.