Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.92 KB | None | 0 0
  1. Dr_fnc_handleDamage = {
  2. scriptName "Dr_fnc_handleDamage";
  3. params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
  4. _exit = false;
  5. //diag_log format ["%1 %2 %3 %4 %5 %6",_source isEqualTo (vehicle _unit),_unit isEqualTo (vehicle _source),_unit isEqualTo _source,_unit,_source,_damage];
  6. //diag_log format ["SpawnRagdoll %1 InGreenZoneSafe %2 ZULU_critHit %3 ZULU_CheatNoDamage %4 Hit_Vehicle %5 isTased %6 Knocked %7",SpawnRagdoll,InGreenZoneSafe,ZULU_critHit,ZULU_CheatNoDamage,Hit_Vehicle,(_unit getVariable ["IsTased",false]),(_unit getVariable ["Knocked",false])];
  7. if (SpawnRagdoll) exitWith {diag_log format ["SpawnRagdoll %1",SpawnRagdoll];(damage _unit)};
  8. if (InGreenZoneSafe) exitWith {diag_log format ["InGreenZoneSafe %1",InGreenZoneSafe];(damage _unit)};
  9. if (ZULU_critHit) exitWith {diag_log format ["ZULU_critHit %1",ZULU_critHit];(damage _unit)};
  10. if (ZULU_CheatNoDamage) exitWith {diag_log format ["ZULU_CheatNoDamage %1",ZULU_CheatNoDamage];(damage _unit)};
  11. if (Hit_Vehicle) exitWith {diag_log format ["Hit_Vehicle %1",Hit_Vehicle];(damage _unit)};
  12. if (_unit getVariable ["IsTased",false]) exitWith {diag_log format ["IsTased %1",(_unit getVariable ["IsTased",false])];(damage _unit)};
  13. //if (_unit getVariable ["Knocked",false]) exitWith {(damage _unit)};
  14. if (_projectile == "Zulu_Ammo_Practice") exitWith {diag_log format ["Zulu_Ammo_Practice %1",ZULU_CheatNoDamage];(damage _unit)};
  15. if (_projectile == "Zulu_Ammo_harpoon_spear") exitWith {diag_log format ["Zulu_Ammo_harpoon_spear %1",ZULU_CheatNoDamage];(damage _unit)};
  16. //diag_log(_this);
  17. if (_projectile == "Zulu_Ammo_taser") exitWith {
  18. if (_unit getVariable ["IsTased",false]) exitWith {_exit = true; (damage _unit)};
  19. if (_unit getVariable ["restrained",false]) exitWith {_exit = true; (damage _unit)};
  20. if (_exit) exitWith {(damage _unit)};
  21. [_unit,"DKP_taser_hit_sound"] spawn Dr_fnc_PlaySound;
  22. [] spawn dr_fnc_forceRagdoll;
  23. (damage _unit)
  24. };
  25. if (_exit) exitWith {diag_log format ["Exit taser: IsTased %1, restrained %2",(_unit getVariable ["IsTased",false]),(_unit getVariable ["restrained",false])];(damage _unit)};
  26. if ((_unit isEqualTo _source) || (isNull _source) || (_source isEqualTo (vehicle _unit))) exitWith {
  27. if ((_damage > 0.99) && !(ZULU_critHit) && (alive _unit)) exitWith {
  28. diag_log format ["damage from vehicle %1",_damage];
  29. [_unit,_source] spawn Dr_fnc_unconscious;
  30. (damage _unit)
  31. };
  32. _damage
  33. };
  34. if (!((vehicle _source) isEqualTo _source) && ((driver (vehicle _source)) == _source)) then {
  35. if(isNull _unit) exitWith {};
  36. if ((!Hit_Vehicle) && !(ZULU_critHit)) then {[_unit,_source] call Dr_fnc_VehDam; _exit = true};
  37. };
  38. if (_exit) exitWith {(damage _unit)};
  39.  
  40. _damage762 = 0.348;
  41. _damage556 = 0.271;
  42. _dmgForHeadshot = 1.5;
  43. _dmgLastForHeadshot = 0;
  44. _oldDamage = 0;
  45. _EHDamage = _damage;
  46. _exitHeadShot = false;
  47. _vest1 = ZULU_MyVest in ZULU_VestI;
  48. _vest2 = ZULU_MyVest in ZULU_VestII;
  49. _vest3 = ZULU_MyVest in ZULU_VestIII;
  50.  
  51. switch (_selection) do {
  52. case ("head") : {_oldDamage = _unit getHitPointDamage "HitHead";};
  53. case ("body") : {_oldDamage = _unit getHitPointDamage "HitBody";};
  54. case ("hands") : {_oldDamage = _unit getHitPointDamage "HitHands";};
  55. case ("legs") : {_oldDamage = _unit getHitPointDamage "HitLegs";};
  56. case ("") : {_oldDamage = damage _unit;};
  57. default{_oldDamage = damage _unit;};
  58. };
  59.  
  60. _damage = _oldDamage + ((_damage - _oldDamage) / 20);
  61. if (_projectile == "Zulu_Ammo_12Gauge_Pellets") then {
  62. _damage = _damage + 0.077;
  63. _dmgLastForHeadshot = 0.5;
  64. if (_vest1) exitWith {
  65. _damage = (_damage - 0.035) max 0;
  66. };
  67. if (_vest2) exitWith {
  68. _damage = (_damage - 0.036) max 0;
  69. };
  70. if (_vest3) exitWith {
  71. _damage = (_damage - 0.039) max 0;
  72. };
  73. };
  74. if (_projectile == "Zulu_Ammo_12Gauge_Slug") then {
  75. _damage = _damage + 0.35;
  76. _dmgLastForHeadshot = 0.5;
  77. if (_vest1) exitWith {
  78. _damage = (_damage - 0.03) max 0;
  79. };
  80. if (_vest2) exitWith {
  81. _damage = (_damage - 0.099) max 0;
  82. };
  83. if (_vest3) exitWith {
  84. _damage = (_damage - 0.114) max 0;
  85. };
  86. };
  87. if ((_projectile == "Zulu_Ammo_9mm") || (_projectile == "Zulu_Ammo_9mm_HV") || (_projectile == "Zulu_Ammo_9mm_Tracer_Green")|| (_projectile == "Zulu_Ammo_9mm_Tracer_Red")|| (_projectile == "Zulu_Ammo_9mm_Tracer_Yellow")) then {
  88. _damage = _damage + 0.15;
  89. _dmgForHeadshot = 0.9;
  90. if (_vest1) exitWith {
  91. _damage = (_damage - 0.021) max 0;
  92. };
  93. if (_vest2) exitWith {
  94. _damage = (_damage - 0.029) max 0;
  95. };
  96. if (_vest3) exitWith {
  97. _damage = (_damage - 0.051) max 0;
  98. };
  99. };
  100. if ((_projectile == "Zulu_Ammo_45ACP") || (_projectile == "Zulu_Ammo_45ACP_expansion") || (_projectile == "Zulu_Ammo_45ACP_Tracer_Green") || (_projectile == "Zulu_Ammo_45ACP_Tracer_Yellow")) then {
  101. _damage = _damage + 0.27;
  102. _dmgForHeadshot = 0.9;
  103. if (_vest1) exitWith {
  104. _damage = (_damage - 0.027) max 0;
  105. };
  106. if (_vest2) exitWith {
  107. _damage = (_damage - 0.046) max 0;
  108. };
  109. if (_vest3) exitWith {
  110. _damage = (_damage - 0.062) max 0;
  111. };
  112. };
  113. if (_projectile == "Zulu_Ammo_22LR") then {
  114. _damage = _damage + 0.452;
  115. if (_vest1) exitWith {
  116. _damage = (_damage - 0.0623) max 0;
  117. };
  118. if (_vest2) exitWith {
  119. _damage = (_damage - 0.0777) max 0;
  120. };
  121. if (_vest3) exitWith {
  122. _damage = (_damage - 0.159) max 0;
  123. };
  124. };
  125. if ((_projectile == "Zulu_Ammo_762") || (_projectile == "Zulu_Ammo_762_HV") || (_projectile == "Zulu_Ammo_762_Tracer_Green") || (_projectile == "Zulu_Ammo_762_Tracer_Red") || (_projectile == "Zulu_Ammo_762_Tracer_Yellow") || (_projectile == "Zulu_Ammo_22LR")) then {
  126. _damage = _damage + _damage762;
  127. if (_vest1) exitWith {
  128. _damage = (_damage - 0.089) max 0;
  129. };
  130. if (_vest2) exitWith {
  131. _damage = (_damage - 0.111) max 0;
  132. };
  133. if (_vest3) exitWith {
  134. _damage = (_damage - 0.159) max 0;
  135. };
  136. };
  137. if ((_projectile == "Zulu_Ammo_556") || (_projectile == "Zulu_Ammo_556_HV") || (_projectile == "Zulu_Ammo_556_Tracer_Green") || (_projectile == "Zulu_Ammo_556_Tracer_Red") || (_projectile == "Zulu_Ammo_556_Tracer_Yellow") || (_projectile == "Zulu_Ammo_556_UW")) then {
  138. _damage = _damage + _damage556;
  139. if (_vest1) exitWith {
  140. _damage = (_damage - 0.029) max 0;
  141. };
  142. if (_vest2) exitWith {
  143. _damage = (_damage - 0.048) max 0;
  144. };
  145. if (_vest3) exitWith {
  146. _damage = (_damage - 0.075) max 0;
  147. };
  148. };
  149.  
  150. diag_log format ["Damage: %1 DmgHeadShot: %2 LastForHeadshot: %3 EHDamage: %4",_damage,_dmgForHeadshot,_dmgLastForHeadshot,_EHDamage];
  151.  
  152. if ((_selection == "head") && ((_unit getHitPointDamage "HitHead") >= _dmgLastForHeadshot) && (_EHDamage >= _dmgForHeadshot) && !(ZULU_critHit)) then {
  153. diag_log format["HEADSHOT: %1",_damage];
  154. _saved = false;
  155. _random = -1;
  156. if (ZULU_MyHeadgear in ZULU_HelmI) then {
  157. //_random = (random 100);
  158. _random = call Dr_fnc_SelectRandom;
  159. if ((_projectile == "Zulu_Ammo_556") || (_projectile == "Zulu_Ammo_556_HV") || (_projectile == "Zulu_Ammo_556_Tracer_Green") || (_projectile == "Zulu_Ammo_556_Tracer_Red") || (_projectile == "Zulu_Ammo_556_Tracer_Yellow") || (_projectile == "Zulu_Ammo_556_UW")) exitWith {
  160. if (1 isEqualTO _random) then {_saved = true};
  161. };
  162. if ((_projectile == "Zulu_Ammo_762") || (_projectile == "Zulu_Ammo_762_HV") || (_projectile == "Zulu_Ammo_762_Tracer_Green") || (_projectile == "Zulu_Ammo_762_Tracer_Red") || (_projectile == "Zulu_Ammo_762_Tracer_Yellow")) exitWith {
  163. if (1 isEqualTO _random) then {_saved = true};
  164. };
  165. if ((_projectile == "Zulu_Ammo_45ACP") || (_projectile == "Zulu_Ammo_45ACP_expansion") || (_projectile == "Zulu_Ammo_45ACP_Tracer_Green") || (_projectile == "Zulu_Ammo_45ACP_Tracer_Yellow")) exitWith {
  166. if (1 isEqualTO _random) then {_saved = true};
  167. };
  168. if ((_projectile == "Zulu_Ammo_9mm") || (_projectile == "Zulu_Ammo_9mm_HV") || (_projectile == "Zulu_Ammo_9mm_Tracer_Green")|| (_projectile == "Zulu_Ammo_9mm_Tracer_Red")|| (_projectile == "Zulu_Ammo_9mm_Tracer_Yellow")) exitWith {
  169. if (5 >= _random) then {_saved = true};
  170. };
  171. };
  172. if (ZULU_MyHeadgear in ZULU_HelmII) then {
  173. _random = (random 100);
  174. if ((_projectile == "Zulu_Ammo_556") || (_projectile == "Zulu_Ammo_556_HV") || (_projectile == "Zulu_Ammo_556_Tracer_Green") || (_projectile == "Zulu_Ammo_556_Tracer_Red") || (_projectile == "Zulu_Ammo_556_Tracer_Yellow") || (_projectile == "Zulu_Ammo_556_UW")) exitWith {
  175. if (20 >= _random) then {_saved = true};
  176. };
  177. if ((_projectile == "Zulu_Ammo_762") || (_projectile == "Zulu_Ammo_762_HV") || (_projectile == "Zulu_Ammo_762_Tracer_Green") || (_projectile == "Zulu_Ammo_762_Tracer_Red") || (_projectile == "Zulu_Ammo_762_Tracer_Yellow") || (_projectile == "Zulu_Ammo_22LR")) exitWith {
  178. if (15 >= _random) then {_saved = true};
  179. };
  180. if ((_projectile == "Zulu_Ammo_45ACP") || (_projectile == "Zulu_Ammo_45ACP_expansion") || (_projectile == "Zulu_Ammo_45ACP_Tracer_Green") || (_projectile == "Zulu_Ammo_45ACP_Tracer_Yellow")) exitWith {
  181. if (20 >= _random) then {_saved = true};
  182. };
  183. if ((_projectile == "Zulu_Ammo_9mm") || (_projectile == "Zulu_Ammo_9mm_HV") || (_projectile == "Zulu_Ammo_9mm_Tracer_Green")|| (_projectile == "Zulu_Ammo_9mm_Tracer_Red")|| (_projectile == "Zulu_Ammo_9mm_Tracer_Yellow")) exitWith {
  184. if (25 >= _random) then {_saved = true};
  185. };
  186. };
  187. if (ZULU_MyHeadgear in ZULU_HelmIII) then {
  188. _random = (random 100);
  189. if ((_projectile == "Zulu_Ammo_556") || (_projectile == "Zulu_Ammo_556_HV") || (_projectile == "Zulu_Ammo_556_Tracer_Green") || (_projectile == "Zulu_Ammo_556_Tracer_Red") || (_projectile == "Zulu_Ammo_556_Tracer_Yellow") || (_projectile == "Zulu_Ammo_556_UW")) exitWith {
  190. if (35 >= _random) then {_saved = true};
  191. };
  192. if ((_projectile == "Zulu_Ammo_762") || (_projectile == "Zulu_Ammo_762_HV") || (_projectile == "Zulu_Ammo_762_Tracer_Green") || (_projectile == "Zulu_Ammo_762_Tracer_Red") || (_projectile == "Zulu_Ammo_762_Tracer_Yellow")) exitWith {
  193. if (25 >= _random) then {_saved = true};
  194. };
  195. if ((_projectile == "Zulu_Ammo_45ACP") || (_projectile == "Zulu_Ammo_45ACP_expansion") || (_projectile == "Zulu_Ammo_45ACP_Tracer_Green") || (_projectile == "Zulu_Ammo_45ACP_Tracer_Yellow")) exitWith {
  196. if (35 >= _random) then {_saved = true};
  197. };
  198. if ((_projectile == "Zulu_Ammo_9mm") || (_projectile == "Zulu_Ammo_9mm_HV") || (_projectile == "Zulu_Ammo_9mm_Tracer_Green")|| (_projectile == "Zulu_Ammo_9mm_Tracer_Red")|| (_projectile == "Zulu_Ammo_9mm_Tracer_Yellow")) exitWith {
  199. if (50 >= _random) then {_saved = true};
  200. };
  201. };
  202. if (_saved) exitWith {
  203. diag_log format ["SAVED: Helm - %1, Chance - (%2)",ZULU_MyHeadgear,_random];
  204. };
  205. [_unit,_source] spawn Dr_fnc_unconscious;
  206. _exitHeadShot = true;
  207. };
  208.  
  209. if (_exitHeadShot) exitWith {damage _unit};
  210.  
  211. if ((_damage > 0.99) && (damage _unit) < 1) then {
  212. _damage = 0.99;
  213. };
  214. if (((damage _unit) > 0.95) && !(ZULU_critHit)) exitWith {
  215. [_unit,_source] spawn Dr_fnc_unconscious;
  216. (damage _unit)
  217. };
  218. _damage
  219. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement