Wiki

effect · add_units_to_division_template

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Add units to division template for a country. Example:
add_units_to_division_template = {
  template_name = "Name of template" # not needed on done on specific division
  regiments = {
    infantry = 0 # (Adds infantry to first available slot on first column (x=0))
    cavalry = 2 # (Adds cavalry to first available slot on third column (x=2))
  }
  support = {
     military_police = 0 # (Adds military_police to first available slot on first (and likely only) column of supports (x=0))
  }
  regimental_support = {
     military_police = 0 # (Adds military_police to first available slot on first regiment 
  }
}

实战 · 配合 · 坑

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

实战用法

add_units_to_division_template 常用于在国家事件或国策完成时动态强化某个师团模板,例如为某国的精英步兵师补充炮兵或工兵支援连,无需玩家手动操作即可完成编制升级。也可用于 AI 脚本中,让特定国家在开局或触发特定条件后自动获得更完整的战斗编制。

country_event = {
    id = my_mod.1
    immediate = {
        add_units_to_division_template = {
            template_name = "Elite Infantry Division"
            regiments = {
                infantry = 0
                artillery_brigade = 1
            }
            support = {
                engineer = 0
                artillery = 0
            }
        }
    }
}

配合关系

  • [division_template](/wiki/effect/division_template):通常先用 division_template 创建或定义模板框架,再用本命令向已有模板追加兵种,两者构成"创建→扩充"的完整工作流。
  • [has_completed_focus](/wiki/trigger/has_completed_focus):作为条件判断,确保只有在完成特定国策后才触发模板扩充,避免在不合适的时机改动编制。
  • [add_manpower](/wiki/effect/add_manpower):添加单位到模板后,往往需要同步补充人力以确保新编制的师团能够正常部署训练。
  • [delete_unit_template_and_units](/wiki/effect/delete_unit_template_and_units):在对模板进行大幅重构时,有时需要先删除旧模板再重建,与本命令配合完成模板的完整替换流程。

常见坑

  1. template_name 必须与游戏内模板名称完全一致(区分大小写和空格),若拼写有误,命令会静默失败而不报错,导致新手长时间找不到原因。
  2. 列索引(x 值)是指目标列槽位,而非兵种的添加数量——例如 infantry = 2 表示将步兵添加到第三列(x=2)的第一个可用槽,而非添加 2 个步兵团,混淆这一点会导致编制结构完全不符合预期。

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

add_units_to_division_template is commonly used to dynamically reinforce a division template when country events trigger or national focuses complete. For example, you can add artillery or engineer support companies to an elite infantry division without requiring manual player intervention, allowing roster upgrades to happen automatically. It can also be used in AI scripts to ensure specific nations automatically receive more complete combat formations at game start or when certain conditions are met.

country_event = {
    id = my_mod.1
    immediate = {
        add_units_to_division_template = {
            template_name = "Elite Infantry Division"
            regiments = {
                infantry = 0
                artillery_brigade = 1
            }
            support = {
                engineer = 0
                artillery = 0
            }
        }
    }
}

Synergy

  • [division_template](/wiki/effect/division_template): Typically you first use division_template to create or define the template framework, then use this command to append unit types to an existing template. Together they form a complete "create → expand" workflow.
  • [has_completed_focus](/wiki/trigger/has_completed_focus): Used as a conditional check to ensure template expansion only triggers after completing a specific national focus, preventing roster modifications at inappropriate times.
  • [add_manpower](/wiki/effect/add_manpower): After adding units to a template, you usually need to simultaneously replenish manpower to ensure the new divisions can deploy and train normally.
  • [delete_unit_template_and_units](/wiki/effect/delete_unit_template_and_units): When performing major template restructuring, sometimes you need to delete the old template first before rebuilding. Use this in combination with that command to complete a full template replacement workflow.

Common Pitfalls

  1. The template_name must match the in-game template name exactly (case-sensitive and including spaces). If the spelling is incorrect, the command will silently fail without throwing an error, leaving newcomers searching for the cause for a long time.
  2. The list index (x value) refers to the target column slot, not the quantity of units being added. For example, infantry = 2 means placing infantry in the first available slot of the third column (x=2), not adding 2 infantry regiments. Confusing this will result in a roster structure that completely deviates from expectations.