effect · reset_province_name
Definition
- Supported scope:
any - Supported target:
none
Description
reset name of a province back to localization one.
reset_province_nameanynonereset name of a province back to localization one.
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
reset_province_name 常用于动态地名 mod 中,当某个国家失去省份控制权、或特定事件结束后,需要将之前通过 set_province_name 自定义的省份名称恢复为本地化文件中的默认名称。例如在一场战争结束的事件选项中恢复被占领省份的名称:
# 在战争结束事件的 option 块中,恢复某省份原始名称
option = {
name = my_event.1.a
# 假设当前 scope 已通过触发切换到目标省份
reset_province_name = yes
}
[set_province_name](/wiki/effect/set_province_name) — 与 reset_province_name 形成"设置 / 还原"的完整生命周期,先用它设置自定义名称,再用 reset_province_name 在适当时机撤销。[if](/wiki/effect/if) — 通常需要在条件分支内判断当前是否满足恢复名称的条件(如占领国变更、事件标记等),避免无条件重置造成逻辑混乱。[set_global_flag](/wiki/effect/set_global_flag) / [has_global_flag](/wiki/trigger/has_global_flag) — 配合全局标记记录"是否已自定义地名"的状态,在 trigger 侧检测后再决定是否执行重置,防止重复或遗漏调用。[hidden_effect](/wiki/effect/hidden_effect) — 将 reset_province_name 包裹在隐藏效果块中,避免在事件日志或工具提示中显示无意义的地名还原信息,保持 UI 整洁。reset_province_name 作用于省份 scope 而非州(state)scope,新手常在 state scope 下直接调用,导致脚本无效或报错,需要先通过迭代或事件目标正确切换到具体省份。set_province_name 设置了自定义名称后,若没有在对应的"撤销事件"或权力移交逻辑中调用 reset_province_name,自定义名称会永久残留,即使换了控制国也不会自动恢复。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.
reset_province_name is commonly used in dynamic naming mods. When a country loses control of a province or a specific event concludes, it restores province names that were previously customized via set_province_name back to their default localization values. For example, in a war-end event option to restore the names of occupied provinces:
# In an option block of a war-end event, restore the original name of a province
option = {
name = my_event.1.a
# Assuming the current scope has already been switched to the target province via trigger
reset_province_name = yes
}
[set_province_name](/wiki/effect/set_province_name) — Forms a complete "set / revert" lifecycle with reset_province_name. Use it first to apply a custom name, then use reset_province_name at the appropriate moment to undo it.[if](/wiki/effect/if) — Usually requires conditional branching to check whether the conditions for name restoration are met (such as occupier change, event flag, etc.), preventing logic confusion from unconditional resets.[set_global_flag](/wiki/effect/set_global_flag) / [has_global_flag](/wiki/trigger/has_global_flag) — Pair with global flags to track the "whether custom naming has been applied" state, then check on the trigger side before deciding whether to execute the reset, preventing duplicate or missed calls.[hidden_effect](/wiki/effect/hidden_effect) — Wrap reset_province_name inside a hidden effect block to avoid displaying meaningless province name restoration information in event logs or tooltips, keeping the UI clean.reset_province_name operates on province scope rather than state scope. Beginners often call it directly under state scope, resulting in ineffective scripts or errors. You must first correctly switch to the specific province through iteration or event targeting.set_province_name in a mod, if you fail to call reset_province_name in the corresponding "undo event" or power transfer logic, the custom name will persist permanently and won't automatically revert even if control changes to another country.