Updated startcombattimer variable

This commit is contained in:
Florian Kinder
2014-02-20 18:01:16 +01:00
parent 6c0581bda9
commit bf13a783d9
5 changed files with 50 additions and 50 deletions

View File

@@ -1,4 +1,4 @@
scriptName "Functions\misc\fn_damageHandler.sqf";
/***********************************************************
PROCESS DAMAGE TO A UNIT
@@ -29,20 +29,20 @@ if (_unitIsPlayer) then {
if ((_source != player) and _isPlayer) then {
//Enable aggressor Actions
if (_source isKindOf "CAManBase") then {
_source setVariable["startcombattimer",1];
_source setVariable["startcombattimer",1];
};
_canHitFree = player getVariable ["freeTarget",false];
_isBandit = (player getVariable["humanity",0]) <= -5000;
_isPZombie = player isKindOf "PZombie_VB";
if (!_canHitFree and !_isBandit and !_isPZombie) then {
//Process Morality Hit
_myKills = 0 max (1 - (player getVariable ["humanKills",0]) / 5);
_humanityHit = -100 * _myKills * _damage;
/* PVS/PVC - Skaronator */
if (_humanityHit != 0) then {
[_source,_humanityHit] spawn {
[_source,_humanityHit] spawn {
private ["_source","_humanityHit"];
_source = _this select 0;
_humanityHit = _this select 1;
@@ -101,7 +101,7 @@ if (_hit in USEC_MinorWounds) then {
if (_unitIsPlayer) then {
//incombat
_unit setVariable["startcombattimer", 1, false];
_unit setVariable["startcombattimer", 1];
};
if (_damage > 0.1) then {
@@ -117,10 +117,10 @@ if (_damage > 0.1) then {
if (_damage > 0.4) then { //0.25
/*
BLEEDING
*/
*/
_wound = _hit call fnc_usec_damageGetWound;
_isHit = _unit getVariable[_wound,false];
if (_unitIsPlayer) then {
if (_unitIsPlayer) then {
_rndPain = (random 10);
_rndInfection = (random 500);
_hitPain = (_rndPain < _damage);
@@ -141,7 +141,7 @@ if (_damage > 0.4) then { //0.25
r_player_infected = true;
player setVariable["USEC_infected",true,true];
};
};
if (_hitPain) then {
//Set Pain if not already
@@ -155,11 +155,11 @@ if (_damage > 0.4) then { //0.25
};
};
if(!_isHit) then {
if(!_isPZombie) then {
//Create Wound
_unit setVariable[_wound,true,true];
[_unit,_wound,_hit] spawn fnc_usec_damageBleed;
/* PVS/PVC - Skaronator */
_pos = getPosATL _unit;
@@ -193,8 +193,8 @@ if (_damage > 0.4) then { //0.25
};
if (_type == 1) then {
/*
BALISTIC DAMAGE
*/
BALISTIC DAMAGE
*/
if ((_damage > 0.01) and (_unitIsPlayer)) then {
//affect the player
[20,45] call fnc_usec_pitchWhine; //Visual , Sound

View File

@@ -27,22 +27,22 @@ while {(alive _projectile) && !(isNull _projectile) && _callCount < 85;} do {
{
_nearVehicle = _x;
_listNear = _listNear - [_x];
//diag_log ("3");
if (isPlayer _nearVehicle) then {
_isInCombat = _nearVehicle getVariable["startcombattimer",0];
if ((alive _nearVehicle) and _isInCombat == 0) then {
_nearVehicle setVariable["startcombattimer", 1, true];
_nearVehicle setVariable["startcombattimer", 1];
diag_log("Now in Combat (Player): " + name _unit);
};
};
if (_nearVehicle isKindOf "AllVehicles") then {
{
_isInCombat = _x getVariable["startcombattimer",0];
if (isPlayer _x and _isInCombat == 0 and alive _x) then {
_x setVariable["startcombattimer", 1, true];
_x setVariable["startcombattimer", 1];
diag_log("Now in Combat (Crew): " + name _x);
};
} forEach (crew _nearVehicle);

View File

@@ -8,7 +8,7 @@ private ["_unit","_evType","_recordable","_inVehicle","_isPlayer","_isRocket","_
_weapon = _this select 3;
_ammo = _this select 6;
_killerID = _firer getVariable["MemberID",0];
_handled = false;
_arc = 60;
_isBallistic = (getNumber (configfile >> "CfgAmmo" >> _ammo >> "whistleOnFire") > 0);
@@ -18,18 +18,18 @@ private ["_unit","_evType","_recordable","_inVehicle","_isPlayer","_isRocket","_
_inVehicle = (vehicle _unit != _unit);
_evType = "";
_recordable = false;
// Both the firer and those nearby (<=8m) go into "combat" to prevent ALT-F4
//diag_log ("DEBUG: AMMO TYPE: " +str(_ammo));
_firer setVariable["startcombattimer", 1, false];
_firer setVariable["startcombattimer", 1];
if (_distance <= 8) then {
_unit setVariable["startcombattimer", 1, false];
_unit setVariable["startcombattimer", 1];
};
if (_inVehicle) exitWith{};
if (_firer == player) exitWith{};
//Is in danger angle?
_turretDir = _firer weaponDirection _weapon;
_weaponDir = ((_turretDir select 0) atan2 (_turretDir select 1));
@@ -42,7 +42,7 @@ private ["_unit","_evType","_recordable","_inVehicle","_isPlayer","_isRocket","_
//In front?
_isInFront = (_firingArc < _arc);
_isInRear = (_firingArc > (180 - _arc));
//Ballistic Handler
if ((_isBallistic and _isInFront) and (_distance < (_dmgDistance * 2))) then {
if (_distance < _dmgDistance) then {
@@ -88,6 +88,6 @@ private ["_unit","_evType","_recordable","_inVehicle","_isPlayer","_isRocket","_
[10,20] call fnc_usec_pitchWhine; //Visual , Sound
addCamShake [15, 0.8, 25];
};
};
};
};
//Launcher Handler