Wiki

effect · create_colonial_division_template

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Create a colonial division template for overlord/owner. Available parameters are subject and division_template, where the subject parameter is the country tag for an overlords subject. And the division_template is the regular effect to create a division template.
Example.
In country scope of overlord, E.g. ROOT = ENG
create_colonial_division_template = {
    subject = RAJ # Country tag
    division_template = {
        name = "Infantry Division"
        division_names_group = RAJ_INF_01
        ...
        regiments = {
            infantry = { x = 0 y = 0 }
            infantry = { x = 0 y = 1 }
            }
        }
    }
}

实战 · 配合 · 坑

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

实战用法

此 effect 常用于殖民帝国类 mod 中,让宗主国(如英国 ENG)为其自治领或殖民地(如印度 RAJ)自动创建符合当地风格的师级模板,避免玩家手动在附庸国界面操作。典型场景是在宗主国完成某个国家焦点或决议后,批量为多个殖民地生成统一规格的步兵师模板。

# 在 ENG 的国家焦点完成效果块中
create_colonial_division_template = {
    subject = RAJ
    division_template = {
        name = "Colonial Infantry"
        division_names_group = RAJ_INF_01
        regiments = {
            infantry = { x = 0 y = 0 }
            infantry = { x = 0 y = 1 }
            infantry = { x = 1 y = 0 }
        }
        support = {
            artillery = { x = 0 y = 0 }
        }
    }
}

配合关系

  • [every_subject_country](/wiki/effect/every_subject_country):遍历宗主国所有附庸,结合条件判断后批量调用本 effect,为每个殖民地一次性生成模板,而不必逐一硬编码 country tag。
  • [has_autonomy_state](/wiki/trigger/has_autonomy_state):在执行前检测附庸的自治等级(如是否为殖民地或自治领),确保只给符合条件的附庸创建对应模板,避免对独立国家误触发。
  • [division_template](/wiki/effect/division_template):本 effect 内部的 division_template 块语法与独立的 division_template effect 几乎相同,理解后者的字段规则(regiments、support、priority 等)是正确填写内层块的前提。
  • [any_subject_country](/wiki/trigger/any_subject_country):在触发条件层用于判断宗主国是否拥有特定附庸,配合 exists 确认目标 tag 存在后再执行,防止脚本报错崩溃。

常见坑

  1. scope 写错位置:此 effect 必须在宗主国的 country scope 下执行,subject 参数填附庸的 tag;新手常反过来在附庸的 scope 里调用并把 subject 填成自己,导致模板无法生成或逻辑错误。
  2. subject 国家不存在或不是附庸:若填写的 country tag 在游戏中尚未存在(exists = no)或与执行国不存在宗主-附庸关系,效果会静默失败且不报错,务必在外层用 [exists](/wiki/trigger/exists)[has_autonomy_state](/wiki/trigger/has_autonomy_state) 做好前置检查。

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

This effect is commonly used in colonial empire-style mods to allow a overlord nation (such as ENG for Britain) to automatically create division templates for its dominions or colonies (such as RAJ for India) that match local aesthetics, avoiding manual operations in the subject nation interface. A typical scenario is completing a national focus or decision in the overlord nation, then batch-generating unified infantry division templates for multiple colonies.

# In the completion effect block of ENG's national focus
create_colonial_division_template = {
    subject = RAJ
    division_template = {
        name = "Colonial Infantry"
        division_names_group = RAJ_INF_01
        regiments = {
            infantry = { x = 0 y = 0 }
            infantry = { x = 0 y = 1 }
            infantry = { x = 1 y = 0 }
        }
        support = {
            artillery = { x = 0 y = 0 }
        }
    }
}

Synergy

  • [every_subject_country](/wiki/effect/every_subject_country): Iterates through all subject nations of an overlord, combining conditional checks before invoking this effect in bulk to generate templates for each colony in one go, eliminating the need to hardcode every country tag individually.
  • [has_autonomy_state](/wiki/trigger/has_autonomy_state): Checks the subject's autonomy level (such as whether it is a colony or dominion) before execution, ensuring templates are only created for eligible subjects and preventing accidental triggers on independent nations.
  • [division_template](/wiki/effect/division_template): The division_template block syntax within this effect is nearly identical to the standalone division_template effect; mastering the latter's field rules (regiments, support, priority, etc.) is prerequisite to correctly populating the inner block.
  • [any_subject_country](/wiki/trigger/any_subject_country): Used at the trigger condition level to determine whether an overlord possesses a specific subject, and combined with exists to confirm the target tag exists before execution, preventing script errors and crashes.

Common Pitfalls

  1. Scope placed incorrectly: This effect must be executed under the country scope of the overlord nation, with the subject parameter filled with the subject's tag; beginners often reverse this by invoking it within the subject's scope and filling subject with themselves, resulting in failed template generation or logic errors.
  2. Subject nation does not exist or is not a subject: If the country tag written does not yet exist in the game (exists = no) or lacks an overlord-subject relationship with the executing nation, the effect fails silently without error reporting. Always perform prerequisite checks in the outer scope using [exists](/wiki/trigger/exists) and [has_autonomy_state](/wiki/trigger/has_autonomy_state).