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
- 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 = { ... }.
- 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.