Darth_Rogue

weather effects

Nov 25th, 2015
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.39 KB | None | 0 0
  1. // ** Weather effects by JohnO **//
  2. WEATHER_EFFECTS = {};
  3. WEATHER_EFFECTS = {
  4. private ["_cold","_sickChance","_sickValue","_fatigue","_rainLevel","_damage","_uniform","_cover","_fire","_distanceToCover","_distanceToFire","_showSick","_showCold","_effectsCheck","_warm","_sick","_healthyInd"];
  5.  
  6. /** SETTINGS **/
  7. /** Notifications **/
  8.  
  9. _showSick = true; //True to enable notifications "Eg You are getting sick"
  10. _showCold = true; //True to enable notifications "Eg You are getting cold"
  11. _effectsCheck = 60; //Time in seconds that the weather effects will apply. This time is x2, so 60 is actually 120. Due to the way the script works.
  12. _healthyInd = true; // If true - will display a "You are healthy" status when the character is not sick or cold.
  13.  
  14.  
  15. _coldClothes =
  16. [
  17. "", //NAKED - DO NOT CHANGE
  18. "U_BasicBody",
  19. "U_AttisBody",
  20. "U_AntigonaBody",
  21. "Exile_Uniform_BambiOverall",
  22. //Civilian
  23. "U_C_Journalist",
  24. "U_C_Poloshirt_blue",
  25. "U_C_Poloshirt_burgundy",
  26. "U_C_Poloshirt_salmon",
  27. "U_C_Poloshirt_stripped",
  28. "U_C_Poloshirt_tricolour",
  29. "U_C_Poor_1",
  30. "U_C_Poor_2",
  31. "U_C_Poor_shorts_1",
  32. "U_OrestesBody",
  33. "U_Rangemaster",
  34. "U_NikosBody",
  35. "U_Competitor",
  36. //Soldier
  37. "U_B_CombatUniform_mcam_tshirt",
  38. "U_I_CombatUniform_shortsleeve",
  39. "U_I_CombatUniform_tshirt",
  40. "U_I_G_Story_Protagonist_F",
  41. //Guarilla
  42. "U_I_G_resistanceLeader_F",
  43. "U_BG_Guerilla1_1",
  44. "U_BG_Guerilla2_2",
  45. "U_BG_Guerilla2_3",
  46. "U_BG_Guerilla3_1",
  47. "U_BG_Guerilla2_1",
  48. "U_IG_Guerilla2_3",
  49. "U_IG_Guerilla2_2",
  50. "U_IG_Guerilla1_1",
  51. "U_IG_Guerilla2_1",
  52. //Special
  53. "U_B_survival_uniform",
  54. "U_I_Wetsuit",
  55. "U_O_Wetsuit",
  56. "U_B_Wetsuit"
  57. ];
  58.  
  59. sick = false;
  60. _warm = true;
  61. cold = 0;
  62. _sickChance = 0;
  63. sickValue = 0;
  64. _fatigue = 0;
  65. _rainLevel = rain;
  66. _damage = damage player;
  67. _uniform = uniform player;
  68. _cover = nearestBuilding player;
  69. _fire = nearestObject [player,"Exile_Construction_CampFire_Static"];
  70. _distanceToCover = player distance _cover;
  71. _distanceToFire = player distance _fire;
  72.  
  73. //[sick,sickValue,cold] spawn
  74. //{
  75. //while {true} do
  76. //{
  77. //waituntil {!alive player};
  78. if !(alive player) then
  79. {
  80. sick = false;
  81. cold = 0;
  82. sickValue = 0;
  83. player enableFatigue false;
  84. };
  85.  
  86. //};
  87. //};
  88.  
  89. //[] spawn
  90.  
  91. //{
  92. //while {true} do
  93. //{
  94.  
  95. //waituntil {damage player > 0.75};
  96. if (damage player > 0.75) then
  97. {
  98. playSound "SndExileHeartbeatStopping";
  99. enableCamShake true;
  100. addCamShake [5, 3, 30];
  101. uiSleep 5;
  102. };
  103.  
  104. //};
  105. //};
  106.  
  107. //while {alive player} do
  108. //{
  109. if (alive player) then {
  110. //waituntil {alive player};
  111. if (_healthyInd) then
  112. {
  113. if ((!sick) && (_warm) && (sickValue <= 0)) then
  114. {
  115. titleText ["You are healthy", "PLAIN DOWN",0.5];
  116. };
  117. };
  118.  
  119. if (sickValue <= 0) then
  120. {
  121. sickValue = 0;
  122. }
  123. else
  124. {
  125. if (sickValue >= 1) then
  126. {
  127. sickValue = 1;
  128. };
  129. };
  130. if (cold <= 0) then
  131. {
  132. cold = 0;
  133. }
  134. else
  135. {
  136. if (cold >= 1) then
  137. {
  138. cold = 0.9;
  139. };
  140. };
  141.  
  142. //uiSleep _effectsCheck;
  143.  
  144. _rainLevel = rain;
  145. _damage = damage player;
  146. _uniform = uniform player;
  147. _cover = nearestBuilding player;
  148. _fire = nearestObject [player,"Exile_Construction_CampFire_Static"];
  149. _distanceToCover = player distance _cover;
  150. _distanceToFire = player distance _fire;
  151.  
  152. if ((daytime >= 19 || daytime < 5) || (_rainLevel > 0.5 )) then {_warm = false};
  153.  
  154. if ((!_warm) && (_uniform in _coldClothes)) then {_warm = false};
  155. if ((!_warm) && (_distanceToFire < 20) || (_distanceToCover < 50)) then {_warm = true};
  156. if !(_uniform in _coldClothes) then {_warm = true};
  157.  
  158. if (_warm) then
  159. {
  160. _warm = true;
  161. cold = cold - 0.1;
  162. if (cold <= 0) then
  163. {
  164. if (sickValue >= 0) then
  165. {
  166. sickValue = sickValue - 0.05;
  167. if (sickValue <= 0.25) then
  168. {
  169. sick = false;
  170. enableCamShake false;
  171. player setFatigue 0;
  172. player enableFatigue false;
  173. //uiSleep 1;
  174. if ((_showSick) && (sickValue >= 0 && sickValue <= 0.25)) then
  175. {
  176. titleText ["You are feeling better..", "PLAIN DOWN",0.5];
  177. };
  178. };
  179. };
  180. };
  181. }
  182. else
  183. {
  184. _warm = false;
  185. cold = cold + 0.1;
  186. };
  187. if ((_showCold) && (cold >= 0 && cold <=0.1) && (!_warm)) then
  188. {
  189. titleText ["It is getting cold..", "PLAIN DOWN",0.5];
  190. }
  191. else
  192. {
  193. if ((_showCold) && (cold >= 0.2 && cold <= 0.3) && (!_warm)) then
  194. {
  195. titleText ["You are starting to freeze...", "PLAIN DOWN",0.5];
  196. };
  197. };
  198.  
  199. //uiSleep _effectsCheck; //issue - player dies while sleeping. and respawns. the if alive never checks. the values never clear.
  200.  
  201. if ((cold > 0.3) && (!_warm)) then
  202. {
  203. cold = cold + 0.1;
  204. player setDamage _damage +0.07;
  205. enableCamShake true;
  206. addCamShake [5, 3, 60];
  207. if (_showCold) then
  208. {
  209. titleText ["You are freezing..", "PLAIN DOWN",1];
  210. };
  211. };
  212.  
  213. if (!_warm) then
  214. {
  215. _sickChance = random 1;
  216.  
  217. if ((_sickChance > 0.5) || (sickValue > 0)) then
  218. {
  219. sick = true;
  220. sickValue = sickValue + 0.05;
  221. if ((_showSick) && (sickValue < 0.25)) then
  222. {
  223.  
  224. titleText ["You are sick...", "PLAIN DOWN",0.5];
  225.  
  226. };
  227. if ((sickValue > 0.25) && (sickValue < 0.50)) then
  228. {
  229. player enableFatigue true;
  230. enableCamShake true;
  231. addCamShake [5, 3, 30];
  232. player setFatigue 0.5;
  233.  
  234. if (_showSick) then
  235. {
  236. titleText ["You are very sick...", "PLAIN DOWN",0.5];
  237. };
  238. }
  239. else
  240. {
  241. if (sickValue > 0.50) then
  242. {
  243. player enableFatigue true;
  244. enableCamShake true;
  245. addCamShake [10, 10, 15];
  246. [120] call BIS_fnc_bloodEffect;
  247. player setDamage _damage + 0.02;
  248. player setFatigue 1;
  249.  
  250. if (_showSick) then
  251. {
  252. titleText ["You are dieing...", "PLAIN DOWN",0.5];
  253. };
  254. };
  255. };
  256. };
  257. };
  258. if ((_warm) && (sick)) then
  259. {
  260. if ((_showSick) && (sickValue < 0.25)) then
  261. {
  262. titleText ["You are sick...", "PLAIN DOWN",0.5];
  263. };
  264. if ((sickValue > 0.25) && (sickValue < 0.50)) then
  265. {
  266. player enableFatigue true;
  267. enableCamShake true;
  268. addCamShake [5, 3, 30];
  269. player setFatigue 0.5;
  270.  
  271. if (_showSick) then
  272. {
  273. titleText ["You are very sick...", "PLAIN DOWN",0.5];
  274. };
  275. }
  276. else
  277. {
  278. if (sickValue > 0.50) then
  279. {
  280. player enableFatigue true;
  281. enableCamShake true;
  282. addCamShake [10, 10, 15];
  283. [120] call BIS_fnc_bloodEffect;
  284. player setDamage _damage + 0.02;
  285. player setFatigue 1;
  286.  
  287. if (_showSick) then
  288. {
  289. titleText ["You are dieing...", "PLAIN DOWN",0.5];
  290. };
  291. };
  292. };
  293. };
  294. };
  295. };
Advertisement
Add Comment
Please, Sign In to add comment