trigger · has_reserves
Definition
- Supported scope:
COMBATANT - Supported target:
none
Description
check if side has reserves waiting
has_reservesCOMBATANTnonecheck 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
# 触发后续效果
}
}
has_reserves 检查预备队是否存在,而 reserves 可进一步比较预备队的数量,形成"有无 + 多少"的两层判断。has_reserves 只在 COMBATANT scope 下有效,新手常在国家 scope(country scope)的 trigger 块中直接调用,导致脚本报错或永远返回 false,必须确保已通过战斗相关的 on_action 或 combat_event 进入正确的战斗方 scope。has_reserves 只返回"有/无",无法判断预备队的具体数量;若需要数量比较,应改用 reserves trigger 来设定阈值,否则无法实现"预备队超过 X 师"之类的精细条件。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.
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
}
}
has_reserves checks whether reserves exist at all, while reserves can further compare the quantity of reserves, creating a two-layer "existence + quantity" evaluation.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.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".