命令百科

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) 做好前置检查。