Wiki

effect · remove_operation_token

Definition

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

Description

Remove a specific token against against another country
remove_operation_token = {
	tag = GER
	token = some_token_id
}

实战 · 配合 · 坑

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

实战用法

remove_operation_token 常用于情报行动类 mod 中,在特定事件触发后撤销某国对另一国累积的行动令牌,例如外交谈判达成协议时清除针对该国的渗透标记。它也适用于周期性重置机制,避免令牌无限叠加导致脚本判断异常。

# 当 GER 与 SOV 签署协议事件中,移除针对苏联的侦察令牌
country_event = {
    id = my_mod.42
    option = {
        name = my_mod.42.a
        remove_operation_token = {
            tag = SOV
            token = ger_spy_recon_token
        }
    }
}

配合关系

  • [add_operation_token](/wiki/effect/add_operation_token):与 remove_operation_token 形成完整的"添加/移除"生命周期管理,通常先 add 后在条件满足时 remove,构成令牌的状态机。
  • [has_country_flag](/wiki/trigger/has_country_flag):在执行移除前先检查对应国家标记,确认令牌确实处于激活状态,避免无效调用引发脚本警告。
  • [clr_country_flag](/wiki/effect/clr_country_flag):令牌移除后往往需要同步清除相关国家标记,两者配合保持脚本状态的一致性。
  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier):在行动令牌被移除(代表敌对行动结束)的同时添加正面舆论修正,给玩家反馈外交改善的结果。

常见坑

  1. tag 填写错误对象tag 指的是令牌所针对的目标国(即当初 add_operation_token 时的 tag),而非执行移除的发起国;新手经常将两者混淆,导致令牌实际上未被删除但也不报错,难以排查。
  2. token 字符串与添加时不一致token 的值必须与 add_operation_token 中使用的完全相同(区分大小写),哪怕一个下划线或大小写不同,移除操作都会静默失败,令牌依然残留在游戏状态中。

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

remove_operation_token is commonly used in intelligence operation mods to revoke accumulated operation tokens from one nation targeting another upon specific event triggers—for example, clearing infiltration markers against a target nation when diplomatic negotiations reach agreement. It's also useful for periodic reset mechanisms, preventing unlimited token stacking that could cause script logic errors.

# When GER signs an agreement with SOV in an event, remove the reconnaissance token targeting the Soviet Union
country_event = {
    id = my_mod.42
    option = {
        name = my_mod.42.a
        remove_operation_token = {
            tag = SOV
            token = ger_spy_recon_token
        }
    }
}

Synergy

  • [add_operation_token](/wiki/effect/add_operation_token): Forms a complete "add/remove" lifecycle management with remove_operation_token. Typically tokens are added first, then removed once conditions are met, creating a state machine for token management.
  • [has_country_flag](/wiki/trigger/has_country_flag): Check the corresponding country flag before executing removal to confirm the token is actually active, preventing invalid calls that could trigger script warnings.
  • [clr_country_flag](/wiki/effect/clr_country_flag): After removing a token, related country flags often need to be cleared simultaneously; both work together to maintain script state consistency.
  • [add_opinion_modifier](/wiki/effect/add_opinion_modifier): When an operation token is removed (signifying the end of hostile operations), apply a positive opinion modifier simultaneously to give players feedback that diplomatic relations have improved.

Common Pitfalls

  1. Incorrect tag target: The tag refers to the target nation that the token is directed against (the same tag used in the original add_operation_token), not the nation initiating the removal. Newcomers often confuse the two, resulting in the token not actually being deleted without any error message, making it difficult to debug.
  2. token string mismatch with addition: The token value must exactly match what was used in add_operation_token (case-sensitive). Even a single underscore or capitalization difference will cause the removal to fail silently, leaving the token lingering in the game state.