Hands-On Usage
Commonly used in scripted events or decisions to prevent players or AI from modifying division templates when a nation enters a special historical phase (such as martial law, wartime mobilization, or foreign occupation), ensuring narrative integrity. For example, you can lock all templates upon focus completion and attach localized tooltip text to inform players of the reason:
focus = {
id = GER_war_discipline
# ...
completion_reward = {
country_lock_all_division_template = {
is_locked = yes
desc = GER_WAR_DISCIPLINE_LOCK_DESC
}
}
}
Synergy
[has_completed_focus](/wiki/trigger/has_completed_focus): Commonly used to check whether a focus has been completed, serving as a prerequisite condition for triggering lock/unlock logic and ensuring locks activate only at the correct narrative checkpoint.
[division_template](/wiki/effect/division_template): Pre-define standardized division templates before applying the lock to ensure players possess "officially approved" compositions rather than self-modified versions.
[add_ideas](/wiki/effect/add_ideas): Pair with adding an idea containing localized description to give players visual in-game feedback that "templates are locked," creating synergy between the desc LOC_KEY and the idea display.
[country_event](/wiki/effect/country_event): Trigger an event after locking to further explain the reason for the lock or provide player choices, making the narrative more cohesive.
Common Pitfalls
- Locking without unlocking causes permanent lock: This command applies a lock at the country level; you must call the same command again with
is_locked set to no to unlock it. Beginners often forget to write corresponding unlock logic, resulting in templates remaining immutable for the entire game and unable to be bypassed via set_division_template_lock alone.
- Entering plain text strings instead of LOC_KEYs in the
desc field: The desc field accepts localization key names (keys defined in .yml files). If you input plain Chinese or English text without defining corresponding entries in the localization file, the game will display the raw key name or throw an error instead of the intended tooltip text.