Author: MeatballCB
Author Website:

Requirements: No addons required

Version: 0.90

Short description: A simple/single script that allows you to add dynamic random weather for any SP/MP mission with the capability for players to choose initial weather settings.

Date: 2014-03-05 21:09

Comments: (0)


randomWeather2 Script


A simple/single script that allows you to add dynamic random weather for any SP/MP mission with the capability for players to choose initial weather settings.

There are two versions of the randomWeather2 Script included along with Demo missions.

- Completely rewrote the original randomWeather script from the ground up to make use of functions as opposed to continuously running loops.
- Compatibility with parameter setup so players can choose initial weather settings.
- Demo Mission available to show weather in action.

Installation / Usage:
1) Copy the randomWeather2.sqf file into your root mission folder.
2) Set up a call for server and clients in init.sqf:
execVM "randomWeather2.sqf";
3) If you want players to be able to select starting weather conditions, you must have the following information in your parameters section of your description.ext:
class Params
        // paramsArray[0]
       class initialWeatherParam {
          title = "Starting Weather";
          values[] = {0,1,2,3,4};
          texts[] = {"Clear","Overcast","Rain","Fog","Random"};
          default = 4;

Note: If the initialWeather parameter is not the first element in your parameters array, you must update
the "initialWeatherParam = (paramsArray select 0);" line (Search for *NOTE 1*) and update the '0' to the proper number of the array.

The base weather template information is listed below:

Weather Types (#) [Can Move From/To] [Settings: Overcast, Rain/Snow, Fog, WindEW, WindNS]
Clear (0) [0,1,5] [0.30,0,0,1,1]
Overcast (1) [0,1,2] [0.50,0,0,2,2]
Light Rain (2) [1,2,3,5] [0.60,0.3,0.05,3,3]
Medium Rain (3) [2,3,4] [0.70,0.5,0.05,4,4]
Rainstorm (4) [3] [0.80,0.9,0.1,5,5]
Light Fog (5) [0,2,5,6] [0.40,0,[0.2,0.01,15],0,0]
Medium fog (6) [5,6,7] [0.40,0,[0.4,0.005,30],0,0]
Dense Fog (7) [6] [0.40,0,[0.6,0.0025,45],0,0]

If you have multiple parameters in your 'class Params' section and you do not put the initialWeatherParam as the first parameter in that section, you must update the rw2Param number (Line 63) in your randomWeather2.sqf file to match the correct number. Remember that 'selecting' values from the parameter section of your description.ext always starts at 0 for the first defined parameter and goes up from there. So if your initialWeatherParam parameter is first in the class Params section, rw2Param = 0; will work. If it is second in the list of class Params you'd need to change it to rw2Param = 1; and so on.
For more information on Parameters, please see the description.ext biki

Known issues:
- Due to some limitations with particle effects that need to be used for snow, there are two configuration options available and you can configure them by setting the 'intSnow' variable (Line 60) to one of the following two options.
- 0 = Interior Snow Off, (Default), snow will dissipate when a player is in buildings/vehicles, but will not be visible outside windows/doors while still in the building/vehicle. Snow will restart when the player goes back outside.
- 1 = Interior Snow On , snow will always surround player, even when inside buildings/vehicles.
Unfortunately neither is perfect, but until I can figure out a better way to handle snow/particle effects, it's the best I can do.

The default/Main Version is in this root folder and does not include snow.
The test/bugged version is in the Bugged_With_Snow folder. This version does have some bugs that may make it unplayable. Primarily there is a crash to desktop bug with this version when the snow particles are in a players body on respawn. I believe this is related to the Phsyx bug and unti that's fixed with the engine, there's not much that can be done to fix it.

Going forward I will no longer be supporting or updating the snow based version, but include it if someone wants to use it or experiment with it.

Credits & Thanks:
- NeoArmageddon for lot's of help including a lot of the snow related code.

- I've gone through a major change with randomWeather2 and removed snow from the 'default' version. There is a crash to desktop bug that can surface when it is snowing and a player respawns. I believe it's related to the known Physx crash bug and caused by a snow particle being in the players body when they die/respawn.
- The new v0.9 script does not include snow, but I have included a version with snow for anyone that wishes to still use it or wants to experiment with it.
- I will not be supporting or updating the snow based version going forward unless BI fixes the underlying bug.
- Tweaked some settings to ensure that it is actually 'raining' when the mission starts if rain is selected.
- Made a minor adjustment to the initial weather setup to ensure clouds are created properly.
- Tested on stable build v1.12.

- Minor fix to code to disable snow underwater.
- Added in 2 additional changes to snow code to allow the disabling of snow based on player altitude & day or night. Both are disabled by default but can be enabled on lines 236 - 240.

- Fixed an issue where it would 'snow' underwater.
- Fixed an occasional random crash bug caused by the use of revive scripts when it was snowing.

- First Public Release

Forum topic:
- BI forums

Enable javascript to be able to download from Armaholic please!

Tags: Clear,   Fog,   Overcast,   Rain,   Snow,   Weather