Jump to content
Sign in to follow this  
tortuosit

Dynamic weather script and addon: tort_DynamicWeather

Recommended Posts

Guest

New version frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

Great stuff, thanks for making and sharing!

/KC

Share this post


Link to post
Share on other sites

I'm testing this with Pilgrimage now - so far, so good. I like kind of settings. One suggestion: one more setting to choose optional delay before first weather alteration (or taking initial weather as starting point). This way I can still have eg default initial weather settings in Pilgrimage and dynamic weather later.

Also one observation (not a problem really, just something to be awared of) - found, so it is possible such fog setting, so you can't see anything at all, just white voile. You don't see even yourself in 3rd view. It was 5 AM, heavy clouds, fog (not changed max possible value - it's 0.5), and probably also ground fog. It was even funny, I was like blind, moving on hearing and map markers, but after some time decided to wait this out.

Share this post


Link to post
Share on other sites
I'm testing this with Pilgrimage now - so far, so good. I like kind of settings. One suggestion: one more setting to choose optional delay before first weather alteration (or taking initial weather as starting point). This way I can still have eg default initial weather settings in Pilgrimage and dynamic weather later.

Someone else asked for this. I give you both suggestions. I've added (it's optional) a last argument, you can attach the delay in seconds <n> the following way:

If n > 0, delay n seconds and apply initial weather

If n < 0, delay abs(n) seconds and go smoothly to initial weather (simply script is running in normal mode) from what you set in your mission. So it will be there (scripts default) in 30 minutes.

Will update mod and distrib later the week.

/*
tort_DynamicWeather
Version: 1.1.7
Author: tortuosit; derived of a weather script by Meatball
Date: 20140805

Disclaimer: Feel free to use and modify this code. Please report errors and enhancements back so that anybody can profit.

*** Thread and documentation: http://forums.bistudio.com/showthread.php?178674 ***

How to use:
1 - Save this script into your mission directory as tort_DynamicWeather.sqf
2 - Call it with 0 = ["cloudy", "freeCycle", [0.1, 0], [0.1, 0.3], [0, 0.8, 0, 0.6, 0, 1], 0, 0, 5] execVM "\@tort_DynamicWeather\script\tort_DynamicWeather.sqf";
   Arguments and presets see http://forums.bistudio.com/showthread.php?178674.

THIS SCRIPT WON'T RUN ON DEDICATED SERVERS */
if (!isServer) exitWith {};
tort_dynamicweather = true; testvalue = 1; tRandomCounter = 0;
private ["_ocMin", "_ocMax", "_fogMin", "_fogMax", "_windMin", "_windMax", "_minVari", "_maxVari", "_ignoreMinMax", "_randomEvent", "_transitionSpeed", "_fogMinHeight", "_fogMaxHeight", "_daytime", "_fogEnableGroundfog", "_groundfogBetween", "_goundFogActive", "_seed", "_turbulence"];

// You can change the following values /////////////////////////////////////////
_fogEnableGroundfog = 1; // 0 or 1
_groundfogBetween = [20, 8]; // groundfog between hours of day
_fogMinHeight = 10; _fogMaxHeight = 80;
// Do not change anything below this line //////////////////////////////////////

_count = count _this;
if (_count > 7) then {sleep abs(_this select 7);};

// Random number generator
// Input: number, seed (integer)
// _myrandomnumber = [max] call tRandom;
tRandom = {
  tRandomCounter = tRandomCounter + 1;
  private["_i","_num","_out","_arr"]; _out = "";
  for "_i" from 1 to 6 do {
     _num = sin(_i^3 + tRandomCounter + seedVar) + 1;
     _arr = toArray str(_num);
     if ((count _arr) > 6) then {_out = _out + toString([_arr select ((count _arr) - 2)]);};
  };
  seedvar = (1000000 - (parseNumber (_out)) + tRandomCounter) % 1000000;
  ((_this select 0) * parseNumber ("0." + _out))
};

_initial = "cloudy"; if (_count > 0) then {_initial = _this select 0};
tort_trend = "freeCycle"; if (_count > 1) then {tort_trend = _this select 1};
_probRndChange = [0, 0]; if (_count > 2) then {_probRndChange = _this select 2};
_variation = [0, 0.2, 1800]; if (_count > 3) then {_variation = _this select 3};
_minMax = [0, 1, 0, 0.5, 0, 1]; if (_count > 4) then {_minMax = _this select 4};
_debugMode = 0; if (_count > 5) then {_debugMode = _this select 5};
  if (_debugMode == 3) then {_debugMode = 100};
_seed = 0; if (_count > 6) then {_seed = (_this select 6) % 1000000};
if (_seed == 0) then {_seed = floor(random(1000000));};
seedVar = _seed;

_minVari = _variation select 0; _maxVari = _variation select 1;
if ((count _variation) > 2) then {_transitionSpeed = (_variation select 2) * 60} else {_transitionSpeed = 1800};
_ocMin = _minMax select 0;_ocMax = _minMax select 1;
_fogMin = _minMax select 2; _fogMax = _minMax select 3;
_windMin = _minMax select 4; _windMax = _minMax select 5;

