Wiki

trigger · has_operation_token

Definition

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

Description

Checks if a country has a specific token against another country
has_operation_token = {
	tag = GER
	token = some_token_id
}

实战 · 配合 · 坑

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

实战用法

has_operation_token 常用于情报与特工系统的 mod 中,例如判断某国是否已对目标国执行过特定间谍行动、是否积累了足够的渗透标记,从而解锁后续决策或事件选项。典型场景:玩家对德国完成潜伏行动后,才允许触发后续的破坏任务决策。

# 仅当本国持有针对 GER 的渗透令牌时,决策才可用
available = {
    has_operation_token = {
        tag = GER
        token = infiltration_stage_1
    }
}

配合关系

  • [add_operation_token](/wiki/effect/add_operation_token):先用此 effect 向目标国添加令牌,再用 has_operation_token 检测令牌是否存在,构成"写入-读取"的完整闭环。
  • [has_completed_focus](/wiki/trigger/has_completed_focus):常与国策完成检测搭配,要求玩家既完成相关情报国策、又持有令牌,双重门槛保证决策逻辑严谨。
  • [has_country_flag](/wiki/trigger/has_country_flag):令牌系统与国家旗帜联合使用,可区分"曾经执行过"(旗帜持久记录)与"当前持有令牌"(可被清除的状态)两种语义。
  • [any_operative_leader](/wiki/trigger/any_operative_leader):在需要同时检测特工人员存在的场景中配合使用,确保既有执行人员、又有对应令牌时才触发后续内容。

常见坑

  1. tag 填的是 scope 自身:新手容易把 tag 写成自己的国家标签(即当前 scope),实际上 tag 应填写令牌所针对的目标国标签,与持有令牌的主体(scope 国家)是两个不同的国家。
  2. 令牌 ID 大小写或拼写不一致token 字段的值必须与 add_operation_token 写入时的 ID 完全一致(区分大小写),哪怕多一个下划线或字母大小写不同,判断都会永远返回假且不报错,极难排查。

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

has_operation_token is commonly used in intelligence and espionage system mods to check whether a nation has executed a specific spy operation against a target country or accumulated sufficient infiltration markers, thereby unlocking subsequent decisions or event options. A typical scenario: after the player completes an infiltration operation against Germany, a follow-up sabotage decision is only allowed to trigger.

# Decision is only available when this nation holds an infiltration token against GER
available = {
    has_operation_token = {
        tag = GER
        token = infiltration_stage_1
    }
}

Synergy

  • [add_operation_token](/wiki/effect/add_operation_token): First use this effect to add a token to the target nation, then use has_operation_token to detect whether the token exists, forming a complete "write-read" cycle.
  • [has_completed_focus](/wiki/trigger/has_completed_focus): Often paired with focus completion checks, requiring the player to both complete relevant intelligence focuses and hold the token, establishing a dual-threshold logic for decision validity.
  • [has_country_flag](/wiki/trigger/has_country_flag): When combining the token system with country flags, you can distinguish between two semantic states: "has executed before" (persistent flag record) and "currently holds token" (clearable state).
  • [any_operative_leader](/wiki/trigger/any_operative_leader): Used in scenarios requiring simultaneous detection of operative personnel existence, ensuring subsequent content only triggers when both an executor exists and the corresponding token is held.

Common Pitfalls

  1. tag is filled with the scope's own value: Beginners often mistakenly set tag to their own country's tag (the current scope), but tag should actually reference the target country to which the token applies—this is a different nation from the token holder (the scope nation).
  2. Token ID case sensitivity or spelling mismatch: The value in the token field must exactly match the ID written during add_operation_token (case-sensitive). Even a single extra underscore or incorrect capitalization will cause the check to permanently return false with no error message, making it extremely difficult to debug.