Wiki

trigger · has_max_planning

Definition

  • Supported scope:COMBATANT
  • Supported target:none

Description

check if side has maximal planning bonus

实战 · 配合 · 坑

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

实战用法

has_max_planning 常用于战斗事件或 on_action 触发器中,判断某一交战方是否已达到最大计划加成,从而决定是否触发特定的战斗奖励、特质解锁或 AI 行为分支。例如,在自定义战斗事件中,当进攻方计划加成拉满时,给予额外的士气或作战加成:

combat_event = {
    id = my_mod.1
    trigger = {
        is_attacker = yes
        has_max_planning = yes
    }
    # 事件内容...
}

配合关系

  • min_planning:两者形成"计划加成区间"判断,min_planning 检查当前加成是否达到某一下限,结合 has_max_planning 可区分"刚开始计划"和"计划已满"两种状态。
  • is_attacker / is_defender:计划加成通常只对进攻方有意义,配合阵营角色判断可避免条件被错误 scope 命中。
  • phase:战斗阶段直接影响计划加成的积累进度,与 has_max_planning 搭配可精确描述"在某一阶段且计划已满"的战况。
  • planning_skill_level:指挥官的计划技能决定计划加成上限,配合使用可区分"技能高但未满"与"已达当前上限"的差异。

常见坑

  1. Scope 混用has_max_planning 只能在 COMBATANT scope(即战斗中的交战方)内使用,新手容易将其写在国家 scope 或将领 scope 下,导致脚本报错或静默失败,务必确认外层是 combat_event 或正确的战斗 on_action。
  2. min_planning 语义混淆min_planning 接受一个数值参数检查计划加成下限,而 has_max_planning 是无参数的布尔检查,新手有时会尝试给 has_max_planning 传值(如 has_max_planning = yes 之外写数字),这是无效写法。

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_max_planning is commonly used in combat events or on_action triggers to determine whether a combatant has reached maximum planning bonus, thereby deciding whether to trigger specific combat rewards, trait unlocks, or AI behavior branches. For example, in a custom combat event, when the attacker's planning bonus is maxed out, grant additional morale or combat bonuses:

combat_event = {
    id = my_mod.1
    trigger = {
        is_attacker = yes
        has_max_planning = yes
    }
    # Event content...
}

Synergy

  • min_planning: Together they form a "planning bonus range" check. min_planning verifies whether the current bonus reaches a lower threshold, and combined with has_max_planning you can distinguish between "planning just started" and "planning maxed out" states.
  • is_attacker / is_defender: Planning bonus typically only applies to the attacker. Combined with faction role checks, this avoids conditions being incorrectly evaluated in the wrong scope.
  • phase: Combat phase directly affects the accumulation progress of planning bonus. Paired with has_max_planning, it precisely describes combat situations like "in a specific phase and planning is maxed out".
  • planning_skill_level: The commander's planning skill determines the planning bonus cap. Using them together distinguishes between "high skill but not maxed" and "reached current cap".

Common Pitfalls

  1. Scope Misuse: has_max_planning can only be used within COMBATANT scope (i.e., combatants in a fight). Beginners often write it under country scope or general scope, causing script errors or silent failures. Always confirm the outer layer is combat_event or the correct combat on_action.
  2. Semantic Confusion with min_planning: min_planning accepts a numeric parameter to check the planning bonus lower limit, while has_max_planning is a parameterless boolean check. Beginners sometimes attempt to pass a value to has_max_planning (e.g., writing numbers beyond has_max_planning = yes), which is invalid syntax.