if (typeName _probRndChange == "SCALAR") then {_probRndChange = [_probRndChange, 0]};

if (typeName _initial == "ARRAY") then {
  if ((typeName (_initial select 0)) == "STRING") then {
     _initial = (_initial select 0);
  } else {
     tort_overcast = _initial select 0; tort_fog = _initial select 1; tort_windStrength = _initial select 2; tort_rain = _initial select 3; windDirection = [360] call tRandom;
     if isNil "tort_overcast" then {tort_overcast = [1] call tRandom;}; if isNil "tort_rain" then {tort_rain = 0}; if isNil "tort_fog" then {tort_fog = [1] call tRandom;}; if isNil "tort_windStrength" then {tort_windStrength = [1] call tRandom;};
     if (tort_overcast < 0) then {tort_overcast = [abs(tort_overcast)] call tRandom;};
     if (tort_fog < 0) then {tort_fog = [abs(tort_fog)] call tRandom;};
     if (tort_windStrength < 0) then {tort_windStrength = [abs(tort_windStrength)] call tRandom;};
  };
};

// Set initial weather presets
if (typeName _initial == "STRING") then {
  switch (_initial) do {
     case "clear": {tort_overcast = 0; tort_rain = 0; tort_fog = 0; tort_windStrength = [0.1] call tRandom; windDirection = [360] call tRandom; tort_rain = 0};
     case "cloudy": {tort_overcast = 0.4 + ([0.15] call tRandom); tort_fog = ([0.015] call tRandom); tort_windStrength = 0.2 + ([0.06] call tRandom); windDirection = ([360] call tRandom); tort_rain = 0};
     case "foggy":  {tort_overcast = 0.3 + ([0.15] call tRandom); tort_fog = 0.4 + ([0.2] call tRandom); tort_windStrength = 0.3 + ([0.4] call tRandom); windDirection = [360] call tRandom; tort_rain = 0};
     case "bad": {tort_overcast = 0.8 + ([0.15] call tRandom); tort_fog = 0.1 + ([0.1] call tRandom); tort_windStrength = 0.6 + ([0.4] call tRandom); windDirection = [360] call tRandom; tort_rain = 0.7 + ([0.3] call tRandom)};
     case "random": {tort_overcast = _ocMin + ([_ocMax-_ocMin] call tRandom); tort_windStrength = _windMin + ([_windMax - _windMin] call tRandom); windDirection = [360] call tRandom;
                     tort_fog = _fogMin + (([1] call tRandom) * ([_fogMax - _fogMin] call tRandom));tort_rain = 0;}; // higher probability to lower fog values
     case "rndGood": {tort_overcast = ([0.5] call tRandom); tort_windStrength = ([0.5] call tRandom); windDirection = [360] call tRandom;
                     tort_fog = (([0.5] call tRandom) * ([_fogMax - _fogMin] call tRandom)); tort_rain = 0;}; // higher probability to lower fog values
     case "rndBad": {tort_overcast = 0.5 + ([0.5] call tRandom); tort_windStrength = 0.5 + ([0.5] call tRandom); windDirection = [360] call tRandom;
                     tort_fog = ((0.5 + ([0.5] call tRandom)) * ([_fogMax - _fogMin] call tRandom)); tort_rain = 0;}; // higher probability to lower fog values
     case "sunny": {tort_overcast = 0.3 + ([0.08] call tRandom); tort_fog = 0; tort_windStrength = [0.5 ] call tRandom; windDirection = [360] call tRandom; tort_rain = 0;}; //sunny
     default {tort_overcast = 0.3; tort_fog = 0; tort_windStrength = 0.1; windDirection = [360] call tRandom; tort_rain = 0;};
  };
};

_groundFogActive = false; currentTime = (date select 3) + ((date select 4)/60);
if ((currentTime > 8) && (currentTime < 20)) then {_daytime = true} else {_daytime = false};
if ((_groundfogBetween select 0) < (_groundfogBetween select 1)) then {
 if ((currentTime > (_groundfogBetween select 0)) && (currentTime < (_groundfogBetween select 1))) then {_groundFogActive = true;};
} else {
  if ((currentTime > (_groundfogBetween select 0)) || (currentTime < (_groundfogBetween select 1))) then {_groundFogActive = true;};
};
if (([1] call tRandom) < 0.05) then {_groundFogActive = !_groundFogActive};
fogDecay = (0.15 - ([0.05] call tRandom) - ([0.05] call tRandom) - ([0.05] call tRandom)) * _fogEnableGroundfog;
fogBase = (_fogMinHeight + ([_fogMaxHeight - _fogMinHeight] call tRandom)) * _fogEnableGroundfog;
if !(_groundFogActive) then {fogDecay = 0.01; fogBase = 0;};

// set constants to initial levels
tort_constantLevels = [tort_overcast, tort_fog, tort_windStrength];

