Hands-On Usage
set_division_template_lock is commonly used in scenario-based mods to lock elite division templates after specific national focuses or events are triggered, preventing players or AI from arbitrarily modifying their organization and preserving the strategic intent of the scenario design. For example, locking the "Imperial Guard" template in the hidden startup effects, then unlocking it only after certain technologies are researched or specific national focuses are completed.
# Lock an elite division template upon completing a national focus
complete_national_focus = {
hidden_effect = {
set_division_template_lock = {
division_template = "Imperial Guard Division"
is_locked = yes
}
}
}
# Unlock the template in a subsequent event
country_event = {
option = {
set_division_template_lock = {
division_template = "Imperial Guard Division"
is_locked = no
}
}
}
Synergy
[division_template](/wiki/effect/division_template): Typically used first to create a division template, then immediately followed by set_division_template_lock to protect it, ensuring the template is safeguarded immediately upon creation.
[country_lock_all_division_template](/wiki/effect/country_lock_all_division_template): Used together when bulk-locking all templates is needed; the former handles all templates globally while the latter manages individual templates requiring differential unlock timing.
[complete_national_focus](/wiki/effect/complete_national_focus): Commonly serves as the trigger node for locking/unlocking operations, controlling template editability through focus completion and creating a rhythmic progression of scenario events.
[has_completed_focus](/wiki/trigger/has_completed_focus): Paired in conditional checks to confirm prerequisite focuses are completed before executing unlock operations, preventing premature granting of template editing permissions.
Common Pitfalls
- Template name casing and spacing must exactly match the
name field in the division_template definition block. Even a single extra space or case mismatch will cause the command to fail silently with no error logged, making it extremely difficult for newcomers to troubleshoot.
- Omitting the
is_locked field defaults to true (locked). If you intend to unlock a template but forget to write the field or specify the wrong boolean value, you'll get results completely opposite to expectations; always verify the actual lock state during testing to confirm it matches your intentions.