Wiki

effect · reset_state_name

Definition

  • Supported scope:STATE
  • Supported target:none

Description

reset_state_name = yes - Resets the current states name to the original one

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

reset_state_name is commonly used in dynamic renaming mods to restore a state's name to its original state after a certain event or decision concludes, preventing temporary names from "lingering" on the map. For example, in a scenario where you give a state a temporary military administration name during occupation and then restore it after the occupation ends:

# In the option of an occupation end event
option = {
    name = my_event.1.a
    # Restore state name
    every_state = {
        limit = {
            has_state_flag = temp_renamed_state
        }
        reset_state_name = yes
        clr_state_flag = temp_renamed_state
    }
}

Synergy

  • [set_state_name](/wiki/effect/set_state_name) — Use this first to set a temporary name for the state, then use reset_state_name to restore it afterward, forming a complete "rename→restore" workflow.
  • [set_state_flag](/wiki/effect/set_state_flag) / [clr_state_flag](/wiki/effect/clr_state_flag) — Work together with flags to mark "this state has been renamed," then use the flag as a filter condition when triggering restoration, preventing accidental operations on other states.
  • [has_state_flag](/wiki/trigger/has_state_flag) — Check the flag in the limit block to ensure only truly renamed states execute the restoration, preventing overly broad scope.

Common Pitfalls

  1. Scope error: reset_state_name must execute under STATE scope; writing it in country or province scope will silently fail. Beginners often forget to first switch to the correct scope using every_state/capital_scope or similar constructs.
  2. Mistaking it as clearing all renames besides set_state_name: This command only restores names modified by scripts back to the original state names defined in localization files. If the original name itself has errors in the localization file, reset_state_name won't "fix" it. When debugging, first check the localization entries.