// apply initial weather
if !((_count > 7) && ((_this select 7) < 0)) then {
  if (_debugMode <3) then {
     skiptime -24; 86400 setOvercast tort_overcast; skiptime 24; 0 setRain tort_rain;
     sleep 0.5;simulWeatherSync;sleep 0.5;ForceWeatherChange;sleep 0.5;
     0 setFog [tort_fog, fogDecay, fogBase]; 0 setWindStr tort_windStrength; 0 setWindDir windDirection;
  };
  // write 2 log lines to rpt
  diag_log format ["TORT_DYNAMICWEATHER[ARGS] [%1, %2, %3, %4, %5, %6, %7]",_this select 0,_this select 1,_this select 2,_this select 3,_this select 4,_this select 5,_this select 6];
  diag_log format ["TORT_DYNAMICWEATHER[sEED#%1][iNITWEATHER] OC:%2 FOG:[%3,%4,%5] WSTR:%6 WDIR:%7 POS:%8",_seed,round(tort_overcast*100)/100,round(tort_fog*100)/100,round(fogDecay*100)/100,round(fogBase*100)/100,round(tort_windStrength*100)/100,windDirection,getPos player];

  if ((_debugMode > 0) && (_debugMode < 3)) then {
     hint format ["TORT_DYNAMICWEATHER [sEED#%1] Initial weather: Overcast %2 | Fog [%3, %4, %5] | Wind %6 | DebugMode %7",_seed,round(tort_overcast*100)/100,round(tort_fog*100)/100,round(fogDecay*100)/100,round(fogBase*100)/100,round(tort_windStrength*100)/100,_debugMode]; sleep 10;
  };
};

