Wiki

effect · unlock_subunit

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Unlocks the specified subunit for the country.

	### Examples
	```
	GER = {
		unlock_subunit = rangers_support
	}
	```

实战 · 配合 · 坑

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

实战用法

unlock_subunit 常用于国家焦点树或事件中,让特定国家解锁原本被锁定的特种支援旅编制,例如当某国完成某项军事改革焦点后才能编组游骑兵支援连。它的典型场景是配合科技或国策推进,给落后国家补全特定兵种的解锁资格。

# 完成某焦点后,为德国解锁突击工兵支援营
GER = {
    set_technology = { rangers = 1 }
    unlock_subunit = rangers_support
    add_tech_bonus = {
        name = ger_ranger_bonus
        bonus = 0.5
        uses = 1
        category = land_doctrine
    }
}

配合关系

  • set_technology:通常先通过 set_technology 赋予对应的基础科技,再调用 unlock_subunit 解锁编制,避免因科技依赖缺失导致部队模板无法添加该支队。
  • division_template:解锁子单位后,紧跟 division_template 创建包含该支援旅的师模板,形成完整的"解锁→编组"流程。
  • has_tech:在条件块中用 has_tech 检查国家是否已研究前置科技,确保 unlock_subunit 只在满足科技条件时触发,逻辑更严谨。
  • add_ideas:配合添加军事理念,在给予特种部队编制权限的同时赋予对应的训练加成或作战理念,增强叙事连贯性。

常见坑

  1. 跳过科技直接解锁unlock_subunit 仅开放编制限制,若国家尚未研究对应的支援连科技(如 tech = rangers),部队模板界面中该子单位仍可能显示为灰色或无法添加;正确做法是同时用 set_technology 补齐前置科技。
  2. 作用域写错:该命令必须在 COUNTRY scope 下执行,新手常在 STATE scope 的 every_owned_state 块内误用,导致脚本报错或静默失效;应确保外层作用域是国家标签或已切换回 COUNTRY 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

unlock_subunit is commonly used in national focus trees or events to grant a specific country access to special support brigade formations that would otherwise be locked — for example, allowing a country to field ranger support companies only after completing a military reform focus. Its typical use case is paired with technology or focus progression to fill in missing unit unlock eligibility for nations that lack it by default.

# After completing a focus, unlock assault engineer support battalion for Germany
GER = {
    set_technology = { rangers = 1 }
    unlock_subunit = rangers_support
    add_tech_bonus = {
        name = ger_ranger_bonus
        bonus = 0.5
        uses = 1
        category = land_doctrine
    }
}

Synergy

  • set_technology: It is standard practice to first grant the relevant base technology via set_technology, then call unlock_subunit to open the formation slot. This prevents the subunit from being unaddable in division templates due to missing tech dependencies.
  • division_template: After unlocking the subunit, immediately follow up with division_template to create a division template that includes the support brigade, completing the full "unlock → build" pipeline.
  • has_tech: Use has_tech in condition blocks to verify that the country has already researched the prerequisite technology, ensuring unlock_subunit only fires when the tech requirements are actually met for tighter logic.
  • add_ideas: Pair with add_ideas to attach military ideas alongside the formation unlock, granting corresponding training bonuses or combat doctrines at the same time and strengthening narrative cohesion.

Common Pitfalls

  1. Unlocking formations while skipping the technology: unlock_subunit only removes the formation restriction. If the country has not yet researched the corresponding support company technology (e.g., tech = rangers), the subunit may still appear greyed out or remain unaddable in the division template UI. The correct approach is to simultaneously use set_technology to fill in the prerequisite tech.
  2. Wrong scope: This command must be executed within a COUNTRY scope. Beginners often mistakenly call it inside an every_owned_state block, which runs in STATE scope, causing script errors or silent failures. Always ensure the enclosing scope is a country tag or that you have switched back to COUNTRY scope before calling this command.