Wiki

trigger · strength_ratio

Definition

  • Supported scope:COUNTRY
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

Compares the estimated army strength between the scope country and the one set with 'tag'

实战 · 配合 · 坑

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

实战用法

strength_ratio 常用于 AI 决策或外交事件中,让某国在己方军力相对强势时才触发进攻、发出最后通牒或加入某个阵营。例如,可以在一个事件的 trigger 块中要求本国兵力是目标国的 1.5 倍以上,再允许宣战选项出现:

# 只有当本国估算兵力至少是德国的 1.5 倍时才显示此选项
trigger = {
    strength_ratio = {
        tag = GER
        ratio = 1.5
    }
}

配合关系

  • [enemies_strength_ratio](/wiki/trigger/enemies_strength_ratio)strength_ratio 针对指定 tag 做双边比较,而 enemies_strength_ratio 针对所有当前交战敌国加总;两者搭配可以同时满足"针对特定国家"与"针对整体敌方"的复合兵力判断。
  • [has_army_size](/wiki/trigger/has_army_size):兵力比例往往需要配合绝对兵力下限一起用,避免双方都很弱时比例条件意外触发。
  • [any_enemy_country](/wiki/trigger/any_enemy_country):在循环检测多个潜在敌国时,可在 any_enemy_country 的 limit 内嵌套 strength_ratio,筛选出己方具有明显优势的那个敌国。
  • [declare_war_on](/wiki/effect/declare_war_on):满足兵力比条件后,通常紧接着在 effect 块中执行宣战,是该 trigger 最典型的下游 effect。

常见坑

  1. 把比较方向搞反ratio 的含义是"scope 国 ÷ tag 国",值大于 1 表示 scope 国更强;新手常误以为值越小代表自己越强,或把 tag 填成自己想"压倒"的对象却搞反了分子分母,导致条件逻辑完全相反。
  2. 忽略"估算"性质导致结果不稳定:该 trigger 使用的是游戏内部的估算强度(包含训练中部队、装备库存等权重),与玩家直觉中的"在场兵力"存在偏差;在 AI 脚本里设定过于精确的阈值(如 ratio = 1.01)容易因估算波动而产生不稳定行为,建议留出合理余量。

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

strength_ratio is commonly used in AI decision-making or diplomatic events to trigger an attack, ultimatum, or faction join only when one nation has a relative military advantage. For example, you can require in an event's trigger block that your nation's estimated strength is at least 1.5 times that of the target nation before allowing a declaration of war option to appear:

# This option only displays if your nation's estimated strength is at least 1.5 times Germany's
trigger = {
    strength_ratio = {
        tag = GER
        ratio = 1.5
    }
}

Synergy

  • [enemies_strength_ratio](/wiki/trigger/enemies_strength_ratio): strength_ratio performs a bilateral comparison against a specified tag, while enemies_strength_ratio aggregates all current enemy belligerents; combining both allows you to satisfy composite military strength checks against "a specific nation" and "all enemies collectively."
  • [has_army_size](/wiki/trigger/has_army_size): Military ratios often need to be paired with an absolute strength floor to prevent the ratio condition from unexpectedly triggering when both sides are weak.
  • [any_enemy_country](/wiki/trigger/any_enemy_country): When iteratively checking multiple potential enemies, you can nest strength_ratio within the limit block of any_enemy_country to filter for the enemy nation where you hold a clear advantage.
  • [declare_war_on](/wiki/effect/declare_war_on): After meeting the military ratio condition, you typically execute a declaration of war in the effect block immediately after; this is the most common downstream effect for this trigger.

Common Pitfalls

  1. Reversing the comparison direction: The ratio value means "scope nation ÷ tag nation," with a value greater than 1 indicating the scope nation is stronger; beginners often mistakenly assume a smaller value means they are stronger, or assign the tag to the nation they want to "overpower" while getting the numerator and denominator backwards, resulting in completely inverted logic.
  2. Overlooking the "estimated" nature leading to unstable results: This trigger uses the game's internal estimated strength (including weights for units in training, equipment reserves, etc.), which differs from the intuitive "deployed forces" players expect; setting overly precise thresholds in AI scripts (such as ratio = 1.01) easily produces unstable behavior due to estimation fluctuations—it is recommended to leave a reasonable safety margin.