Wiki

trigger · is_operative

Definition

  • Supported scope:CHARACTER
  • Supported target:none

Description

is_operative = yes/no - Checks if the current character is an operative

实战 · 配合 · 坑

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

实战用法

is_operative 常用于需要区分角色类型的场景,例如为情报官员专属事件设置触发条件,或在角色管理 mod 中限制某些 trait / 顾问角色只能授予特工而非将领。典型场景是在角色 focus 或事件的 trigger 块中,确保当前角色确实是特工身份再执行后续逻辑。

# 仅当角色是特工时,才允许触发该事件
character_event = {
    id = my_mod.1
    trigger = {
        is_operative = yes
        is_operative_captured = no
    }
    ...
}

配合关系

  • [is_operative_captured](/wiki/trigger/is_operative_captured):最常见的组合——先确认是特工,再进一步判断其是否被捕,两层检查共同构成完整的状态过滤。
  • [operative_leader_mission](/wiki/trigger/operative_leader_mission):在确认角色为特工后,进一步检测其当前执行的任务类型,用于针对特定任务触发不同剧情或奖励。
  • [kill_operative](/wiki/effect/kill_operative) / [free_operative](/wiki/effect/free_operative):在 effect 块中,通常先以 is_operative = yes 作为前置 limit 条件再调用这些效果,避免对非特工角色误触发执行逻辑。
  • [has_trait](/wiki/trigger/has_trait):配合使用可筛选具备特定特质的特工,例如只对拥有某隐蔽技能 trait 的特工应用后续判断或效果。

常见坑

  1. 在非 CHARACTER scope 下使用is_operative 只在 CHARACTER scope 有效,若在国家 scope(如 country_event 的顶层 trigger 块)直接写会报错或静默失败,需先通过 any_character / every_character 等迭代进入角色 scope 再使用。
  2. 误以为将领也会返回 yesis_operative = yes 仅对情报特工角色为真,陆军将领、海军将领等同样是 CHARACTER scope 的角色并不满足此条件,不能用它泛指"所有角色",需搭配 is_unit_leader 等分别处理不同角色类型。

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

is_operative is commonly used in scenarios requiring distinction between character types—for example, setting trigger conditions for intelligence officer-exclusive events, or in character management mods to restrict certain traits or advisor roles to operatives only rather than unit leaders. A typical use case appears in character focus or event trigger blocks, ensuring the current character is indeed an operative before executing subsequent logic.

# Only trigger this event if the character is an operative
character_event = {
    id = my_mod.1
    trigger = {
        is_operative = yes
        is_operative_captured = no
    }
    ...
}

Synergy

  • [is_operative_captured](/wiki/trigger/is_operative_captured): The most common pairing—first confirm operative status, then further check capture state. These two checks together form a complete state filter.
  • [operative_leader_mission](/wiki/trigger/operative_leader_mission): After confirming a character is an operative, check the mission type currently being executed to trigger different storylines or rewards based on specific missions.
  • [kill_operative](/wiki/effect/kill_operative) / [free_operative](/wiki/effect/free_operative): In effect blocks, typically use is_operative = yes as a preceding limit condition before invoking these effects to avoid accidentally triggering logic on non-operative characters.
  • [has_trait](/wiki/trigger/has_trait): Combined usage allows filtering operatives with specific traits—for example, applying subsequent checks or effects only to operatives with certain covert skill traits.

Common Pitfalls

  1. Using outside CHARACTER scope: is_operative is only valid within CHARACTER scope. Using it directly in country scope (such as the top-level trigger block of a country_event) will cause errors or silent failure. You must enter character scope first via any_character / every_character or similar iteration before using it.
  2. Mistakenly assuming unit leaders return yes: is_operative = yes is true only for intelligence operative characters. Army commanders, naval commanders, and other CHARACTER scope characters do not satisfy this condition. You cannot use it to refer generically to "all characters"—you must handle different character types separately using is_unit_leader and similar checks.