Weather Configuration – DayZ

From Bohemia Interactive Community
Jump to navigation Jump to search

File name: cfgweather.xml

Overview

There are several ways of adjusting behaviour of the weather within DayZ.

  • Modding script weather state machine (overriding WorldData::WeatherOnBeforeChange method, see 4_World\Classes\Worlds\Enoch.c for example).
  • Calling MissionWeather( true ) on weather object in the mission init.c ( main() ) and then using selected Weather API calls (see 3_Game\Weather.c for extensive documentation).
  • Using cfgweather.xml file in the mission folder (or world files).

By default, all vanilla server-side missions are using the scripted weather state machine. If you want to adjust the weather behaviour, we recommend to use the cfgweather.xml.

Using cfgweather XML file

Following example shows a full (and later partial) cfgweather XML file alongside with the description of each parameters. All of these parameters do reflect the Weather script API, which can be found in 3_Game\Weather.c.

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!-- 'reset' and 'enable' are a bool, and therefore supports: 0/1, true/false, yes/no -->
<!-- 'reset' controls whether you want to load in the weather from storage or not (false by default) -->
<!-- 'enable' controls whether this file is enabled or not (true by default) -->
<weather reset="0" enable="1">
    <overcast>
        <!-- Initial conditions of the overcast (target value, time to change, how long will it stay) -->
        <current actual="0.45" time="120" duration="240" />
        <!-- What is the range of the overcast value (0..1) -->
        <limits min="0.0" max="1.0" />
        <!-- How long does it take to the overcast to change from one value to other (time in seconds) -->
        <timelimits min="900" max="1800" />
        <!-- How much should the overcast change (0..1) -->
        <changelimits min="0.0" max="1.0" />
    </overcast>
    <fog>
        <!-- Initial conditions of the fog (target value, time to change, how long will it stay) -->
        <current actual="0.1" time="120" duration="240" />
        <!-- What is the range of the fog value (0..1) -->
        <limits min="0.0" max="1.0" />
        <!-- How long does it take to the fog to change from one value to other (time in seconds) -->
        <timelimits min="900" max="1800" />
        <!-- How much should the fog change (0..1) -->
        <changelimits min="0.0" max="1.0" />
    </fog>
    <rain>
        <!-- Initial conditions of the rain (target value, time to change, how long will it stay), restricted by thresholds (see below) -->
        <current actual="0.0" time="120" duration="240" />
        <!-- What is the range of the rain value (0..1) -->
        <limits min="0.0" max="1.0" />
        <!-- How long does it take to the rain to change from one value to other (time in seconds) -->
        <timelimits min="300" max="600" />
        <!-- How much should the rain change (0..1) -->
        <changelimits min="0.0" max="1.0" />
        <!-- What range of the overcast value allows the rain to be preset (min, max overcast value, time in seconds it takes for rain to stop if the overcast is outside of the specified range) -->
        <thresholds min="0.5" max="1.0" end="120" />
    </rain>
    <windMagnitude>
        <!-- Initial conditions of the wind magnitude (target value, time to change, how long will it stay), restricted by thresholds (see below) -->
        <current actual="8.0" time="120" duration="240" />
        <!-- What is the range of the wind magnitude value in m/s -->
        <limits min="0.0" max="20.0" />
        <!-- How long does it take to the wind magnitude to change from one value to other (time in seconds) -->
        <timelimits min="120" max="240" />
        <!-- How much should the wind change -->
        <changelimits min="0.0" max="20.0" />
    </windMagnitude>
    <windDirection>
        <!-- Initial conditions of the wind direction(target value, time to change, how long will it stay), restricted by thresholds (see below) -->
        <current actual="0.0" time="120" duration="240" />
        <!-- What is the range of the wind direction (angle in radians) -->
        <limits min="-3.14" max="3.14" />
        <!-- How long does it take to the wind direction to change from one value to other (time in seconds) -->
        <timelimits min="60" max="120" />
        <!-- How much should the wind change direction -->
        <changelimits min="-1.0" max="1.0" />
    </windDirection>
    <!-- Note that in this example the snowfall is set as such that it always remains at 0. -->
    <snowfall>
        <!-- Initial conditions of the snowfall (target value, time to change, how long will it stay), restricted by thresholds (see below) -->
        <current actual="0.0" time="0" duration="32768" />
        <!-- What is the range of the snowfall value (0..1) -->
        <limits min="0.0" max="0.0" />
        <!-- How long does it take to the snowfall to change from one value to other (time in seconds) -->
        <timelimits min="300" max="3600" />
        <!-- How much should the snowfall change (0..1) -->
        <changelimits min="0.0" max="0.0" />
        <!-- What range of the overcast value allows the snowfall to be preset (min, max overcast value, time in seconds it takes for snowfall to stop if the overcast is outside of the specified range) -->
        <thresholds min="1.0" max="1.0" end="120" />
    </snowfall>
    <!-- Lightning density (0..1), threshold for the lightning appearance (tied to the overcast value, 0..1), time (seconds) between the lightning strikes -->
    <storm density="1.0" threshold="0.7" timeout="25"/>
</weather>

Everything except for reset and enable is a float and can be read either as attribute or element so it is possible to format the file even in a following way:

<weather reset="0" enable="1">
    <rain>
        <limits min="0" max="1"/>
    </rain>
    <wind>
        <maxspeed>0</maxspeed>
    </wind>
</weather>
 
 <!-- Can also be written as: -->
<weather reset="false" enable="true">
    <rain>
        <limits>
            <min>0</min>
            <max>1</max>
        </limits>
    </rain>
    <wind maxspeed="0"/>
</weather>