while {true} do {
  if (tort_trend == "constant") then {_turbulence = 1} else {_turbulence = 1 + floor([4*tort_overcast] call tRandom);};
  for "_i" from 1 to _turbulence do {
     if (_debugMode < 3) then {currentTime = (date select 3);};
     _randomEvent = (([1] call tRandom) < (_probRndChange select 0));
     _groundFogActive = false;
     if ((_groundfogBetween select 0) < (_groundfogBetween select 1)) then {
       if ((currentTime > (_groundfogBetween select 0)) && (currentTime < (_groundfogBetween select 1))) then {_groundFogActive = true;};
     } else {
        if ((currentTime > (_groundfogBetween select 0)) || (currentTime < (_groundfogBetween select 1))) then {_groundFogActive = true;};
     };
     if ((currentTime > 8) && (currentTime < 20)) then {_daytime = true} else {_daytime = false};
     if (([1] call tRandom) < 0.05) then {_groundFogActive = !_groundFogActive};
     if (_groundFogActive) then {
        fogDecay = (0.15 - ([0.05] call tRandom) - ([0.05] call tRandom) - ([0.05] call tRandom));
        fogBase = (_fogMaxHeight - ([(0.25 * (_fogMaxHeight - _fogMinHeight))] call tRandom) - ([(0.25 * (_fogMaxHeight - _fogMinHeight))] call tRandom) - ([(0.25 * (_fogMaxHeight - _fogMinHeight))] call tRandom) - ([(0.25 * (_fogMaxHeight - _fogMinHeight))] call tRandom));
     } else {
        fogDecay = 0.01; fogBase = 0;
     };
     // Create random numbers for next forecast.
     _randOc = (_minVari + ([_maxVari - _minVari] call tRandom)) / _turbulence;
     _randFog = (_minVari + ([_maxVari - _minVari] call tRandom)) / _turbulence;
     _randWS =(_minVari + ([_maxVari - _minVari] call tRandom)) / _turbulence;
     _randWD = (round((([180] call tRandom)-90)* _turbulence *10))/10;

// ######## RANDOM NEXT WEATHER ######## //
     if ((tort_trend == "random") || (_randomEvent)) then {
        _ignoreMinMax = (([1] call tRandom) < (_probRndChange select 1));
        if (_ignoreMinMax) then {
           tort_overcast = [1] call tRandom;
           tort_fog = [1] call tRandom;
           tort_windStrength = [1] call tRandom;
        } else {
           tort_overcast = _ocMin + ([_ocMax - _ocMin] call tRandom);
           tort_windStrength = _windMin + ([_windMax - _windMin] call tRandom);
           if (_daytime) then {
              tort_fog = _fogMin + ((([_fogMax - _fogMin] call tRandom)) * ([1] call tRandom));
              // on not _randomEvent encounters, turn off fog completely
              if (_randomEvent && (([1] call tRandom) > (tort_overcast * 0.7))) then {tort_fog = _fogMin}; //often no fog
           } else {
              // nighttime: more fog possible
              tort_fog = _fogMin + ([_fogMax - _fogMin] call tRandom);
              // on not _randomEvent encounters, likely to turn off fog completely
              if (!_randomEvent && (([1] call tRandom) < (0.15))) then {tort_fog = _fogMin}; //sometimes no fog
           };
        tort_windStrength = _windMin + ([_windMax - _windMin] call tRandom);
        };
     };

// ######## always oscillate between extremes ######## //
     if (tort_trend == "oscillate") then {
        _ignoreMinMax = (([1] call tRandom) < (_probRndChange select 1));
        if (_ignoreMinMax) then {
           if (([1] call tRandom) < 0.9) then {
              if (tort_overcast < (_ocMin + (0.5 * (_ocMax-_ocMin)))) then {
                 tort_overcast = _ocMax - _minVari - ([_maxVari - _minVari] call tRandom);
              } else {
                 tort_overcast = _ocMin + _minVari + ([_maxVari - _minVari] call tRandom);
              };
           };
           if (([1] call tRandom) < 0.9) then {
              if (tort_fog < (_fogMin + (0.5 * (_fogMax-_fogMin)))) then {
                 tort_fog = _fogMax - _minVari - ([_maxVari - _minVari] call tRandom);
              } else {
                 tort_fog = _fogMin + _minVari + ([_maxVari - _minVari] call tRandom);
              };
           };
           if (([1] call tRandom) < 0.9) then {
              if (tort_windStrength < (_windMin + (0.5 * (_windMax-_windMin)))) then {
                 tort_windStrength = _windMax - _minVari - ([_maxVari - _minVari] call tRandom);
              } else {
                 tort_windStrength = _windMin + _minVari + ([_maxVari - _minVari] call tRandom);
              };
           };
        } else {
           if (([1] call tRandom) < 0.9) then {
              if (tort_overcast < 0.5) then {
                 tort_overcast = 1 - _minVari - ([_maxVari - _minVari] call tRandom);
              } else {
                 tort_overcast = _minVari + ([_maxVari - _minVari] call tRandom);
              };
           };
           if (([1] call tRandom) < 0.9) then {
              if (tort_fog < 0.5) then {
                 tort_fog = 1 - _minVari - ([_maxVari - _minVari] call tRandom);
              } else {
                 tort_fog = _minVari + ([_maxVari - _minVari] call tRandom);
              };
           };
           if (([1] call tRandom) < 0.9) then {
              if (tort_windStrength < 0.5) then {
                 tort_windStrength = 1 - _minVari - ([_maxVari - _minVari] call tRandom);
              } else {
                 tort_windStrength = _minVari + ([_maxVari - _minVari] call tRandom);
              };
           };
        };
     };

// ######## CONSTANT NEXT WEATHER ######## //
     if (!_randomEvent && (tort_trend == "constant")) then {
        if (_maxVari == 0) then {
           // if no variance, immediately return back to constant value
           tort_overcast = (tort_constantLevels select 0) + _minVari - ([2 * _minVari] call tRandom);
           tort_fog = (tort_constantLevels select 1) + _minVari - ([2 * _minVari] call tRandom);
           tort_windStrength = (tort_constantLevels select 2) + _minVari - ([2 *_minVari] call tRandom);
//          tort_overcast = (tort_constantLevels select 0); tort_fog = (tort_constantLevels select 1); tort_windStrength = (tort_constantLevels select 2);
        } else {
           // move back to constant value in user def. variation steps
           tort_overcastPrev = tort_overcast; tort_fogPrev = tort_fog; tort_windStrengthPrev = tort_windStrength;
           if (tort_overcast < ((tort_constantLevels select 0) - _maxVari)) then {
              tort_overcast = tort_overcast + _randOc;
              if (tort_overcast > ((tort_constantLevels select 0) + _maxVari)) then {tort_overcast = (tort_constantLevels select 0) + ([_maxVari] call tRandom)};
           };
           if (tort_overcast > ((tort_constantLevels select 0) + _maxVari)) then {
              tort_overcast = tort_overcast - _randOc;
              if (tort_overcast < ((tort_constantLevels select 0) - _maxVari)) then {tort_overcast = (tort_constantLevels select 0) - ([_maxVari] call tRandom)};
           };
           if (tort_fog < ((tort_constantLevels select 1) - _maxVari)) then {
              tort_fog = tort_fog + _randFog;
              if (tort_fog > ((tort_constantLevels select 1) + _maxVari)) then {tort_fog = (tort_constantLevels select 1) + ([_maxVari] call tRandom)};
           };
           if (tort_fog > ((tort_constantLevels select 1) + _maxVari)) then {
              tort_fog = (tort_constantLevels select 1) - _randFog;
              if (tort_fog < ((tort_constantLevels select 1) - _maxVari)) then {tort_fog = (tort_constantLevels select 1) - ([_maxVari] call tRandom)};
           };
           if (tort_windStrength < ((tort_constantLevels select 2) - _maxVari)) then {
              tort_windStrength = tort_windStrength + _randWS;
              if (tort_windStrength > ((tort_constantLevels select 2) + _maxVari)) then {tort_windStrength = (tort_constantLevels select 2) + ([_maxVari] call tRandom)};
           };
           if (tort_windStrength > ((tort_constantLevels select 2) + _maxVari)) then {
              tort_windStrength = (tort_constantLevels select 2) - _randFog;
              if (tort_windStrength < ((tort_constantLevels select 2) - _maxVari)) then {tort_windStrength = (tort_constantLevels select 2) - ([_maxVari] call tRandom)};
           };
           if (tort_overcast == tort_overcastPrev) then {
              tort_overcast = (tort_constantLevels select 0) + _minVari - ([2 * _minVari] call tRandom)};
              if (tort_fog == tort_fogPrev) then {tort_fog = (tort_constantLevels select 1) + _minVari - ([2 * _minVari] call tRandom);
           };
           if (tort_windStrength == tort_windStrengthPrev) then {tort_windStrength = (tort_constantLevels select 2) + _minVari - ([2 *_minVari] call tRandom);};
           windDirection = windDirection + _randWD; if (windDirection >= 360 ) then {windDirection = windDirection - 360}; if (windDirection < 0) then {windDirection = 360 + windDirection};
        };
        if (tort_overcast < 0) then {tort_overcast = 0}; if (tort_overcast > 1) then {tort_overcast = 1};
        if (tort_fog < 0) then {tort_fog = 0}; if (tort_fog > 1) then {tort_fog = 1};
        if (tort_windStrength < 0) then {tort_windStrength = 0}; if (tort_windStrength > 1) then {tort_windStrength = 1};
     };

// ######## CYCLING WEATHER ######## //
     if (!_randomEvent && (tort_trend != "constant") && (tort_trend != "random")) then {
        switch (tort_trend) do {
           case "pBetter":
           {
              // 2/3 chance of weather getting better
              if (([3] call tRandom)>1) then {_randOc = -1 * _randOc;_randWS = -1 * _randWS;};
              if (([4] call tRandom)>1) then {_randFog = -1 * _randFog};
              // if wrong direction, then soft
              if (_randOc > 0) then {_randOc = _randOc * ([1] call tRandom)};
              if (_randWS > 0) then {_randWS = _randWS * ([1] call tRandom)};
              if (_randFog > 0) then {_randFog = _randFog * ([1] call tRandom)};
           };
           case "pWorse": {
              // 2/3 chance of weather getting worse (except fog)
              if (([3] call tRandom)<1) then {_randOc = -1 * _randOc;_randWS = -1 * _randWS;};
              if (([3] call tRandom)>1) then {_randFog = -1 * _randFog};
              // if wrong direction, then soft
              if (_randOc < 0) then {_randOc = _randOc * ([1] call tRandom)};
              if (_randWS < 0) then {_randWS = _randWS * ([1] call tRandom)};
              if (_randFog < 0) then {_randFog = _randFog * ([1] call tRandom)};
           };
           case "better": {
              _randOc = -1 * _randOc; _randWS = -1 * _randWS; _randFog = -1 * _randFog;
           };
           case "worse": {
              if (([5] call tRandom)>1) then {_randFog = -1 * _randFog};
           };
           case "freeCycle": {
              if (([2] call tRandom)>1) then {_randOc = -1 * _randOc;_randWS = -1 * _randWS;_randFog = -1 * _randFog};
           };
        };
        // Create next random overcast level and keep it between borders
        // if value exceeds border, choose a new value between border and _maxVari
        tort_overcast = tort_overcast + _randOc;
        if (tort_overcast > _ocMax) then {tort_overcast = _ocMax - ([_maxVari] call tRandom)};
        if (tort_overcast < _ocMin) then {tort_overcast = _ocMin + ([_maxVari] call tRandom)};
        // Create next random fog level  //keep fog rather low
        tort_fog = tort_fog + _randFog;
        if (_groundFogActive) then {
           if (([1] call tRandom) < 0.5) then {tort_fog = _fogMin + ([_maxVari] call tRandom)};
        } else {
           if (([1] call tRandom) > (tort_overcast * 0.8)) then {tort_fog = _fogMin}; //often min fog at daytime
        };
        if (tort_fog > _fogMax) then {tort_fog = _fogMax - _minVari - ([_maxVari] call tRandom)};
        if (tort_fog < _fogMin) then {tort_fog = _fogMin};
        // Create next random Wind level
        tort_windStrength = tort_windStrength + _randWS;
        if (tort_windStrength > _windMax) then {tort_windStrength = _windMax - ([_maxVari] call tRandom)};
        if (tort_windStrength < _windMin) then {tort_windStrength = _windMin + ([_maxVari] call tRandom)};
     };

     // Create next random Wind Dir level and keep between [0 .. 360[
     if ((([1] call tRandom) > 0.8) || (tort_trend == "random") || (_randomEvent)) then {windDirection = ([360] call tRandom);} else {windDirection = windDirection + _randWD;};
     if (windDirection >= 360 ) then {windDirection = windDirection - 360};
     if (windDirection < 0) then {windDirection = 360 + windDirection};

// ######## EXECUTE & DEBUG ########
     if ((_debugMode == 1) || (_debugMode == 2)) then {
        sleep 2;
        diag_log format ["TORT_DYNAMICWEATHER@%1s[sEED#%2][DONE IN MAX:%3s/%4s] OC:%5 FOG:[%6,%7,%8] WSTR:%9 WDIR:%10 POS:%11",time,_seed,floor(_transitionSpeed / _turbulence),_transitionSpeed,round(tort_overcast*100)/100,round(tort_fog*100)/100,round(fogDecay*100)/100,round(fogBase*100)/100,round(tort_windStrength*100)/100,windDirection,getPos player];
        hint format ["[sEED#%1] [Time %2:%3h] Next weather: Overcast %4 | Fog [%5, %6, %7] | Wind %8 | Turbulence %9",_seed,date select 3,date select 4,round(tort_overcast*1000)/1000,round(tort_fog*1000)/1000,round(fogDecay*1000)/1000,round(fogBase*1000)/1000,round(tort_windStrength*1000)/1000,_turbulence];
     };

     if (_debugMode < 2) then {
        // apply new weather
        if (_i == 1) then {_transitionSpeed setOvercast tort_overcast;}; //; floor(5 + ([30] call tRandom)) setRain 0
        floor(_transitionSpeed / _turbulence * (0.9 + ([0.1] call tRandom))) setFog [tort_fog, fogDecay, fogBase];
        floor(_transitionSpeed / _turbulence * (0.9 + ([0.1] call tRandom))) setWindStr tort_windStrength;
        floor(_transitionSpeed / _turbulence * (0.9 + ([0.1] call tRandom))) setWindDir windDirection;
        sleep floor(_transitionSpeed / _turbulence);
     };

     if (_debugMode == 2) then {
        diag_log format ["TORT_DYNAMICWEATHER@%1s[sEED#%2][DONE IN MAX:%3s/%4s] OC:%5 FOG:[%6,%7,%8] WSTR:%9 WDIR:%10 POS:%11",time,_seed,floor(_transitionSpeed / _turbulence),_transitionSpeed,round(tort_overcast*100)/100,round(tort_fog*100)/100,round(fogDecay*100)/100,round(fogBase*100)/100,round(tort_windStrength*100)/100,windDirection,getPos player];
        // apply weather quickly
        _transitionSpeed setOvercast tort_overcast;
        3 setRain 0; 3 setFog [tort_fog, fogDecay, fogBase]; 3 setWindStr tort_windStrength; 3 setWindDir windDirection;
        sleep 4; forceweatherchange; skiptime (1 / (2 * _turbulence));
     };

     if (_debugMode > 10) then {
        diag_log format ["TDW,%1, SEEDVAR,%2, TIME,%3, RND,%4, OC,%5, GFA,%6, FOGL,%7, FOGD,%8, FOGB,%9, WSTR,%10, WDIR,%11",testvalue,seedvar,(floor(currentTime * 100))/100,_randomEvent,round(tort_overcast*100)/100,_groundFogActive,round(tort_fog*10000)/10000,round(fogDecay*10000)/10000,round(fogBase*100)/100,round(tort_windStrength*100)/100,floor(windDirection)];
        hint format ["Value#%1 written to .rpt",testvalue]; sleep 0.005;
        testvalue = testvalue + 1;
        thisLength = (round((_transitionSpeed / _turbulence)/36))/100;
        currentTime = (currentTime + thisLength) % 24;
     };
  };
  if ((testvalue > _debugMode) && (testvalue > 3)) then {hint format ["%1 values written to .rpt - quitting", _debugMode];};
  if ((testvalue > _debugMode) && (testvalue > 3)) exitWith {};
};

