effect · randomize_weather
Definition
- Supported scope:
any - Supported target:
any
Description
Randomize weather effect
randomize_weatheranyanyRandomize weather effect
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
randomize_weather 常用于剧情事件或特殊决议触发后,强制刷新地图上的天气状态,营造"突变气候"的叙事氛围,例如核战争后触发核冬天类 mod 或季节性天气循环 mod。也可用于 debug 场景,在测试天气相关机制时快速重置天气而不必手动等待游戏内天气演变。
# 某全球灾难事件触发后重置天气
country_event = {
id = disaster.1
immediate = {
randomize_weather = yes
}
...
}
[hidden_effect](/wiki/effect/hidden_effect):将 randomize_weather 包裹在隐藏效果块中,避免向玩家显示多余的效果弹出提示,使天气切换更为无感流畅。[if](/wiki/effect/if):通过条件判断(如当前日期、特定全局旗帜)决定是否触发天气随机化,而非每次事件都无条件重置天气。[set_global_flag](/wiki/effect/set_global_flag):在随机化天气后立即设置一个全局旗帜,用于后续触发器判断"天气是否已被重置",防止重复触发。[sound_effect](/wiki/effect/sound_effect):同步播放风暴或环境音效,与天气视觉变化形成联动,提升叙事沉浸感。randomize_weather 只能随机化天气,无法通过参数指定目标天气类型或目标地区,如果 mod 需要精确控制特定省份天气,该命令无法满足需求,需依赖其他机制或接受随机结果。while_loop_effect 中会导致天气持续抖动、性能下降甚至影响 AI 的战场判断,应配合旗帜或变量节流,确保只在真正需要时触发一次。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.
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
}
...
}
[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.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.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.