Wiki

trigger · stockpile_ratio

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Compares the ratio of equipment archetype in stockpile vs used. a value of 2 means we have double in stockpile of what is fielded or in training.

实战 · 配合 · 坑

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

实战用法

stockpile_ratio 常用于 AI 决策或国策可用性判断,防止在弹药/装备库存不足时触发大规模战争或扩军。例如在一个自定义决策中,要求国家手头装备充足才能解锁进攻性战略选项:

available = {
    stockpile_ratio = {
        archetype = infantry_equipment
        ratio > 1.5
    }
}

配合关系

  • [fuel_ratio](/wiki/trigger/fuel_ratio):两者都是"比值型"资源判断,常在同一个 limit 块中联用,综合评估国家的战争准备程度。
  • [has_army_size](/wiki/trigger/has_army_size):先确认部队规模再检查库存比,避免在军队极小时比值虚高导致误判。
  • [add_equipment_to_stockpile](/wiki/effect/add_equipment_to_stockpile):作为配套 effect,在 stockpile_ratio 触发奖励或补给决策时,将额外装备直接注入库存。
  • [conscription_ratio](/wiki/trigger/conscription_ratio):与兵源比率搭配,综合判断国家是否具备全面动员条件后再触发相关 AI 策略。

常见坑

  1. 比值虚高陷阱:当该国几乎没有部队在役(fielded 接近 0)时,极小的库存量也会产生极高的 ratio,导致条件意外判断为真。应同时搭配 [has_army_size](/wiki/trigger/has_army_size) 等条件过滤掉此类边缘情况。
  2. archetype 与 equipment 混淆:该 trigger 填写的必须是装备的原型(archetype),如 infantry_equipment,而非具体的变体或科技名称;填错时游戏不一定报错,但条件将永远不会正确匹配,导致逻辑静默失效。

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

stockpile_ratio is commonly used in AI decision-making or focus availability checks to prevent triggering large-scale warfare or military expansion when ammunition/equipment stockpiles are insufficient. For example, in a custom decision, you might require the nation to have adequate equipment on hand before unlocking offensive strategic options:

available = {
    stockpile_ratio = {
        archetype = infantry_equipment
        ratio > 1.5
    }
}

Synergy

  • [fuel_ratio](/wiki/trigger/fuel_ratio): Both are "ratio-based" resource checks and are frequently used together within the same limit block to comprehensively assess a nation's war readiness.
  • [has_army_size](/wiki/trigger/has_army_size): Confirm troop size first before checking stockpile ratio to avoid false positives where inflated ratios occur when the military is extremely small.
  • [add_equipment_to_stockpile](/wiki/effect/add_equipment_to_stockpile): Acts as a complementary effect; when stockpile_ratio triggers rewards or supply decisions, it directly injects additional equipment into the stockpile.
  • [conscription_ratio](/wiki/trigger/conscription_ratio): Pair with manpower ratio to comprehensively evaluate whether a nation meets full mobilization conditions before triggering relevant AI strategies.

Common Pitfalls

  1. Inflated ratio trap: When a nation has almost no troops deployed in the field (fielded approaches 0), even minimal stockpile quantities will produce extremely high ratios, causing the condition to unexpectedly evaluate as true. You should combine this with filters like [has_army_size](/wiki/trigger/has_army_size) to exclude such edge cases.
  2. Confusion between archetype and equipment: This trigger requires the archetype of the equipment, such as infantry_equipment, not a specific variant or technology name. When filled incorrectly, the game may not report an error, but the condition will never match correctly, causing the logic to silently fail.