Advertisement
Greger_Veteran

Untitled

Aug 12th, 2023
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 1.57 KB | None | 0 0
  1. //========================================
  2. // Weather Auto Change By Greger (Veteran)
  3. //========================================
  4. // You can:
  5. // Use and modify this script
  6. // Make money with it
  7. // Lie to people that you made this script
  8. // Anything else you want
  9. //========================================
  10.  
  11. //CONFIGURATION VARIABLES
  12. CFG_minOvercast = 0; //MINIMUM OVERCAST (0-1)
  13. CFG_maxOvercast = 1; //MAXIMUM OVERCAST THAT WILL BE REACHED (0-1)
  14. CFG_chanceToChangeWeather = 0.5; //DEFAULT IS 0.5 (50%)
  15. CFG_waitIfNotChange = 600; //IN SECONDS
  16. CFG_weatherDegug = true; //SHOW FULL CHANGE TIME PREDICTION
  17.  
  18. //INIT
  19. private _oStart = CFG_minOvercast+random (CFG_maxOvercast-CFG_minOvercast);
  20. 0 setOvercast _oStart;
  21. forceWeatherChange;
  22.  
  23. //DEBUG CODE
  24. if (CFG_weatherDegug) then {
  25.     _oStart spawn {
  26.         private _last = _this;
  27.         waitUntil {
  28.             uiSleep 5;
  29.             private _now = overcast;
  30.             private _delta = _now-_last;
  31.             if (_delta isNotEqualTo 0) then {
  32.                 private _minutesLeft = (5*(overcastForecast-overcast)/_delta)/60;
  33.                 systemChat format ["Overcast (%1%3 now) will reach %2%3 in %4 minutes and %5 seconds.",round (overcast*100),round (overcastForecast*100),"%",floor _minutesLeft,round ((_minutesLeft-floor _minutesLeft)*60)];
  34.             };
  35.             _last = _now;
  36.             false
  37.         };
  38.     };
  39. };
  40.  
  41. //WEATHER CHANGE CODE
  42. waitUntil {
  43.     if (abs(overcast-overcastForecast) < 0.01) then {
  44.         if (random 1 < CFG_chanceToChangeWeather) then {
  45.             0 setOvercast CFG_minOvercast+random (CFG_maxOvercast-CFG_minOvercast);
  46.         } else {
  47.             uiSleep CFG_waitIfNotChange;
  48.         };
  49.     } else {
  50.         uiSleep 30;
  51.     };
  52.     false
  53. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement