Wiki

effect · set_division_template_cap

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Set division cap for a division template
Example: set_division_template_cap = { division_template = <name> division_cap = <int (default:1)> }

实战 · 配合 · 坑

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

实战用法

set_division_template_cap 常用于国策、决议或事件中,对特定精英师型(如近卫师、装甲师)设置编制上限,以模拟现实中稀有资源或精锐兵力的限制逻辑。例如在完成某国策后才允许组建有限数量的特种部队,强化游戏的战略取舍感。

# 完成国策后,允许最多 3 个精锐装甲师
focus = {
    id = GER_elite_panzer_doctrine
    # ...
    completion_reward = {
        set_division_template_cap = {
            division_template = "Elite Panzer Division"
            division_cap = 3
        }
    }
}

配合关系

  • [clear_division_template_cap](/wiki/effect/clear_division_template_cap) — 需要在重置模板上限(如事件分支选择不同路线)时,先清除旧上限再重新设置。
  • [division_template](/wiki/effect/division_template) — 通常在同一脚本块内先定义或修改模板结构,再对其施加数量限制,保证模板存在且名称匹配。
  • [country_lock_all_division_template](/wiki/effect/country_lock_all_division_template) — 配合使用可实现"锁定所有模板 + 仅放开特定模板有限名额"的严格管控逻辑。
  • [has_completed_focus](/wiki/trigger/has_completed_focus) — 作为触发条件,确认玩家/AI 已完成对应国策后才执行上限设置,避免过早开放配额。

常见坑

  1. 模板名称必须完全一致(区分大小写与空格)division_template 字段填写的字符串必须与游戏内实际模板名一字不差,哪怕多一个空格也会静默失败,上限不会生效且不报错,极难排查。
  2. 省略 division_cap 不等于无限:不填 division_cap 时默认值为 1 而非无限制,若本意是取消限制应改用 clear_division_template_cap 而非依赖默认值。

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

set_division_template_cap is commonly used in focus trees, decisions, or events to impose division template caps on specific elite unit types (such as guard divisions or armored divisions), simulating real-world constraints from scarce resources or limited elite manpower. For example, after completing a focus tree, you might restrict the formation of a limited number of special forces units, reinforcing the game's sense of strategic trade-offs.

# After completing the focus, allow a maximum of 3 elite panzer divisions
focus = {
    id = GER_elite_panzer_doctrine
    # ...
    completion_reward = {
        set_division_template_cap = {
            division_template = "Elite Panzer Division"
            division_cap = 3
        }
    }
}

Synergy

  • [clear_division_template_cap](/wiki/effect/clear_division_template_cap) — Use this to remove old caps before resetting template limits (for example, when event branches lead to different paths). Clear first, then set anew.
  • [division_template](/wiki/effect/division_template) — Typically define or modify the template structure first within the same script block, then apply quantity restrictions to it, ensuring the template exists and the name matches exactly.
  • [country_lock_all_division_template](/wiki/effect/country_lock_all_division_template) — Combined use enables a strict control logic of "lock all templates + unlock only specific templates with limited quotas."
  • [has_completed_focus](/wiki/trigger/has_completed_focus) — Use as a trigger condition to confirm the player/AI has completed the corresponding focus tree before applying the cap, preventing premature allocation.

Common Pitfalls

  1. Template names must match exactly (case-sensitive and space-sensitive): The string in the division_template field must match the actual in-game template name precisely; even a single extra space will cause a silent failure where the cap does not take effect and no error is reported, making it extremely difficult to debug.
  2. Omitting division_cap does not mean unlimited: When division_cap is not specified, the default value is 1, not unlimited. If you intend to remove the limit, use clear_division_template_cap instead of relying on the default value.