Wiki

effect · set_sub_doctrine

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Activate (unlock and assign) the specified subdoctrine.
	By default, the subdoctrine is assigned to the first matching track that the system can find.
	However, you can also specify a specific folder and track index to assign the subdoctrine to, in case
	the same track appears in multiple folders, or multiple times in the same folder

	### Examples - SIMPLE VERSION
	```
	GER = {
		set_sub_doctrine = mobile_infantry
	}
	```
	### Examples - EXTENDED VERSION
	```
	GER = {
		set_sub_doctrine = {
			sub_doctrine = mobile_infantry
			folder = land # Optional, in case you need to specify the folder
			track = 1 # Optional, in case you need to specify the track index within the folder.
			# Note that this is the track index (starting with 0) among ALL the tracks in the folder, not just the ones that match the subdoctrine.
			# So in a case where a grand doctrine has the tracks: 'infantry - armor - armor - operations', you would use
			# track = 1 to refer to the first armor track, and track = 2 to refer to the second armor track.
		}
	}
	```

实战 · 配合 · 坑

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

实战用法

set_sub_doctrine 常用于国家焦点、决策或事件中,为玩家或 AI 国家自动解锁并装备特定的子教义,免去手动在界面中点选的麻烦。例如在一个"闪电战改革"焦点中,完成焦点后直接赋予德国机动步兵子教义:

focus = {
    id = GER_blitzkrieg_reform
    ...
    completion_reward = {
        GER = {
            set_sub_doctrine = mobile_infantry
        }
    }
}

若同一个 track 在多个 folder 中重复出现,则需使用扩展写法,指定 foldertrack 以避免系统分配到错误的槽位。

配合关系

  • [has_completed_subdoctrine](/wiki/trigger/has_completed_subdoctrine):在使用 set_sub_doctrine 前先检查目标子教义是否已激活,避免重复赋予或做条件分支判断。
  • [has_any_grand_doctrine](/wiki/trigger/has_any_grand_doctrine):确认国家已拥有对应的大教义体系,再分配子教义,防止因教义系统未解锁而导致脚本静默失败。
  • [has_completed_track](/wiki/trigger/has_completed_track):用于检测某条 track 是否已完成,配合逻辑判断决定赋予哪条子教义路线。
  • [add_doctrine_cost_reduction](/wiki/effect/add_doctrine_cost_reduction):常在同一焦点/事件中组合使用,先降低教义研究费用再直接解锁子教义,形成完整的军事改革奖励包。

常见坑

  1. 忽略 track 索引从 0 开始track 字段的编号是 folder 内所有 track 的全局顺序索引(从 0 起算),而非仅匹配该子教义类型的 track 编号。若 folder 中有"步兵—装甲—装甲—作战"四条 track,想指定第二条装甲 track 必须写 track = 2 而非 track = 1,否则会赋予到错误的槽位。
  2. 简单写法在多 folder/多 track 场景下行为不可控:直接写 set_sub_doctrine = mobile_infantry 时,游戏会自动匹配第一个符合条件的 track,若 mod 中同一个子教义出现在多处,极易赋予到非预期的位置,此时必须切换到扩展写法并明确指定 foldertrack

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_sub_doctrine is commonly used in national focuses, decisions, or events to automatically unlock and equip specific sub-doctrines for player or AI nations, eliminating the need for manual selection in the interface. For example, in a "Blitzkrieg Reform" focus, upon completion the German nation is directly granted the mobile infantry sub-doctrine:

focus = {
    id = GER_blitzkrieg_reform
    ...
    completion_reward = {
        GER = {
            set_sub_doctrine = mobile_infantry
        }
    }
}

If the same track appears multiple times across different folders, you must use the extended syntax and specify both folder and track to prevent the system from assigning to the wrong slot.

Synergy

  • [has_completed_subdoctrine](/wiki/trigger/has_completed_subdoctrine): Check whether the target sub-doctrine is already active before using set_sub_doctrine to avoid duplicate assignment or for conditional branching logic.
  • [has_any_grand_doctrine](/wiki/trigger/has_any_grand_doctrine): Confirm the nation already possesses the corresponding grand doctrine system before allocating sub-doctrines, preventing silent script failures due to the doctrine system not being unlocked.
  • [has_completed_track](/wiki/trigger/has_completed_track): Used to detect whether a specific track has been completed, combined with logical conditions to determine which sub-doctrine path to grant.
  • [add_doctrine_cost_reduction](/wiki/effect/add_doctrine_cost_reduction): Commonly combined in the same focus or event—reduce doctrine research costs first, then directly unlock the sub-doctrine, forming a complete military reform reward package.

Common Pitfalls

  1. Forgetting that track indexing starts at 0: The track field number is a global sequential index of all tracks within the folder (starting from 0), not merely the track number matching that specific sub-doctrine type. If a folder contains four tracks—"Infantry–Armor–Armor–Warfare"—and you want to target the second Armor track, you must write track = 2 not track = 1, otherwise the assignment will go to the wrong slot.
  2. Simple syntax behavior becomes unpredictable in multi-folder/multi-track scenarios: When writing set_sub_doctrine = mobile_infantry directly, the game automatically matches the first qualifying track. If the same sub-doctrine appears in multiple places in the mod, it is very easy to assign to an unintended location. In such cases, you must switch to extended syntax and explicitly specify both folder and track.