Wiki

trigger · hardness

Definition

  • Supported scope:COMBATANT
  • Supported target:none

Description

check lowest/highest hardness level on combatant

实战 · 配合 · 坑

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

实战用法

hardness 常用于判断交战方部队的机械化/装甲程度,从而触发特定事件或调整战斗修正——例如在"装甲突破"相关 mod 中,根据敌方硬度最低值来决定是否给予穿透加成事件,或在动态战术 mod 里让 AI 选择更合适的应对特质。

# 示例:若交战方中最低硬度极低,则判定为"软目标"战斗
limit = {
    hardness < 0.2   # 最低硬度低于 20%,判定为纯步兵交战
    is_attacker = yes
}

配合关系

  • armor — 装甲值与硬度往往同步检查,二者共同判断交战部队的装甲化程度,避免单靠一个指标误判。
  • has_unit_type — 用来先确认编队中存在特定兵种(如装甲师),再用 hardness 验证整体硬度是否达标,逻辑更严谨。
  • is_attacker / is_defender — 区分攻防身份后再判硬度,可以分别为进攻方装甲突击和防御方反坦克设计不同触发条件。
  • fastest_unit — 高硬度部队通常也是高速单位,两者配合可识别典型装甲快速突击集群。

常见坑

  1. 混淆 lowest/highest 的判定方向hardness 取的是交战方中最低或最高硬度,而非平均值,新手常以为它等同于编队平均硬度,导致判断条件设置偏差——务必结合 average_stats 来对比区别。
  2. 在非 COMBATANT scope 下使用hardness 只在战斗 scope(COMBATANT)内有效,若写在国家或师团 scope 的 trigger 块中会静默失败(永远返回 false),调试时极难察觉。

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

hardness is commonly used to assess the mechanization and armor level of combatant forces, triggering specific events or adjusting combat modifiers accordingly—for example, in armor breakthrough-related mods, it can determine whether to grant penetration bonuses based on the enemy's minimum hardness value, or in dynamic doctrine mods, it can help the AI select more appropriate response traits.

# Example: If the minimum hardness among combatants is very low, classify as "soft target" engagement
limit = {
    hardness < 0.2   # Minimum hardness below 20%, classified as pure infantry engagement
    is_attacker = yes
}

Synergy

  • armor — Armor value and hardness are often checked in parallel, together determining the mechanization level of combatant forces and avoiding misjudgments from relying on a single metric.
  • has_unit_type — Use this to first confirm the presence of specific unit types in the composition (such as armored divisions), then verify with hardness whether overall hardness meets the threshold for more rigorous logic.
  • is_attacker / is_defender — After distinguishing attack/defense roles, hardness can be evaluated separately, allowing different trigger conditions for armored assaults by attackers and anti-tank defenses by defenders.
  • fastest_unit — High hardness forces typically also have high speed; combining both metrics can identify typical armored fast-breakthrough clusters.

Common Pitfalls

  1. Confusing lowest/highest evaluation direction: hardness takes the minimum or maximum hardness among combatants, not the average, and newcomers often mistakenly treat it as equivalent to composition average hardness, leading to misconfigured trigger conditions—always cross-reference with average_stats to clarify the distinction.
  2. Using outside COMBATANT scope: hardness is only valid within combat scope (COMBATANT); if placed in triggers within country or division scope blocks, it silently fails (always returns false), making it extremely difficult to detect during debugging.