Wiki

trigger · has_artillery_ratio

Definition

  • Supported scope:COMBATANT
  • Supported target:none

Description

Check that ratio of atrillery battalions in the composition of a side of combating troops are over a certain level.
For example:
has_artillery_ratio > 0.1

实战 · 配合 · 坑

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

实战用法

has_artillery_ratio 常用于战斗相关的动态事件或决议中,例如当炮兵比例达到一定阈值时触发特殊战术奖励事件,或在自定义战斗 AI 特质的 available 条件里限制某些战术只在炮兵密度足够时才能选用。也可用于成就 mod 中,检测玩家某场战役的炮兵占比以解锁特定纪念称号。

# 仅当己方炮兵比例超过 30% 时,该战斗特质才可被选择
can_select_trait = {
    OR = {
        has_artillery_ratio > 0.3
        has_cavalry_ratio > 0.5
    }
}

配合关系

  • [has_cavalry_ratio](/wiki/trigger/has_cavalry_ratio):同为兵种比例检测 trigger,常并列写在 OR/AND 块中,用于区分"炮兵密集型"与"骑兵突击型"两种战术路线的判断条件。
  • [is_attacker](/wiki/trigger/is_attacker):配合使用可将炮兵比例检测限定在进攻方,避免防守方误触同一条件,逻辑更精确。
  • [frontage_full](/wiki/trigger/frontage_full):当正面宽度已被填满且炮兵比例也达标时,可判定为"重炮饱和进攻"状态,适合触发对应的战斗事件。
  • [phase](/wiki/trigger/phase):结合战斗阶段一起判断,可以在特定炮击阶段额外校验炮兵比例,确保触发时机的战术合理性。

常见坑

  1. 写成赋值语法而非比较语法:新手容易写成 has_artillery_ratio = 0.3,但该 trigger 必须使用 > / < 等比较运算符,写等号会导致条件永远无法正确求值甚至报错。
  2. 在非 COMBATANT scope 下调用:此 trigger 只在战斗双方的 combatant scope 内有效,若误放在国家 scope(如顶层 trigger 块或 focusavailable 里)将不会生效,需确保外层已通过战斗事件等方式进入正确 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

has_artillery_ratio is commonly used in combat-related dynamic events or decisions, such as triggering special tactical bonus events when artillery ratio reaches a certain threshold, or restricting certain tactics to only be available when artillery density is sufficient within custom combat AI trait available conditions. It can also be used in achievement mods to detect the player's artillery composition in a specific campaign and unlock dedicated commendations.

# This combat trait can only be selected when own artillery ratio exceeds 30%
can_select_trait = {
    OR = {
        has_artillery_ratio > 0.3
        has_cavalry_ratio > 0.5
    }
}

Synergy

  • [has_cavalry_ratio](/wiki/trigger/has_cavalry_ratio): Another unit composition ratio detection trigger, often written in parallel within OR/AND blocks to distinguish between "artillery-intensive" and "cavalry assault" tactical routes.
  • [is_attacker](/wiki/trigger/is_attacker): When used in combination, artillery ratio detection can be limited to the attacking side, preventing unintended triggers on the defending side and achieving more precise logic.
  • [frontage_full](/wiki/trigger/frontage_full): When frontage is completely filled and artillery ratio meets the threshold, it indicates a "heavy artillery saturation attack" state, suitable for triggering corresponding combat events.
  • [phase](/wiki/trigger/phase): When combined with combat phase checks, allows additional artillery ratio validation during specific artillery bombardment phases, ensuring tactical soundness of the trigger timing.

Common Pitfalls

  1. Using assignment syntax instead of comparison syntax: Beginners often write has_artillery_ratio = 0.3, but this trigger must use comparison operators like > / <. Using an equals sign will cause the condition to fail evaluation or throw an error.
  2. Calling outside COMBATANT scope: This trigger is only valid within the combatant scope of both sides of combat. If mistakenly placed in country scope (such as top-level trigger blocks or focus available conditions), it will have no effect. Ensure the outer scope is correctly entered through combat events or similar methods.