Wiki

trigger · alliance_strength_ratio

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Compares the estimated army strength between the scope country, his allies and his enemies.

实战 · 配合 · 坑

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

实战用法

alliance_strength_ratio 常用于 AI 决策或事件触发逻辑中,判断己方阵营相对于敌方是否处于军事优势或劣势,从而决定是否发起战争、寻求结盟或签署停战协议。例如在一个"智能外交 mod"中,可以让 AI 在综合兵力比例过低时主动寻求援助而非冒进开战:

# 当己方联盟综合军力远弱于敌方时,触发求援外交事件
country_event = {
    id = smart_diplomacy.1
    trigger = {
        alliance_strength_ratio < 0.6
        has_defensive_war = yes
    }
}

配合关系

  • [fighting_army_strength_ratio](/wiki/trigger/fighting_army_strength_ratio)alliance_strength_ratio 衡量联盟整体估算实力,而该 trigger 衡量当前实际交战部队强度,二者组合可区分"账面实力差"和"实战差",避免误判。
  • [enemies_strength_ratio](/wiki/trigger/enemies_strength_ratio):直接对比敌方兵力比例,与 alliance_strength_ratio 共同使用可构建更精细的多条件兵力评估逻辑。
  • [any_allied_country](/wiki/trigger/any_allied_country):用于检查是否存在盟友满足特定条件,与联盟兵力比较配合,可在联盟实力不足时进一步筛查哪个盟友需要支援。
  • [add_to_faction](/wiki/effect/add_to_faction):当联盟整体实力比不足时,可在 effect 块中拉拢新成员加入阵营以补强,与本 trigger 的判断结果形成决策闭环。

常见坑

  1. 误以为比较的是实时战场兵力:该 trigger 使用的是"估算(estimated)"军力,基于国家生产能力和装备数据推算,而非当前实际在前线作战的部队数量,因此在战争初期双方尚未大量消耗时,结果可能与直觉差距较大。
  2. 忽略 scope 限制导致脚本报错:该 trigger 只能在 COUNTRY scope 下使用,若误放在 STATECHARACTER 等 scope 内(如写在 any_owned_state 的子块中),游戏会静默跳过或抛出错误,需确保外层 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

alliance_strength_ratio is commonly used in AI decision-making logic or event triggers to determine whether your faction has military superiority or inferiority relative to the enemy, thereby deciding whether to initiate war, seek alliances, or sign armistice agreements. For example, in an "intelligent diplomacy mod", you can have the AI actively seek assistance rather than take rash action when the overall force ratio is too low:

# Trigger a diplomatic aid event when your alliance's combined military strength is significantly weaker than the enemy
country_event = {
    id = smart_diplomacy.1
    trigger = {
        alliance_strength_ratio < 0.6
        has_defensive_war = yes
    }
}

Synergy

  • [fighting_army_strength_ratio](/wiki/trigger/fighting_army_strength_ratio): alliance_strength_ratio measures the estimated overall power of the alliance, while this trigger measures the actual strength of forces currently engaged in combat. Combined, they allow you to distinguish between "paper strength gap" and "actual combat gap", avoiding misjudgments.
  • [enemies_strength_ratio](/wiki/trigger/enemies_strength_ratio): Directly compares enemy force ratios. Using it together with alliance_strength_ratio enables constructing more granular multi-condition force assessment logic.
  • [any_allied_country](/wiki/trigger/any_allied_country): Checks whether any ally meets specific conditions. Combined with alliance force comparison, it allows further filtering of which allies need support when overall alliance strength is insufficient.
  • [add_to_faction](/wiki/effect/add_to_faction): When the alliance's overall strength ratio is inadequate, you can recruit new members into the faction within an effect block to strengthen it, forming a decision feedback loop with the judgment results of this trigger.

Common Pitfalls

  1. Mistaking it for real-time battlefield troop strength: This trigger uses "estimated" military power based on calculations derived from national production capacity and equipment data, not the actual number of troops currently fighting on the front lines. Therefore, in the early stages of war before both sides have suffered heavy casualties, results may differ significantly from intuition.
  2. Neglecting scope restrictions causing script errors: This trigger can only be used within COUNTRY scope. If mistakenly placed in STATE or CHARACTER scopes (such as within a sub-block of any_owned_state), the game will silently skip it or throw an error. Ensure the outer scope is always a country.