Skip to content

Zen's Weather Config

Zenarchist edited this page Oct 28, 2024 · 9 revisions

download

What Is This?

This is a modified version of affenb3rt's PresetWeather mod.

Obviously a huge shout-out to affenb3rt for releasing his mods open-source and allowing modders like myself to modify and redistribute his code.

My version of this mod has only one major difference: the weather config in the JSON file is randomized using weighted chance rather than simply picking a random array element.

This means you can have thunderstorms/blizzards/etc weather events be more rare than regular rain/snow/clear weather etc.

There is more info on how the mod works in the form of comments inside the actual source code for those who know how to read it - check out ZenModPack/scripts/4_world/Plugins/PluginBase/PluginZenWeatherConfig.c

But for most server owners all you really need to know is how to configure the weather config which I'll explain below.

ZenWeather.json Config

This mod is disabled by default since it affects the weather system which is a core element of any server. Many server owners probably do not want to override their vanilla game weather with this config, so if you want to use this mod you'll need to enable it in the Master Config (instructions below).

When you run your server for the first time with this mod enabled it will generate a JSON file in your mission folder for tweaking the weather.

This is the file path:

%server_root/profiles/Zenarchist/ZenWeather.json

The mod will automatically generate a ZenWeather.json config file with some preset settings in it, but these will need to be tweaked as they have not been tested thoroughly and were just provided as an example template.

My server alternates between summer/winter so my weather config is a bit more complex than most servers will require, so I did not include my server's config as a template.

But to add your own presets is fairly easy, just set the transition and duration time to 2-3 minutes per preset and set "DebugOn": 1 in the config to test weather configs and see text messages in-game and in your server's script logs explaining what the weather system is doing.

Here is a description of each config setting and some example config for blizzards, rain, snow and clear weather:

{
    "ConfigVersion": "3",
    "DebugOn": 0, // Turn on in-game debug messages
    "WeatherPresets": [
        {
            "name": "Blizzard", // Name of preset
            "chance": 10.0, // Weighted chance of being selected (higher the number, the more frequently this preset gets selected)
            "transition_minutes_min": 5.0, // Minimum/max minutes between transitions
            "transition_minutes_max": 10.0,
            "duration_minutes_min": 10.0, // Min/max minutes duration (stacks on top of transition)
            "duration_minutes_max": 20.0, // So this preset could last a max of 30 mins in total
            "overcast_min": 0.9, // Overcast min/max 0-100% (randomly selected)
            "overcast_max": 1.0,
            "wind_maxspeed": 50.0, // Max wind speed m/s (default is usually around 20-30m/s)
            "wind_min": 1.0, // 100% of max wind speed (0-1, 10% would be 0.1)
            "wind_max": 1.0,
            "rain_min": 0.0, // Rain intensity (0-100% represented as 0-1)
            "rain_max": 0.0,
            "snow_min": 1.0, // Snow intensity (0-100% represented as 0-1)
            "snow_max": 1.0,
            "fog_min": 1.0, // Fog intensity/distance (0-100% represented as 0-1) - 1 = VERY foggy and limited view distance
            "fog_max": 1.0,
            "storm": 0, // Enable/disable storms
            "thunder_timeout": 0.0 // Minimum time between thunder
        },
        {
            "name": "Blizzard With Rain",
            "chance": 10.0,
            "transition_minutes_min": 5.0,
            "transition_minutes_max": 10.0,
            "duration_minutes_min": 10.0,
            "duration_minutes_max": 20.0,
            "overcast_min": 0.9,
            "overcast_max": 1.0,
            "wind_maxspeed": 50.0,
            "wind_min": 1.0,
            "wind_max": 1.0,
            "rain_min": 0.0,
            "rain_max": 0.1,
            "snow_min": 1.0,
            "snow_max": 1.0,
            "fog_min": 1.0,
            "fog_max": 1.0,
            "storm": 1,
            "thunder_timeout": 180.0
        },
        {
            "name": "Clear Skies",
            "chance": 50.0,
            "transition_minutes_min": 10.0,
            "transition_minutes_max": 30.0,
            "duration_minutes_min": 15.0,
            "duration_minutes_max": 30.0,
            "overcast_min": 0.0,
            "overcast_max": 0.2,
            "wind_maxspeed": 10.0,
            "wind_min": 0.1,
            "wind_max": 0.5,
            "rain_min": 0.0,
            "rain_max": 0.0,
            "snow_min": 0.0,
            "snow_max": 0.0,
            "fog_min": 0.0,
            "fog_max": 0.0,
            "storm": 0,
            "thunder_timeout": 0.0
        },
        {
            "name": "Light Snow",
            "chance": 100.0,
            "transition_minutes_min": 5.0,
            "transition_minutes_max": 10.0,
            "duration_minutes_min": 5.0,
            "duration_minutes_max": 10.0,
            "overcast_min": 0.3,
            "overcast_max": 0.5,
            "wind_maxspeed": 10.0,
            "wind_min": 0.1,
            "wind_max": 0.5,
            "rain_min": 0.0,
            "rain_max": 0.0,
            "snow_min": 0.1,
            "snow_max": 0.5,
            "fog_min": 0.0,
            "fog_max": 0.1,
            "storm": 0,
            "thunder_timeout": 0.0
        },
        {
            "name": "Light Rain",
            "chance": 5.0,
            "transition_minutes_min": 5.0,
            "transition_minutes_max": 10.0,
            "duration_minutes_min": 2.0,
            "duration_minutes_max": 5.0,
            "overcast_min": 0.5,
            "overcast_max": 0.7,
            "wind_maxspeed": 10.0,
            "wind_min": 0.1,
            "wind_max": 0.5,
            "rain_min": 0.0,
            "rain_max": 0.1,
            "snow_min": 0.0,
            "snow_max": 0.0,
            "fog_min": 0.05,
            "fog_max": 0.1,
            "storm": 0,
            "thunder_timeout": 0.0
        }
    ]
}

Weather.bin

While using this mod the weather's persistent data is saved to a .bin file and reloaded on each server restart.

This ensure the weather stays persistent between restarts, so if your server is mid-transition to a storm for example, then on the next restart it will continue the transition where it left off.

This also makes it easy to reset your weather. Simply delete the weather.bin file and your weather will be reset on the next restart.

The bin file is saved here:

%server_root/mpmissions/map_name/storage_1/data/weather.bin

Be careful deleting any other files in this folder as this folder stores all of your server's persistence (bases, stashes, player loot etc).

Master Config

To enable this mod set "ZenWeatherConfig": 1 in %server_profile/Zenarchist/ZenModPackConfig.json

It's disabled by default.

ZEN'S MOD WIKI

Setup Guide

General Information


Utilities

My utility style mods for debugging etc.

Game Mechanics

Mods which affect game mechanics:

Gear / Objects

Mods which add gear to the game:

Server-Side Mods

Mods which run purely server-side:

Mods Not In Modpack

My standalone mods

Clone this wiki locally