Wiki

effect · random_operative

Definition

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

Description

Executes children effects on a random operatives that fulfills the "limit" trigger.

实战 · 配合 · 坑

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

实战用法

random_operative 常用于特工系统相关的 mod 场景,例如随机为某国一名未被捕的特工升级技能或添加特质,实现"情报事件触发随机奖励"的效果。也可在行动结束后用于随机惩罚一名正在执行任务的特工,增加情报战的不确定性。

# 某国完成情报事件后,随机提升一名未被捕特工的技能
country_event = {
    id = my_intel.1
    option = {
        name = my_intel.1.a
        random_operative = {
            limit = {
                is_operative_captured = no
                has_nationality = ROOT
            }
            add_skill_level = 1
            add_trait = { token = operative_resourceful }
        }
    }
}

配合关系

  • is_operative_captured — 在 limit 块中过滤被捕状态,确保效果只作用于自由行动的特工,避免逻辑错误。
  • operative_leader_mission — 在 limit 块中进一步筛选正在执行特定任务的特工,使随机选取更精准。
  • add_trait — 随机为选中特工附加特质,是该 scope 下最常见的奖惩手段之一。
  • kill_operative — 与 random_operative 配合实现"随机牺牲一名特工"的高风险情报事件叙事。

常见坑

  1. limit 写在外部而非内部limit 必须作为 random_operative 的子块存在,若写在外层 optionimmediate 的条件判断位置,筛选将完全不生效,导致效果作用于任意一名特工(包括被捕或敌方的)。
  2. 在不支持的 scope 中使用:该 effect 仅在 COUNTRYOPERATION scope 下有效;若在 STATE 或其他 scope 中调用,游戏会静默忽略或报错,新手容易因为 scope 切换不当(如直接在 every_state 块内调用)而导致效果失效。

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

random_operative is commonly used in mod scenarios involving the operative system — for example, randomly upgrading a skill or adding a trait to one uncaptured operative belonging to a country, achieving a "random reward triggered by an intelligence event" effect. It can also be used after a mission concludes to randomly penalize an operative currently on assignment, adding uncertainty to intelligence warfare.

# After a country completes an intelligence event, randomly increase the skill of one uncaptured operative
country_event = {
    id = my_intel.1
    option = {
        name = my_intel.1.a
        random_operative = {
            limit = {
                is_operative_captured = no
                has_nationality = ROOT
            }
            add_skill_level = 1
            add_trait = { token = operative_resourceful }
        }
    }
}

Synergy

  • is_operative_captured — Filter by capture status inside the limit block to ensure the effect only applies to operatives who are free, preventing logic errors.
  • operative_leader_mission — Further narrow the selection inside limit to operatives currently executing a specific mission, making the random pick more precise.
  • add_trait — Randomly attach a trait to the selected operative; one of the most common reward/penalty tools available in this scope.
  • kill_operative — Combine with random_operative to craft high-stakes intelligence event narratives where a random operative is sacrificed.

Common Pitfalls

  1. Placing limit outside instead of inside: limit must exist as a child block of random_operative. If it is written at the outer option or immediate level as a condition check, the filter will have no effect whatsoever, causing the effect to apply to any operative at random — including captured ones or those belonging to the enemy.
  2. Using this effect in an unsupported scope: This effect is only valid within the COUNTRY and OPERATION scopes. Calling it from a STATE scope or any other unsupported scope will cause the game to silently ignore it or throw an error. Beginners often run into this by inadvertently switching scopes — for instance, calling it directly inside an every_state block — and then wondering why the effect never fires.