Also one observation (not a problem really, just something to be awared of) - found, so it is possible such fog setting, so you can't see anything at all, just white voile. You don't see even yourself in 3rd view. It was 5 AM, heavy clouds, fog (not changed max possible value - it's 0.5), and probably also ground fog. It was even funny, I was like blind, moving on hearing and map markers, but after some time decided to wait this out.

Thanks for reporting. Oh, I think it's a problem and I am aware of it. It happens with ground fog (which *can* appear between deep night until (IIRC) 7am and on sea level. It's the nasty setfog array, I have to rework it I think, just didn't find time (i.e., making fog also dependent on player elevation). As for the script version, you may turn it off, line 22, this will probably resolve it. Or setting the fogdecay vars to 0 instead 0.01, but I cannot test things now.

BTW I have realized the boolean var "tort_dynamicweather" cannot be seen from inside your mission pbo scope, it's in the beginning of my script, seems like I need to expand the scope?!

Have you used the pbo or implanted it into your mission btw?

Edited by tortuosit

Share this post


Link to post
Share on other sites

Version 1.1.7

Changes: Possibility to delay script/addon execution. As for Addon, you need to update your userconfig file. Script version gets an additional argument, see codebox below.

Positive values (normal behaviour): Script delays n seconds followed by immediate application of initial weather.

Negative values: script runs immediately, but does at first not touch the weather which the mission maker has set. It does then go smoothly towards this scripts initial weather in (positive value) seconds.

Remark 1: This way, the script can respect mission makers initial weather, useful if missions do not do further weather treatment except at init.

Remark 2: No harsh apply of init weather here, therefore: Keep in mind overcast transition takes long in ArmA. If you choose too low values, overcast may not catch up with the initial weather you set.

/* Script delay in seconds
   As for the script version, add this as the last value to the command line:
   .. debugMode, randomSeed, delaySeconds] execVM "\@tort_DynamicWeather\script\tort_DynamicWeather. sqf";

   Example values:
   10: This will delay execution for 10 seconds, initial weather will be applied
       immediately and harsh 10 seconds after mission start.
   -1200: (negative values) At mission start, weather will stay as set by mission maker, but will trend
      smoothly towards initial weather (which you set in this script) in 1200 seconds = 20 minutes.
*/

Let me know if there's bugs, unfortunately cannot test too much these days.

Mission makers: in case of my mod version, the script sleeps at script level, so initialization is already done, i.e. the 0-8 support menu entries are already loaded. Not sure if I should delay even on init.sqf level, before the menu entries get added.

Edited by tortuosit

Share this post


Link to post
Share on other sites
Guest

New version frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites
Guest

New version frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

Known issue (thx Ruthberg - with excellent Kestrel and ballistics mods!) for pointing this out:

setWindStr command seems to be broken at least in latest ArmA dev build, so even stormy presets create no wind. Will have to replace it with https://community.bistudio.com/wiki/setWind

I have many ideas for the 0-8 support menu, but currently have no time.

Edited by tortuosit

Share this post


Link to post
Share on other sites

Be advised, Chrome is reporting malicious software when I try to download your file, please check for any possible issues.

best regards

Sonsalt

Share this post


Link to post
Share on other sites

Thanks for reporting. Probably it's the cmd file inside. As a user service I auto copy to userconfig and edit the configuration file via this cmd file. If users or overly active malware scanners will report too often and can't handle this, I'll remove that service. Or use 7-zip format, maybe Chrome cannot look into.

This:

@echo off
if "%ProgramFiles(x86)%"=="" set ProgramFiles(x86)=%ProgramFiles%
set configfile="%ProgramFiles(x86)%\Steam\SteamApps\common\Arma 3\userconfig\tort_DynamicWeather\tort_DynamicWeather_config.hpp"
if exist %configfile% goto :configexists:

:copyConfigFile:
mkdir "%ProgramFiles(x86)%\Steam\SteamApps\common\Arma 3\userconfig"
xcopy /d /y /e "userconfig\*" "%ProgramFiles(x86)%\Steam\SteamApps\common\Arma 3\userconfig\*"

:configexists:
if exist %configfile% start "" /b "%windir%\notepad.exe" "%ProgramFiles(x86)%\Steam\SteamApps\common\Arma 3\userconfig\tort_DynamicWeather\tort_DynamicWeather_config.hpp"

Share this post


Link to post
Share on other sites

Version 1.2

Support menu (keyboard 0-8) reorg and fixes.

- Fixes to presets and trends.

- Manual trend changes now start immediately

- Shuffle/Reset/Stop option

- Simple info screen

Presets in the menu are changed in a way, that they only define a new immediate weather, but nothing more. Trends, minima/maxima, variation speed, random option remain as they are.

Plans:

- Make menu available to script version

- Userconfig option for menu on/off

- Expose all possible weather/trend/mod aspects in menu

- Simple/Extended/Off menu toggle

Edited by tortuosit

Share this post


Link to post
Share on other sites

Nice to see you are still working on this mod and improving it. I find it a must have in my mod collection ;)

