Wiki

effect · free_random_operative

Definition

  • Supported scope:COUNTRY
  • Supported target:any

Description

Free a random captured operative of a certain tag by a certain tag
Can be used from a country scope of the operative in question.
`all` is optional, default value is no - if set to yes it will free all operatives captured by the target country
GER = { free_random_operative = { all = yes captured_by = ENG } }

实战 · 配合 · 坑

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

实战用法

free_random_operative 常用于剧本事件或决议中,模拟两国之间的外交谈判、战俘交换或间谍释放场景。例如玩家选择与某国媾和时,通过该 effect 将被对方俘虏的己方特工全部释放,还原真实的战争结束后人员遣返逻辑。

# 和平协议事件选项:ENG 释放所有被 GER 俘虏的特工
country_event = {
    id = spy_release.1
    option = {
        name = spy_release.1.a
        # 在 ENG 的 scope 下执行,释放所有被 GER 俘获的 ENG 特工
        ENG = {
            free_random_operative = {
                all = yes
                captured_by = GER
            }
        }
    }
}

配合关系

  • [has_captured_operative](/wiki/trigger/has_captured_operative) — 在执行释放前先检查目标国确实持有被俘特工,避免无效触发或逻辑错误。
  • [capture_operative](/wiki/effect/capture_operative) — 常与之对应使用,一个负责俘获特工,一个负责释放,构成完整的特工被捕/获释事件链。
  • [free_operative](/wiki/effect/free_operative) — 当已知具体特工角色时可改用此命令精确释放;free_random_operative 则适合批量或随机场景,两者互为补充。
  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier) — 释放特工后通常附加外交关系改善效果,体现两国因此举带来的关系回暖。

常见坑

  1. scope 指向错误:该 effect 必须在被俘特工所属国的 scope 下调用(即特工的本国),而非俘获方的 scope。新手容易错误地在俘获国 scope 下书写,导致命令静默失效且不报错,需仔细核对 GER = { ... } 的主语是哪一方。
  2. 省略 all 时误以为会释放全部:不写 all 字段时默认只随机释放一名特工,若想在事件中一次性遣返所有被俘人员,必须显式声明 all = yes,否则每次触发仅处理单个特工,多次触发才能清空。

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

free_random_operative is commonly used in scripted events or decisions to simulate diplomatic negotiations, prisoner exchanges, or spy releases between nations. For example, when the player chooses to make peace with a certain country, this effect can be used to release all of the player's operatives captured by the opponent, recreating the realistic logic of personnel repatriation after war concludes.

# Peace agreement event option: ENG releases all operatives captured by GER
country_event = {
    id = spy_release.1
    option = {
        name = spy_release.1.a
        # Execute under ENG's scope to release all ENG operatives captured by GER
        ENG = {
            free_random_operative = {
                all = yes
                captured_by = GER
            }
        }
    }
}

Synergy

  • [has_captured_operative](/wiki/trigger/has_captured_operative) — Check that the target country actually holds captured operatives before executing the release, preventing invalid triggers or logic errors.
  • [capture_operative](/wiki/effect/capture_operative) — Often used in tandem, with one responsible for capturing operatives and the other for releasing them, forming a complete operative capture/release event chain.
  • [free_operative](/wiki/effect/free_operative) — Can be used instead when the specific operative is known, allowing precise release; free_random_operative is suitable for bulk or random scenarios, and the two complement each other.
  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier) — After releasing operatives, diplomatic relationship improvements are typically added, reflecting the warming of relations between the two countries from this action.

Common Pitfalls

  1. Incorrect scope targeting: This effect must be called under the scope of the nation that owns the captured operatives (i.e., the operative's home country), not the capturing nation's scope. Beginners often mistakenly write it under the capturing nation's scope, causing the command to silently fail without error reporting. Carefully verify which side is the subject of GER = { ... }.
  2. Assuming all is omitted when intending to release all operatives: When the all field is not written, only one operative is released randomly by default. If you want to repatriate all captured personnel at once in an event, you must explicitly declare all = yes. Otherwise, each trigger only processes a single operative, and multiple triggers are needed to clear them all.