Wiki

trigger · num_free_operative_slots

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Checks the number of operative a country can recruit right now.
Note that this is not necessarily greater than zero if num_operative_slots returned a number greater than the number of operative.

实战 · 配合 · 坑

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

实战用法

num_free_operative_slots 常用于情报机构相关事件或决策的 available 块中,确保玩家在执行"派遣特工"类决策前确实有空闲特工名额可用,避免决策触发后因无法招募而逻辑断裂。也可用在 AI 策略触发器里,让 AI 仅在有余量时才尝试招募新特工。

# 决策:派遣秘密特工
available = {
    has_intelligence_agency = yes
    num_free_operative_slots > 0
}

配合关系

  • [any_operative_leader](/wiki/trigger/any_operative_leader) — 常与之搭配,先检查是否有空闲槽位,再用 any_operative_leader 筛选特定类型或特质的特工,确保两个条件同时满足才解锁后续逻辑。
  • [create_operative_leader](/wiki/effect/create_operative_leader) — 空闲槽位大于零时才执行创建特工的 effect,否则创建操作会静默失败或产生意料外行为。
  • [has_intelligence_agency](/wiki/trigger/has_intelligence_agency) — 槽位依赖情报机构存在,两者几乎总是同时出现在前置条件块中,缺少情报机构时槽位判断本身无意义。
  • [free_operative](/wiki/effect/free_operative) — 当需要"先释放再补充"的逻辑时,先用本 trigger 判断是否已有空位,若无则配合 free_operative 腾出槽位后再行动。

常见坑

  1. 混淆"总槽位数"与"空闲槽位数"num_free_operative_slots 返回的是当前可立即招募的名额,不等于总槽位上限。若所有槽位已被在役特工占满,即使 num_operative_slots 返回值很大,本 trigger 也可能为 0,新手常误以为两者等价而跳过此检查。
  2. 在非 COUNTRY scope 下使用:该 trigger 仅对国家 scope 有效,若不小心写在 any_operative_leaderany_owned_state 等子 scope 内部,游戏不会报错但判断结果不可预期,应确保始终在顶层国家 scope 中调用。

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

num_free_operative_slots is commonly used in the available block of intelligence agency–related events or decisions to ensure the player actually has available operative slots before executing "deploy operative" type decisions, preventing logic breaks when recruitment fails after triggering. It can also be used in AI strategy triggers, allowing the AI to attempt recruiting new operatives only when capacity is available.

# Decision: Deploy Secret Operative
available = {
    has_intelligence_agency = yes
    num_free_operative_slots > 0
}

Synergy

  • [any_operative_leader](/wiki/trigger/any_operative_leader) — Often paired together; first check if free slots are available, then use any_operative_leader to filter operatives by specific type or traits, ensuring both conditions are met before unlocking subsequent logic.
  • [create_operative_leader](/wiki/effect/create_operative_leader) — Execute the operative creation effect only when free slots are greater than zero; otherwise the creation operation will silently fail or produce unexpected behavior.
  • [has_intelligence_agency](/wiki/trigger/has_intelligence_agency) — Slots depend on the intelligence agency's existence; these two almost always appear together in prerequisite blocks. Without the intelligence agency, slot checks become meaningless.
  • [free_operative](/wiki/effect/free_operative) — When requiring a "free then replenish" logic pattern, first use this trigger to check if slots are already available; if not, use free_operative to vacate slots before proceeding.

Common Pitfalls

  1. Confusing "total slots" with "free slots": num_free_operative_slots returns the number of slots immediately available for recruitment, not equal to the total slot limit. If all slots are occupied by active operatives, even if num_operative_slots returns a large value, this trigger may still evaluate to 0. Beginners often mistakenly treat the two as equivalent and skip this check.
  2. Using outside COUNTRY scope: This trigger only works in country scope. If accidentally placed inside sub-scopes like any_operative_leader or any_owned_state, the game won't error but evaluation results become unpredictable. Always ensure it's called at the top-level country scope.