Wiki

effect · division_template

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

add a division template to country

实战 · 配合 · 坑

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

实战用法

division_template 常用于国家焦点、决策或历史开局事件中,为某国动态添加自定义师团模板,例如在专属国策完成时解锁某种精锐师型。以下是一个在国策奖励中为国家添加装甲师模板的示例:

focus = {
    id = create_panzer_division
    ...
    completion_reward = {
        division_template = {
            name = "Panzer Division"
            division_names_group = GER_Panzer_01
            regiments = {
                medium_armor = { x = 0 y = 0 }
                medium_armor = { x = 0 y = 1 }
                motorized = { x = 1 y = 0 }
                motorized = { x = 1 y = 1 }
            }
            support = {
                artillery = { x = 0 y = 0 }
            }
        }
    }
}

配合关系

  • [add_manpower](/wiki/effect/add_manpower):添加模板之后通常需要补充人力,确保玩家/AI 能实际训练新师团。
  • [add_equipment_to_stockpile](/wiki/effect/add_equipment_to_stockpile):新模板所需装备不会凭空出现,配合补充库存装备可让模板立刻具备实战意义。
  • [has_completed_focus](/wiki/trigger/has_completed_focus):在 trigger 中检测是否已完成特定焦点,用于条件性地触发或屏蔽相关决策,避免重复添加相同模板。
  • [country_lock_all_division_template](/wiki/effect/country_lock_all_division_template):在某些 mod 中希望玩家只能使用脚本预设的师团模板,可在添加模板后配合锁定指令限制自由编辑。

常见坑

  1. 模板名称重复不报错但会覆盖:若已存在同名模板,游戏不会报错提示,而是静默覆盖原有模板,导致玩家已有的该名称师团编制被意外修改,开发时务必保证模板命名唯一。
  2. scope 必须是 COUNTRY 而非 STATE 或 CHARACTER:新手常在 every_owned_state 或角色事件的 scope 下直接调用此 effect,导致脚本无效甚至报错;需用 OWNER 或通过 every_country_with_original_tag 等方式先切回国家 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

division_template is commonly used in national focuses, decisions, or historical start events to dynamically add custom division templates to a country—for example, unlocking a specialized elite division type upon completing a unique national spirit. Below is an example of adding an armored division template as a focus reward:

focus = {
    id = create_panzer_division
    ...
    completion_reward = {
        division_template = {
            name = "Panzer Division"
            division_names_group = GER_Panzer_01
            regiments = {
                medium_armor = { x = 0 y = 0 }
                medium_armor = { x = 0 y = 1 }
                motorized = { x = 1 y = 0 }
                motorized = { x = 1 y = 1 }
            }
            support = {
                artillery = { x = 0 y = 0 }
            }
        }
    }
}

Synergy

  • [add_manpower](/wiki/effect/add_manpower): After adding a template, you typically need to supplement manpower to ensure the player/AI can actually train the new divisions.
  • [add_equipment_to_stockpile](/wiki/effect/add_equipment_to_stockpile): Equipment for the new template won't appear from thin air; combining this with equipment stockpile additions makes the template immediately combat-ready.
  • [has_completed_focus](/wiki/trigger/has_completed_focus): In triggers, check whether a specific focus has been completed to conditionally trigger or block related decisions, preventing duplicate additions of the same template.
  • [country_lock_all_division_template](/wiki/effect/country_lock_all_division_template): In certain mods where you want players to only use scripted preset division templates, you can pair template additions with a lock command to restrict free editing.

Common Pitfalls

  1. Duplicate template names don't error but silently overwrite: If a template with the same name already exists, the game won't throw an error message; instead, it silently overwrites the original template, causing player-owned divisions with that name to be unexpectedly modified. Always ensure unique template naming during development.
  2. Scope must be COUNTRY, not STATE or CHARACTER: Beginners often call this effect directly within every_owned_state or character event scopes, resulting in ineffective scripts or errors. You must switch back to country scope using OWNER or methods like every_country_with_original_tag before executing.