Share this post


Link to post
Share on other sites

Thx; yeah I feel the same, for my immersion needs weather is essential. But because of real life things going on I find myself not much playing ArmA... If I just could play more :D

---------- Post added at 17:45 ---------- Previous post was at 16:30 ----------

Another plan: Wind handling in own thread. Now that we have all those interesting toys for the sniper world (Ruthbergs tools and his ballistics mod, and @agm...) I feel wind needs more love.

Edited by tortuosit

Share this post


Link to post
Share on other sites

Version 1.2.1

- (mod version) A lot more aspects now controllable via 0-8 menu.

- enhanced info screen (see 0-8-1-1):

"O" is overcast, "F" is Fog, "W" is Wind.

2014-08-26_00002azqa6.jpg

Here you can see what is possible via menu:

weathermenu_main = [
 [" Settings", false],
 ["Show weather infoboard", [2],"", -5, [["expression","[] execVM '\TORT_DYNAMICWEATHER\tort_Infoboard.sqf'"]],"1","1"],
 ["STOP weather processing", [3], "", -5, [["expression", "[] execVM '\TORT_DYNAMICWEATHER\preset\stop.sqf'"]], "1", "1"],
 ["Shuffle weather", [4],"", -5, [["expression","[] execVM '\TORT_DYNAMICWEATHER\preset\shuffle.sqf'"]],"1","1"],
 ["Random change: Never", [5],"", -5, [["expression","[] execVM '\TORT_DYNAMICWEATHER\settings\Randomness0.sqf'"]],"1","1"],
 ["Random change: Rare", [6],"", -5, [["expression","[] execVM '\TORT_DYNAMICWEATHER\settings\Randomness1.sqf'"]],"1","1"],
 ["Random change: Sometimes", [7],"", -5, [["expression","[] execVM '\TORT_DYNAMICWEATHER\settings\Randomness2.sqf'"]],"1","1"],
 ["Random change: Often", [8],"", -5, [["expression","[] execVM '\TORT_DYNAMICWEATHER\settings\Randomness3.sqf'"]],"1","1"],
 ["Cycle speed: Slow", [9],"", -5, [["expression","[] execVM '\TORT_DYNAMICWEATHER\settings\slowCycles.sqf'"]],"1","1"],
 ["Cycle speed: Normal", [10],"", -5, [["expression","[] execVM '\TORT_DYNAMICWEATHER\settings\normalCycles.sqf'"]],"1","1"],
 ["Cycle speed: Fast", [11],"", -5, [["expression","[] execVM '\TORT_DYNAMICWEATHER\settings\quickCycles.sqf'"]],"1","1"]
];

weatherpreset = [
 [" Choose weather preset", false],
 ["As defined in userconfig", [2], "", -5, [["expression", "[] execVM '\TORT_DYNAMICWEATHER\preset\userconfig.sqf'"]], "1", "1"],
 ["Sunny weather", [3], "", -5, [["expression", "[] execVM '\TORT_DYNAMICWEATHER\preset\Altis.sqf'"]], "1", "1"],
 ["Cloudy", [4],"", -5, [["expression","[] execVM '\TORT_DYNAMICWEATHER\preset\cloudy.sqf'"]],"1","1"],
 ["Rainy", [5],"", -5, [["expression","[] execVM '\TORT_DYNAMICWEATHER\preset\rainy.sqf'"]],"1","1"],
 ["Stormy", [6],"", -5, [["expression","[] execVM '\TORT_DYNAMICWEATHER\preset\stormy.sqf'"]],"1","1"],
 ["No fog", [7], "", -5, [["expression", "[] execVM '\TORT_DYNAMICWEATHER\preset\nofog.sqf'"]], "1", "1"],
 ["Light fog", [8], "", -5, [["expression", "[] execVM '\TORT_DYNAMICWEATHER\preset\lightfog.sqf'"]], "1", "1"],
 ["Medium fog", [9], "", -5, [["expression", "[] execVM '\TORT_DYNAMICWEATHER\preset\mediumfog.sqf'"]], "1", "1"],
 ["Heavy fog", [10], "", -5, [["expression", "[] execVM '\TORT_DYNAMICWEATHER\preset\heavyfog.sqf'"]], "1", "1"]
];

