Weather Configuration – DayZ

From Bohemia Interactive Community
Revision as of 10:40, 26 November 2021 by ImpulZ (talk | contribs)
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) -->
        <limit 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>
    <wind>
        <!-- Maximum wind speed (in m/s) -->
        <maxspeed>20</maxspeed>
        <!-- Min and max (relative 0..1) for the wind speed range, frequency of the wind changes -->
        <params min="0.0" max="1.0" frequency="30" />
    </wind>
    <!-- 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>