Advertisement
Guest User

Untitled

a guest
May 25th, 2015
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.53 KB | None | 0 0
  1. /*
  2. File: QS_Fatigue.sqf
  3. Script: Quiksilvers Modified Fatigue
  4. Author:
  5.  
  6. Quiksilver
  7.  
  8. Last Modified:
  9.  
  10. 28/02/2015 ArmA 3 1.38 by Quiksilver
  11.  
  12. Description:
  13.  
  14. Custom Fatigue
  15. With default settings, provides approximately 2* or up to 3* stamina compared to default.
  16.  
  17. Instructions:
  18.  
  19. Copy this file to your scenario main directory (contains other files such as description.ext, mission.sqm)
  20.  
  21. Create a file called 'initPlayerLocal.sqf' in the same directory, if you do not have it already.
  22.  
  23. In 'initPlayerLocal.sqf', paste the following line:
  24.  
  25. [] execVM 'QS_Fatigue.sqf';
  26.  
  27. Credit:
  28.  
  29. Credit to zooloo75 for the 'stumble' mechanics.
  30.  
  31. ______________________________________________________*/
  32.  
  33. private ['_useVariableStamina','_useStumble'];
  34.  
  35. //==================================================== CONFIG
  36.  
  37. _useVariableStamina = FALSE; // Does stamina factor in the players class? Set TRUE or FALSE.
  38. _useStumble = TRUE; // Can the player stumble when very fatigued? Set TRUE or FALSE. Be careful when using, this may apply: http://feedback.arma3.com/view.php?id=22067
  39.  
  40. // These classes have higher-than-normal stamina, if variable stamina used. Feel free to add or remove entries.
  41. QS_fatigue_classes_highStamina = compileFinal '[
  42. "B_diver_TL_F","B_diver_exp_F","B_diver_F","B_recon_exp_F","B_recon_LAT_F",
  43. "B_recon_medic_F","B_recon_TL_F","B_recon_M_F","B_recon_F","B_recon_JTAC_F",
  44. "O_recon_exp_F","O_recon_LAT_F","O_recon_medic_F","O_recon_TL_F","O_recon_M_F",
  45. "O_recon_F","O_recon_JTAC_F","O_diver_TL_F","O_diver_exp_F","O_diver_F","I_diver_TL_F",
  46. "I_diver_exp_F","I_diver_F"
  47. ]';
  48.  
  49. // These classes have lower-than-normal stamina, if variable stamina used. Feel free to add or remove entries.
  50. QS_fatigue_classes_lowStamina = compileFinal '[
  51. "B_pilot_F","B_helipilot_F","B_helicrew_F","O_pilot_F","O_helipilot_F","O_helicrew_F",
  52. "I_pilot_F","I_helipilot_F","B_officer_F","O_officer_F","I_officer_F"
  53. ]';
  54.  
  55. //==================================================== FUNCTIONS
  56.  
  57. QS_fnc_fatigue = compileFinal "
  58.  
  59. private ['_10mX','_20mX','_30mX','_40mX','_50mX','_60mX','_passOut','_t','_s','_p','_lowStamina','_highStamina','_exit'];
  60.  
  61. _s = _this select 0;
  62. _p = _this select 1;
  63. _exit = FALSE;
  64. player setVariable ['QS_fatigue',1,FALSE];
  65. player setVariable ['QS_playerFatigued',FALSE,FALSE];
  66.  
  67. _10mX = 0.985;
  68. _20mX = 0.9875;
  69. _30mX = 0.9925;
  70. _40mX = 0.995;
  71. _50mX = 0.9975;
  72. _60mX = 1;
  73.  
  74. [] spawn {
  75. hintSilent 'You are now using Quiksilvers Modified Fatigue.';
  76. uiSleep 5;
  77. hintSilent '';
  78. };
  79.  
  80. if (_s) then {
  81. _t = typeOf (vehicle player);
  82. _lowStamina = [] call QS_fatigue_classes_lowStamina;
  83. _highStamina = [] call QS_fatigue_classes_highStamina;
  84.  
  85. if (_t in _lowStamina) exitWith {
  86. _exit = TRUE;
  87. player enableFatigue TRUE;
  88. };
  89. if (_t in _highStamina) then {
  90. _10mX = 0.983;
  91. _20mX = 0.9855;
  92. _30mX = 0.9905;
  93. _40mX = 0.993;
  94. _50mX = 0.9955;
  95. _60mX = 1;
  96. };
  97. };
  98.  
  99. if (_exit) exitWith {};
  100. while {TRUE} do {
  101. if (!isNull player) then {
  102. if (alive player) then {
  103. if ((getFatigue player) >= 0.1) then {
  104. if ((getFatigue player) >= 0.2) then {
  105. if ((getFatigue player) >= 0.3) then {
  106. if ((getFatigue player) >= 0.4) then {
  107. if ((getFatigue player) >= 0.5) then {
  108. if ((getFatigue player) >= 0.61 && ((getFatigue player) <= 0.9)) then {
  109. if (!(player getVariable 'QS_playerFatigued')) then {
  110. if ((random 1) > 0.75) then {
  111. player setVariable ['QS_playerFatigued',TRUE,FALSE];
  112. if (_p) then {
  113. [] call QS_fnc_stumble;
  114. };
  115. } else {
  116. player setVariable ['QS_playerFatigued',TRUE,FALSE];
  117. [] spawn {uiSleep 30;player setVariable ['QS_playerFatigued',FALSE,FALSE];};
  118. };
  119. };
  120. player setFatigue ((getFatigue player) * _60mX);
  121. } else {
  122. player setFatigue ((getFatigue player) * _50mX);
  123. };
  124. } else {
  125. player setFatigue ((getFatigue player) * _40mX);
  126. };
  127. } else {
  128. player setFatigue ((getFatigue player) * _30mX);
  129. };
  130. } else {
  131. player setFatigue ((getFatigue player) * _20mX);
  132. };
  133. } else {
  134. player setFatigue ((getFatigue player) * _10mX);
  135. };
  136. };
  137. };
  138. };
  139. uiSleep 0.25;
  140. };
  141. ";
  142.  
  143. QS_fnc_stumble = compileFinal "
  144. private ['_o','_vel','_dir'];
  145. player allowDamage FALSE;
  146. _o = 'Steel_Plate_L_F' createVehicleLocal [0,0,0];
  147. _o setObjectTexture [0,''];
  148. _o setMass 220;
  149. _o setDir random 360;
  150. _o setPosATL [(position player select 0),(position player select 1),((((boundingBox player) select 1) select 2) / 2) - ((position player select 2) / 100)];
  151. _vel = velocity player;
  152. _dir = direction player;
  153. _o setVelocity [
  154. (_vel select 0) + (sin _dir * 4),
  155. (_vel select 1) + (cos _dir * 4),
  156. (_vel select 2)
  157. ];
  158. [_o] spawn QS_fnc_stumbleRegen;
  159. ";
  160.  
  161. QS_fnc_stumbleRegen = compileFinal "
  162. private ['_t'];
  163. uiSleep 1;
  164. deleteVehicle (_this select 0);
  165. _t = time + (15 + (random 15));
  166. player allowDamage TRUE;
  167. player setFatigue 1;
  168. player setVariable ['QS_playerFatigued',TRUE,FALSE];
  169. while {((time) < _t)} do {
  170. uiSleep 2;
  171. player setFatigue 1;
  172. };
  173. uiSleep 120;
  174. player setVariable ['QS_playerFatigued',FALSE,FALSE];
  175.  
  176. ";
  177.  
  178. //==================================================== INIT
  179.  
  180. QS_EH_client_Fatigue = player addEventHandler ['Respawn',{player setVariable ['QS_playerFatigued',FALSE,FALSE];}];
  181. [_useVariableStamina,_useStumble] spawn QS_fnc_fatigue;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement