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
- 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.
- 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.