weathertrend = [
 [" Set new weather trend", false],
 ["Constant: Stay constant and/or always return back to current level", [2], "", -5, [["expression", "[] execVM '\TORT_DYNAMICWEATHER\trend\constant.sqf'"]], "1", "1"],
 ["Better: Trending towards better weather", [3], "", -5, [["expression", "[] execVM '\TORT_DYNAMICWEATHER\trend\better.sqf'"]], "1", "1"],
 ["Worse: Trending towards worse weather", [4], "", -5, [["expression", "[] execVM '\TORT_DYNAMICWEATHER\trend\worse.sqf'"]], "1", "1"],
 ["FreeCycle: randomly moving inside the extremes", [5], "", -5, [["expression", "[] execVM '\TORT_DYNAMICWEATHER\trend\freecycle.sqf'"]], "1", "1"],
 ["pBetter: FreeCycle, but probably better", [6], "", -5, [["expression", "[] execVM '\TORT_DYNAMICWEATHER\trend\pbetter.sqf'"]], "1", "1"],
 ["pWorse: FreeCycle, but probably worse", [7], "", -5, [["expression", "[] execVM '\TORT_DYNAMICWEATHER\trend\pworse.sqf'"]], "1", "1"],
 ["Random: Every cycle random", [8], "", -5, [["expression", "[] execVM '\TORT_DYNAMICWEATHER\trend\random.sqf'"]], "1", "1"],
 ["Oscillate: Hop between good and bad", [9], "", -5, [["expression", "[] execVM '\TORT_DYNAMICWEATHER\trend\oscillate.sqf'"]], "1", "1"]
];

Edited by tortuosit

Share this post


Link to post
Share on other sites

hi t,

thnx for making this great mod.

hope you can add chaning wind (direction, strenght, etc. ...) to your mod.

ruthberg made some great mods for sniping as you mentioned in above written posts.

hope you guys are in contact.

cheers

Share this post


Link to post
Share on other sites
hope you can add chaning wind (direction, strenght, etc. ...) to your mod.

Wind in a sniper scenario is definitely interesting for me.

I was writing wind needs some love on script side. From my experience yesterday, I am not convinced any more, because ArmA seems to add a lot of wind variety (at least changing direction) on Engine side. At least it has some variation in direction. I'm not sure if it is worth to micro manage wind on script side... I will observe the vanilla wind behavior a bit more (see output of windStr and windDir function in vanilla environment) and see what is worth to implement. Still not sure if there's any reation to setGusts at all...

The mod currently handles wind strength (setWindStr) and direction (setWindDir) internally. I think I'll expose wind presets to the menu (which leave the rest of the weather unaltered).

Share this post


Link to post
Share on other sites
Guest

New version frontpaged on the Armaholic homepage.

================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×