Guest User

Untitled

a guest
Aug 15th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.37 KB | None | 0 0
  1. BP_Weather_Current = "None";
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10. private ["_transitionTime","_weatherTemplatesSunny","_weatherTemplatesRain","_weatherTemplatesStorm","_weatherTemplate"];
  11.  
  12. if(BP_Weather_Current == "None") then
  13. {
  14. _transitionTime = 0;
  15. }
  16. else
  17. {
  18. _transitionTime = 5400;
  19. };
  20.  
  21. if(worldname == "Tembelan") then
  22. {
  23. _weatherTemplatesSunny =
  24. [
  25.  
  26. ["Clear", [0.1,0,0,0,0,0,0]],
  27. ["Clear", [0.15,0,[0.9, 0.14, 3],0,0,0,0]],
  28. ["Clear", [0.2,0,0,0,0,0,0]],
  29. ["Clear", [0.25,0,[0.9, 0.14, 3],0,0,0,0]],
  30. ["Clear", [0.3,0,0,0,0,0,0]],
  31. ["Clear", [0.3,0,[0.9, 0.14, 3],0,0,0,0]],
  32. ["Cloudy", [0.35,0,0,0.2,0,0.35]],
  33. ["Cloudy", [0.35,0,[0.9, 0.14, 3],0.2,0,0.35]],
  34. ["Cloudy", [0.4,0,0,0.2,0,0.35]],
  35. ["Cloudy", [0.44,0,[0.9, 0.14, 3],0.3,0,0.35]],
  36. ["Cloudy", [0.46,0,0,0.3,0,0.35]],
  37. ["Cloudy", [0.48,0,[0.9, 0.14, 3],0.2,0,0.3]],
  38. ["Cloudy", [0.5,0,0,0.3,0,0.35]]
  39. ];
  40. _weatherTemplatesRain =
  41. [
  42.  
  43. ["Light Rain", [0.6,0.1,0,0.3,0,0.45]],
  44. ["Light Rain", [0.6,0.12,[0.9, 0.14, 3],0.1,0,0.2]],
  45. ["Light Rain", [0.6,0.14,0,0.3,0,0.45]],
  46. ["Light Rain", [0.6,0.18,0,0.3,0,0.45]],
  47. ["Light Rain", [0.6,0.2,0,0.3,0,0.45]],
  48. ["Medium Rain", [0.6,0.22,0,0.3,0,0.45]],
  49. ["Medium Rain", [0.6,0.25,[0.001, -0.02, -165],0.3,0,0.45]],
  50. ["Medium Rain", [0.6,0.28,0,0.4,0,0.55]],
  51. ["Medium Rain", [0.6,0.3,0,0.4,0,0.55]],
  52. ["Medium Rain", [0.6,0.32,0,0.5,0,0.65]],
  53. ["Medium Rain", [0.6,0.36,0,0.5,0,0.65]]
  54. ];
  55. _weatherTemplatesStorm =
  56. [
  57.  
  58. ["Rainstorm", [0.7,0.3,[0.001, -0.02, -165],0.3,0,0.45]],
  59. ["Rainstorm", [0.7,0.3,0,0.3,1,0.45]],
  60. ["Rainstorm", [0.7,0.4,[0.001, -0.02, -165],0.4,0,0.6]],
  61. ["Rainstorm", [0.7,0.4,0,0.4,1,0.6]],
  62. ["Rainstorm", [0.7,0.5,[0.001, -0.02, -165],0.5,0,0.7]],
  63. ["Rainstorm", [0.7,0.6,0,0.5,1,0.7]],
  64. ["Rainstorm", [0.8,0.6,[0.001, -0.02, -165],0.6,0,0.8]],
  65. ["Rainstorm", [0.8,0.7,0,0.6,1,0.8]],
  66. ["Rainstorm", [0.9,0.8,[0.001, -0.02, -165],0.7,0,0.9]],
  67. ["Rainstorm", [0.9,0.9,0,0.7,1,0.9]],
  68. ["Rainstorm", [1,1,0,1,1,1]]
  69. ];
  70.  
  71. BP_fnc_getNewWeatherTemplate =
  72. {
  73. _weatherSelection = round(random 100);
  74. if (_weatherSelection <= 35) then
  75. {
  76. if (_weatherSelection <= 12) then
  77. {
  78. _weatherTemplate = selectRandom _weatherTemplatesStorm;
  79. }
  80. else
  81. {
  82. _weatherTemplate = selectRandom _weatherTemplatesRain;
  83. };
  84. }
  85. else
  86. {
  87. _weatherTemplate = selectRandom _weatherTemplatesSunny;
  88. };
  89. };
  90. }
  91. else
  92. {
  93. _weatherTemplatesSunny =
  94. [
  95.  
  96. ["Clear", [0.1,0,0,0,0,0,0]],
  97. ["Clear", [0.1,0,0,0,0,0,0]],
  98. ["Clear", [0.2,0,0,0,0,0,0]],
  99. ["Clear", [0.2,0,0,0,0,0,0]],
  100. ["Clear", [0.3,0,0,0,0,0,0]],
  101. ["Clear", [0.3,0,0,0,0,0,0]],
  102. ["Cloudy", [0.35,0,0,0.2,0,0.35]],
  103. ["Cloudy", [0.35,0,0,0.2,0,0.35]],
  104. ["Cloudy", [0.4,0,0,0.2,0,0.35]],
  105. ["Cloudy", [0.4,0,0,0.3,0,0.35]],
  106. ["Cloudy", [0.45,0,0,0.3,0,0.35]],
  107. ["Cloudy", [0.45,0,0,0.3,0,0.35]],
  108. ["Cloudy", [0.5,0,0,0.3,0,0.35]]
  109. ];
  110. _weatherTemplatesRain =
  111. [
  112.  
  113. ["Light Rain", [0.6,0.1,0,0.3,0,0.45]],
  114. ["Light Rain", [0.6,0.12,0,0.3,0,0.45]],
  115. ["Light Rain", [0.6,0.14,0,0.3,0,0.45]],
  116. ["Light Rain", [0.6,0.18,0,0.3,0,0.45]],
  117. ["Light Rain", [0.6,0.2,0,0.3,0,0.45]],
  118. ["Medium Rain", [0.6,0.22,0,0.3,0,0.45]],
  119. ["Medium Rain", [0.6,0.25,0,0.3,0,0.45]],
  120. ["Medium Rain", [0.6,0.28,0,0.4,0,0.55]],
  121. ["Medium Rain", [0.6,0.3,0,0.4,0,0.55]],
  122. ["Medium Rain", [0.6,0.32,0,0.5,0,0.65]],
  123. ["Medium Rain", [0.6,0.36,0,0.5,0,0.65]]
  124. ];
  125. _weatherTemplatesStorm =
  126. [
  127.  
  128. ["Rainstorm", [0.7,0.3,0,0.3,0,0.45]],
  129. ["Rainstorm", [0.7,0.3,0,0.3,1,0.45]],
  130. ["Rainstorm", [0.7,0.4,0,0.4,0,0.6]],
  131. ["Rainstorm", [0.7,0.4,0,0.4,1,0.6]],
  132. ["Rainstorm", [0.7,0.5,0,0.5,0,0.7]],
  133. ["Rainstorm", [0.7,0.6,0,0.5,1,0.7]],
  134. ["Rainstorm", [0.8,0.6,0,0.6,0,0.8]],
  135. ["Rainstorm", [0.8,0.7,0,0.6,1,0.8]],
  136. ["Rainstorm", [0.9,0.8,0,0.7,0,0.9]],
  137. ["Rainstorm", [0.9,0.9,0,0.7,1,0.9]],
  138. ["Rainstorm", [1,1,0,1,1,1]]
  139. ];
  140.  
  141. BP_fnc_getNewWeatherTemplate =
  142. {
  143. _weatherSelection = round(random 100);
  144. if (_weatherSelection <= 20) then
  145. {
  146. if (_weatherSelection <= 8) then
  147. {
  148. _weatherTemplate = selectRandom _weatherTemplatesStorm;
  149. }
  150. else
  151. {
  152. _weatherTemplate = selectRandom _weatherTemplatesRain;
  153. };
  154. }
  155. else
  156. {
  157. _weatherTemplate = selectRandom _weatherTemplatesSunny;
  158. };
  159. };
  160. };
  161.  
  162.  
  163. call BP_fnc_getNewWeatherTemplate;
  164.  
  165. while {BP_Weather_Current isEqualto (_weatherTemplate select 0)}
  166. do
  167. {
  168. call BP_fnc_getNewWeatherTemplate;
  169. };
  170.  
  171. [_weatherTemplate,_transitionTime] spawn
  172. {
  173. _weatherTemplate = _this select 0;
  174. _transitionTime = _this select 1;
  175. (_weatherTemplate select 1) params ["_weatherInitialOvercast","_weatherInitialRainSnow","_weatherInitialFog","_weatherInitialWindStrengh","_weatherInitialLightning","_weatherInitialWaves"];
  176.  
  177. BP_Weather_Current = _weatherTemplate select 0;
  178.  
  179. SystemChat format["Weather Engine Weather Update: %1", _weatherTemplate];
  180.  
  181. skipTime -24;
  182. sleep 0.1;
  183.  
  184. _transitionTime setFog _weatherInitialFog;
  185. _transitionTime setOvercast _weatherInitialOvercast;
  186. _transitionTime setWaves _weatherInitialWaves;
  187. _transitionTime setWindStr _weatherInitialWindStrengh;
  188. _transitionTime setWindDir round (random 360);
  189. _transitionTime setRain _weatherInitialRainSnow;
  190. _transitionTime setLightnings _weatherInitialLightning;
  191. sleep 0.1;
  192. skipTime 24;
  193. sleep 0.1;
  194. simulWeatherSync;
  195. };
Add Comment
Please, Sign In to add comment