Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dr_fnc_handleDamage = {
- scriptName "Dr_fnc_handleDamage";
- params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
- _exit = false;
- //diag_log format ["%1 %2 %3 %4 %5 %6",_source isEqualTo (vehicle _unit),_unit isEqualTo (vehicle _source),_unit isEqualTo _source,_unit,_source,_damage];
- //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])];
- if (SpawnRagdoll) exitWith {diag_log format ["SpawnRagdoll %1",SpawnRagdoll];(damage _unit)};
- if (InGreenZoneSafe) exitWith {diag_log format ["InGreenZoneSafe %1",InGreenZoneSafe];(damage _unit)};
- if (ZULU_critHit) exitWith {diag_log format ["ZULU_critHit %1",ZULU_critHit];(damage _unit)};
- if (ZULU_CheatNoDamage) exitWith {diag_log format ["ZULU_CheatNoDamage %1",ZULU_CheatNoDamage];(damage _unit)};
- if (Hit_Vehicle) exitWith {diag_log format ["Hit_Vehicle %1",Hit_Vehicle];(damage _unit)};
- if (_unit getVariable ["IsTased",false]) exitWith {diag_log format ["IsTased %1",(_unit getVariable ["IsTased",false])];(damage _unit)};
- //if (_unit getVariable ["Knocked",false]) exitWith {(damage _unit)};
- if (_projectile == "Zulu_Ammo_Practice") exitWith {diag_log format ["Zulu_Ammo_Practice %1",ZULU_CheatNoDamage];(damage _unit)};
- if (_projectile == "Zulu_Ammo_harpoon_spear") exitWith {diag_log format ["Zulu_Ammo_harpoon_spear %1",ZULU_CheatNoDamage];(damage _unit)};
- //diag_log(_this);
- if (_projectile == "Zulu_Ammo_taser") exitWith {
- if (_unit getVariable ["IsTased",false]) exitWith {_exit = true; (damage _unit)};
- if (_unit getVariable ["restrained",false]) exitWith {_exit = true; (damage _unit)};
- if (_exit) exitWith {(damage _unit)};
- [_unit,"DKP_taser_hit_sound"] spawn Dr_fnc_PlaySound;
- [] spawn dr_fnc_forceRagdoll;
- (damage _unit)
- };
- if (_exit) exitWith {diag_log format ["Exit taser: IsTased %1, restrained %2",(_unit getVariable ["IsTased",false]),(_unit getVariable ["restrained",false])];(damage _unit)};
- if ((_unit isEqualTo _source) || (isNull _source) || (_source isEqualTo (vehicle _unit))) exitWith {
- if ((_damage > 0.99) && !(ZULU_critHit) && (alive _unit)) exitWith {
- diag_log format ["damage from vehicle %1",_damage];
- [_unit,_source] spawn Dr_fnc_unconscious;
- (damage _unit)
- };
- _damage
- };
- if (!((vehicle _source) isEqualTo _source) && ((driver (vehicle _source)) == _source)) then {
- if(isNull _unit) exitWith {};
- if ((!Hit_Vehicle) && !(ZULU_critHit)) then {[_unit,_source] call Dr_fnc_VehDam; _exit = true};
- };
- if (_exit) exitWith {(damage _unit)};
- _damage762 = 0.348;
- _damage556 = 0.271;
- _dmgForHeadshot = 1.5;
- _dmgLastForHeadshot = 0;
- _oldDamage = 0;
- _EHDamage = _damage;
- _exitHeadShot = false;
- _vest1 = ZULU_MyVest in ZULU_VestI;
- _vest2 = ZULU_MyVest in ZULU_VestII;
- _vest3 = ZULU_MyVest in ZULU_VestIII;
- switch (_selection) do {
- case ("head") : {_oldDamage = _unit getHitPointDamage "HitHead";};
- case ("body") : {_oldDamage = _unit getHitPointDamage "HitBody";};
- case ("hands") : {_oldDamage = _unit getHitPointDamage "HitHands";};
- case ("legs") : {_oldDamage = _unit getHitPointDamage "HitLegs";};
- case ("") : {_oldDamage = damage _unit;};
- default{_oldDamage = damage _unit;};
- };
- _damage = _oldDamage + ((_damage - _oldDamage) / 20);
- if (_projectile == "Zulu_Ammo_12Gauge_Pellets") then {
- _damage = _damage + 0.077;
- _dmgLastForHeadshot = 0.5;
- if (_vest1) exitWith {
- _damage = (_damage - 0.035) max 0;
- };
- if (_vest2) exitWith {
- _damage = (_damage - 0.036) max 0;
- };
- if (_vest3) exitWith {
- _damage = (_damage - 0.039) max 0;
- };
- };
- if (_projectile == "Zulu_Ammo_12Gauge_Slug") then {
- _damage = _damage + 0.35;
- _dmgLastForHeadshot = 0.5;
- if (_vest1) exitWith {
- _damage = (_damage - 0.03) max 0;
- };
- if (_vest2) exitWith {
- _damage = (_damage - 0.099) max 0;
- };
- if (_vest3) exitWith {
- _damage = (_damage - 0.114) max 0;
- };
- };
- 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 {
- _damage = _damage + 0.15;
- _dmgForHeadshot = 0.9;
- if (_vest1) exitWith {
- _damage = (_damage - 0.021) max 0;
- };
- if (_vest2) exitWith {
- _damage = (_damage - 0.029) max 0;
- };
- if (_vest3) exitWith {
- _damage = (_damage - 0.051) max 0;
- };
- };
- if ((_projectile == "Zulu_Ammo_45ACP") || (_projectile == "Zulu_Ammo_45ACP_expansion") || (_projectile == "Zulu_Ammo_45ACP_Tracer_Green") || (_projectile == "Zulu_Ammo_45ACP_Tracer_Yellow")) then {
- _damage = _damage + 0.27;
- _dmgForHeadshot = 0.9;
- if (_vest1) exitWith {
- _damage = (_damage - 0.027) max 0;
- };
- if (_vest2) exitWith {
- _damage = (_damage - 0.046) max 0;
- };
- if (_vest3) exitWith {
- _damage = (_damage - 0.062) max 0;
- };
- };
- if (_projectile == "Zulu_Ammo_22LR") then {
- _damage = _damage + 0.452;
- if (_vest1) exitWith {
- _damage = (_damage - 0.0623) max 0;
- };
- if (_vest2) exitWith {
- _damage = (_damage - 0.0777) max 0;
- };
- if (_vest3) exitWith {
- _damage = (_damage - 0.159) max 0;
- };
- };
- 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 {
- _damage = _damage + _damage762;
- if (_vest1) exitWith {
- _damage = (_damage - 0.089) max 0;
- };
- if (_vest2) exitWith {
- _damage = (_damage - 0.111) max 0;
- };
- if (_vest3) exitWith {
- _damage = (_damage - 0.159) max 0;
- };
- };
- 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 {
- _damage = _damage + _damage556;
- if (_vest1) exitWith {
- _damage = (_damage - 0.029) max 0;
- };
- if (_vest2) exitWith {
- _damage = (_damage - 0.048) max 0;
- };
- if (_vest3) exitWith {
- _damage = (_damage - 0.075) max 0;
- };
- };
- diag_log format ["Damage: %1 DmgHeadShot: %2 LastForHeadshot: %3 EHDamage: %4",_damage,_dmgForHeadshot,_dmgLastForHeadshot,_EHDamage];
- if ((_selection == "head") && ((_unit getHitPointDamage "HitHead") >= _dmgLastForHeadshot) && (_EHDamage >= _dmgForHeadshot) && !(ZULU_critHit)) then {
- diag_log format["HEADSHOT: %1",_damage];
- _saved = false;
- _random = -1;
- if (ZULU_MyHeadgear in ZULU_HelmI) then {
- //_random = (random 100);
- _random = call Dr_fnc_SelectRandom;
- 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 {
- if (1 isEqualTO _random) then {_saved = true};
- };
- 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 {
- if (1 isEqualTO _random) then {_saved = true};
- };
- if ((_projectile == "Zulu_Ammo_45ACP") || (_projectile == "Zulu_Ammo_45ACP_expansion") || (_projectile == "Zulu_Ammo_45ACP_Tracer_Green") || (_projectile == "Zulu_Ammo_45ACP_Tracer_Yellow")) exitWith {
- if (1 isEqualTO _random) then {_saved = true};
- };
- 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 {
- if (5 >= _random) then {_saved = true};
- };
- };
- if (ZULU_MyHeadgear in ZULU_HelmII) then {
- _random = (random 100);
- 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 {
- if (20 >= _random) then {_saved = true};
- };
- 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 {
- if (15 >= _random) then {_saved = true};
- };
- if ((_projectile == "Zulu_Ammo_45ACP") || (_projectile == "Zulu_Ammo_45ACP_expansion") || (_projectile == "Zulu_Ammo_45ACP_Tracer_Green") || (_projectile == "Zulu_Ammo_45ACP_Tracer_Yellow")) exitWith {
- if (20 >= _random) then {_saved = true};
- };
- 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 {
- if (25 >= _random) then {_saved = true};
- };
- };
- if (ZULU_MyHeadgear in ZULU_HelmIII) then {
- _random = (random 100);
- 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 {
- if (35 >= _random) then {_saved = true};
- };
- 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 {
- if (25 >= _random) then {_saved = true};
- };
- if ((_projectile == "Zulu_Ammo_45ACP") || (_projectile == "Zulu_Ammo_45ACP_expansion") || (_projectile == "Zulu_Ammo_45ACP_Tracer_Green") || (_projectile == "Zulu_Ammo_45ACP_Tracer_Yellow")) exitWith {
- if (35 >= _random) then {_saved = true};
- };
- 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 {
- if (50 >= _random) then {_saved = true};
- };
- };
- if (_saved) exitWith {
- diag_log format ["SAVED: Helm - %1, Chance - (%2)",ZULU_MyHeadgear,_random];
- };
- [_unit,_source] spawn Dr_fnc_unconscious;
- _exitHeadShot = true;
- };
- if (_exitHeadShot) exitWith {damage _unit};
- if ((_damage > 0.99) && (damage _unit) < 1) then {
- _damage = 0.99;
- };
- if (((damage _unit) > 0.95) && !(ZULU_critHit)) exitWith {
- [_unit,_source] spawn Dr_fnc_unconscious;
- (damage _unit)
- };
- _damage
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement