Wiki

trigger · ai_wants_divisions

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Will compare towards the amount of divisions an ai wants to have.

实战 · 配合 · 坑

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

实战用法

ai_wants_divisions 常用于 AI 战略调整类 mod 中,判断当前 AI 是否已"满足"其师团数量目标,从而决定是否触发某些辅助效果(如额外工厂投入、研究转向等)。典型场景是在国策或决议的 available 块中,确保只有当 AI 尚未达到目标师团数时才开放某条增援路线。

# 在某决议的 available 块中,仅当 AI 仍需要更多师团时才可用
available = {
    ai_wants_divisions > 0   # AI 期望数量仍未被满足
}

配合关系

  • [has_army_size](/wiki/trigger/has_army_size) — 与 ai_wants_divisions 联用,先用 has_army_size 检测当前实际师团规模,再对比 AI 的目标期望值,形成"现有 vs 期望"的双重判断逻辑。
  • [ai_has_role_template](/wiki/trigger/ai_has_role_template) — 确认 AI 是否已拥有对应角色的师团模板,避免 AI 在没有合适模板时仍被判定为"需要更多师团"造成逻辑混乱。
  • [add_manpower](/wiki/effect/add_manpower) — 当判断 AI 师团数不足时,搭配此 effect 给予额外人力补充,帮助 AI 更快填满其目标编制。
  • [amount_manpower_in_deployment_queue](/wiki/trigger/amount_manpower_in_deployment_queue) — 检查部署队列中是否已有大量人力在途,防止重复触发补充效果导致数值叠加过高。

常见坑

  1. 误将其用于人类玩家 scope:该 trigger 专门针对 AI 的内部期望值计算,在玩家控制的国家上调用结果不具备实际意义(AI 目标值可能为 0 或返回不可预期的结果),应在使用前配合 is_ai = yes 加以限定。
  2. 与实际师团数混淆ai_wants_divisions 比较的是 AI 期望拥有的数量,而非当前已部署的师团数——新手常误以为它等同于 has_army_size,导致条件判断方向完全相反。

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

ai_wants_divisions is commonly used in AI strategy adjustment mods to determine whether the current AI has "satisfied" its division count target, thereby deciding whether to trigger certain auxiliary effects (such as additional factory allocation, research redirection, etc.). A typical scenario is within the available block of a national focus or decision, ensuring that a reinforcement path only opens when the AI has not yet reached its target division count.

# In the available block of a decision, only usable when AI still needs more divisions
available = {
    ai_wants_divisions > 0   # AI expected quantity has not yet been satisfied
}

Synergy

  • [has_army_size](/wiki/trigger/has_army_size) — Used in conjunction with ai_wants_divisions, first use has_army_size to detect the current actual division scale, then compare against the AI's target expectation, forming a dual judgment logic of "current vs expected".
  • [ai_has_role_template](/wiki/trigger/ai_has_role_template) — Confirm whether the AI already possesses a division template for the corresponding role, preventing logic confusion where the AI is still judged as "needing more divisions" when lacking a suitable template.
  • [add_manpower](/wiki/effect/add_manpower) — When determining that the AI's division count is insufficient, combine with this effect to provide additional manpower supplements, helping the AI fill its target establishment more quickly.
  • [amount_manpower_in_deployment_queue](/wiki/trigger/amount_manpower_in_deployment_queue) — Check whether there is already substantial manpower in transit within the deployment queue, preventing repeated triggering of supplemental effects that would cause numerical stacking to become excessive.

Common Pitfalls

  1. Mistakenly applying it to human player scope: This trigger is specifically designed for the AI's internal expectation value calculation. Calling it on player-controlled nations yields no practical meaning (the AI target value may be 0 or return unpredictable results). Restrict it with is_ai = yes before use.
  2. Confusing it with actual division count: ai_wants_divisions compares the quantity the AI expects to have, not the divisions currently deployed — newcomers often mistakenly equate it with has_army_size, resulting in completely reversed condition logic.