Wiki

effect · goto_state

Definition

  • Supported scope:any
  • Supported target:none

Description

Goes to stated state.

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

goto_state is commonly used in focus trees, events, or decisions to quickly switch the player's viewport (camera) to a specific state, making it ideal for guiding player attention to critical battlefields or recently changed provinces when story events trigger. For example, in a war declaration event, you can automatically pan the camera to the conflict's core region:

immediate = {
    goto_state = 42  # Camera pans to state 42 (Île-de-France)
}

Synergy

  • [custom_effect_tooltip](/wiki/effect/custom_effect_tooltip): goto_state itself produces no text feedback. Pairing it with this command allows you to display messages like "Camera panned" in event options, improving UI readability.
  • [hidden_effect](/wiki/effect/hidden_effect): Wrapping goto_state in hidden_effect lets the camera pan silently without leaving extraneous effect lines in the event log, keeping the interface clean.
  • [if](/wiki/effect/if): Combined with if conditional blocks, you can dynamically determine the pan target based on current circumstances (such as state ownership), avoiding unintended pans to irrelevant regions.

Common Pitfalls

  1. Confusing state ID with province ID: goto_state takes a state ID, not a province ID. Beginners often mix these up, resulting in panning to the wrong location or script errors.
  2. Overusing in AI execution paths: This command has no practical effect when executed by AI nations but is still parsed. If placed inside every_country loops that trigger for all nations, it generates numerous useless camera instruction calls. Use [is_tutorial](/wiki/trigger/is_tutorial) or player flags to restrict execution to human players only.