Wiki

trigger · has_reserves

Definition

  • Supported scope:COMBATANT
  • Supported target:none

Description

check if side has reserves waiting

实战 · 配合 · 坑

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

实战用法

has_reserves 常用于战斗事件或 on_action 脚本中,判断某一作战方是否还有预备队等待投入战斗,从而触发特殊的战术决策事件或 trait 激活条件。例如,可以在战斗结算事件里区分"兵力充裕"与"强弩之末"两种分支,给予不同的战斗修正。

# 示例:战斗 on_action 事件,仅在进攻方有预备队时触发特殊决策
combat_event = {
    id = my_mod.1
    trigger = {
        is_attacker = yes
        has_reserves = yes
    }
    option = {
        name = my_mod.1.a
        # 触发后续效果
    }
}

配合关系

  • is_attacker — 通常需要先确认当前 scope 是进攻方还是防守方,再判断是否有预备队,使逻辑更精确。
  • reserves — 可与之配合使用:has_reserves 检查预备队是否存在,而 reserves 可进一步比较预备队的数量,形成"有无 + 多少"的两层判断。
  • frontage_full — 当正面宽度已满且仍有预备队时,说明战场处于高强度胶着状态,是触发特殊战斗事件的典型组合条件。
  • is_winning — 结合胜负态势判断:预备队充足且正在占优时,可触发"乘胜追击"类事件逻辑。

常见坑

  1. Scope 混用错误has_reserves 只在 COMBATANT scope 下有效,新手常在国家 scope(country scope)的 trigger 块中直接调用,导致脚本报错或永远返回 false,必须确保已通过战斗相关的 on_action 或 combat_event 进入正确的战斗方 scope。
  2. 将其当作数量判断has_reserves 只返回"有/无",无法判断预备队的具体数量;若需要数量比较,应改用 reserves trigger 来设定阈值,否则无法实现"预备队超过 X 师"之类的精细条件。

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_reserves is commonly used in combat events or on_action scripts to determine whether a combatant still has reserves available to commit to battle, thereby triggering special tactical decision events or trait activation conditions. For example, you can distinguish between "adequate forces" and "last stand" branches in a battle resolution event, applying different combat modifiers accordingly.

# Example: combat on_action event that triggers special decisions only when the attacker has reserves
combat_event = {
    id = my_mod.1
    trigger = {
        is_attacker = yes
        has_reserves = yes
    }
    option = {
        name = my_mod.1.a
        # Trigger subsequent effects
    }
}

Synergy

  • is_attacker — Usually you need to first confirm whether the current scope is the attacker or defender, then check for reserves, making the logic more precise.
  • reserves — Can be used in conjunction: has_reserves checks whether reserves exist at all, while reserves can further compare the quantity of reserves, creating a two-layer "existence + quantity" evaluation.
  • frontage_full — When frontage is saturated and reserves still remain, it indicates the battlefield is under intense pressure, a typical combination condition for triggering special combat events.
  • is_winning — Judge in combination with battle outcome: when reserves are sufficient and you hold the advantage, you can trigger "pursue the victory" type event logic.

Common Pitfalls

  1. Scope mixing errors: has_reserves is only valid in COMBATANT scope; beginners often call it directly in trigger blocks under country scope, causing script errors or always returning false. You must ensure you have entered the correct combatant scope through combat-related on_action or combat_event mechanics.
  2. Treating it as a quantity check: has_reserves only returns "yes/no" and cannot determine the exact quantity of reserves; if you need quantity comparisons, use the reserves trigger instead to set thresholds, otherwise you cannot implement fine-grained conditions like "reserves exceed X divisions".