Wiki

effect · randomize_weather

Definition

  • Supported scope:any
  • Supported target:any

Description

Randomize weather effect

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

randomize_weather is commonly used in scripted events or special decisions to force a refresh of weather conditions on the map, creating a narrative atmosphere of "sudden climate shift"—such as triggering nuclear winter mods after a nuclear war or implementing seasonal weather cycle mods. It can also be used for debugging scenarios, allowing rapid weather reset during testing of weather-related mechanics without manually waiting for in-game weather evolution.

# Reset weather after a global disaster event triggers
country_event = {
    id = disaster.1
    immediate = {
        randomize_weather = yes
    }
    ...
}

Synergy

  • [hidden_effect](/wiki/effect/hidden_effect): Wrap randomize_weather within a hidden effect block to avoid displaying redundant effect notifications to the player, making weather transitions smoother and less intrusive.
  • [if](/wiki/effect/if): Use conditional checks (such as current date or specific global flags) to determine whether to trigger weather randomization, rather than unconditionally resetting weather every time an event fires.
  • [set_global_flag](/wiki/effect/set_global_flag): Immediately set a global flag after randomizing weather for use in subsequent trigger checks to determine "whether weather has been reset," preventing duplicate triggers.
  • [sound_effect](/wiki/effect/sound_effect): Synchronize playback of storm or ambient sound effects with the visual weather change, creating coordinated sensory impact and enhancing narrative immersion.

Common Pitfalls

  1. Mistakenly assuming you can specify a weather type: randomize_weather only randomizes weather and cannot specify a target weather type or target region through parameters. If your mod requires precise control over weather in specific provinces, this command cannot fulfill that requirement and you must rely on alternative mechanisms or accept random results.
  2. Overuse in per-frame or high-frequency loops: Placing this command in daily pulse or high-frequency while_loop_effect will cause continuous weather flickering, performance degradation, and even disruption of AI battlefield assessment. Pair it with flags or variables to throttle execution, ensuring it only triggers once when genuinely needed.