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
- 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.
- 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.