命令百科

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