Advertisement
Guest User

Untitled

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