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
- 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.
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.