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

View File

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

View File

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

View File

@@ -6,14 +6,14 @@ _unit = _array select 0;
_attacker = _array select 1; _attacker = _array select 1;
if (_unit == player && player distance _attacker < 5) then { if (_unit == player && player distance _attacker < 5) then {
player setVariable["startcombattimer", 1, false]; player setVariable["startcombattimer", 1];
// Make bleed // Make bleed
if (random 2 < 1) then { if (random 2 < 1) then {
// Find hit // Find hit
_cnt = count (DAYZ_woundHit_ok select 1); _cnt = count (DAYZ_woundHit_ok select 1);
_index = floor (random _cnt); _index = floor (random _cnt);
_index = (DAYZ_woundHit_ok select 1) select _index; _index = (DAYZ_woundHit_ok select 1) select _index;
_hit = (DAYZ_woundHit_ok select 0) select _index; _hit = (DAYZ_woundHit_ok select 0) select _index;
_damage = 0.1 + random (1.2); _damage = 0.1 + random (1.2);
@@ -23,7 +23,7 @@ if (_unit == player && player distance _attacker < 5) then {
}; };
player setVariable["medForceUpdate",true,true]; player setVariable["medForceUpdate",true,true];
1 call fnc_usec_bulletHit; 1 call fnc_usec_bulletHit;
_wound = _hit call fnc_usec_damageGetWound; _wound = _hit call fnc_usec_damageGetWound;

View File

@@ -21,9 +21,9 @@ while {true} do {
// _size = (sizeOf typeOf _refObj) * _factor; // _size = (sizeOf typeOf _refObj) * _factor;
_vel = velocity player; _vel = velocity player;
_speed = (round((_vel distance [0,0,0]) * 3.5)) min 18; _speed = (round((_vel distance [0,0,0]) * 3.5)) min 18;
// dayz_areaAffect = _size; // dayz_areaAffect = _size;
//Record Check //Record Check
_lastUpdate = time - dayZ_lastPlayerUpdate; _lastUpdate = time - dayZ_lastPlayerUpdate;
if (_lastUpdate > 8) then { if (_lastUpdate > 8) then {
@@ -35,9 +35,9 @@ while {true} do {
// Check for radiation // Check for radiation
DZE_InRadiationZone = false; DZE_InRadiationZone = false;
_outsideMap = ((dayz_myPosition select 0) < dayz_minpos OR (dayz_myPosition select 1) < dayz_minpos OR (dayz_myPosition select 0) > dayz_maxpos OR (dayz_myPosition select 1) > dayz_maxpos); _outsideMap = ((dayz_myPosition select 0) < dayz_minpos OR (dayz_myPosition select 1) < dayz_minpos OR (dayz_myPosition select 0) > dayz_maxpos OR (dayz_myPosition select 1) > dayz_maxpos);
if(_outsideMap OR DZE_Quarantine) then { if(_outsideMap OR DZE_Quarantine) then {
DZE_InRadiationZone = true; DZE_InRadiationZone = true;
}; };
@@ -68,7 +68,7 @@ while {true} do {
player setVariable ["temperature",dayz_temperatur,true]; player setVariable ["temperature",dayz_temperatur,true];
_lastTemp = dayz_temperatur; _lastTemp = dayz_temperatur;
}; };
//can get nearby infection //can get nearby infection
if (!r_player_infected and !_isPZombie) then { if (!r_player_infected and !_isPZombie) then {
//Infectionriskstart //Infectionriskstart
@@ -98,16 +98,16 @@ while {true} do {
}; };
}; };
}; };
//If has infection reduce blood cough and add shake //If has infection reduce blood cough and add shake
if (r_player_infected) then { if (r_player_infected) then {
if !(player getVariable["USEC_infected",false]) then { if !(player getVariable["USEC_infected",false]) then {
player setVariable["USEC_infected",true,true]; player setVariable["USEC_infected",true,true];
}; };
_rnd = ceil (random 8); _rnd = ceil (random 8);
[player,"cough",_rnd,false,9] call dayz_zombieSpeak; [player,"cough",_rnd,false,9] call dayz_zombieSpeak;
if (_rnd < 3) then { if (_rnd < 3) then {
addCamShake [2, 1, 25]; addCamShake [2, 1, 25];
}; };
@@ -115,13 +115,13 @@ while {true} do {
r_player_blood = r_player_blood - 3; r_player_blood = r_player_blood - 3;
}; };
}; };
//Pain Shake Effects //Pain Shake Effects
if (r_player_inpain and !r_player_unconscious) then { if (r_player_inpain and !r_player_unconscious) then {
playSound "breath_1"; playSound "breath_1";
addCamShake [2, 1, 25]; addCamShake [2, 1, 25];
}; };
//Hunger Effect //Hunger Effect
_foodVal = dayz_statusArray select 0; _foodVal = dayz_statusArray select 0;
_thirstVal = dayz_statusArray select 1; _thirstVal = dayz_statusArray select 1;
@@ -144,7 +144,7 @@ while {true} do {
// Radiation zones rapid blood loss // Radiation zones rapid blood loss
if (DZE_InRadiationZone) then { if (DZE_InRadiationZone) then {
_radsound = "radzone1"; _radsound = "radzone1";
_bloodloss = 10; _bloodloss = 10;
if(_radTimer > 5 AND _radTimer < 10) then { if(_radTimer > 5 AND _radTimer < 10) then {
@@ -171,7 +171,7 @@ while {true} do {
} else { } else {
_radTimer = 0; _radTimer = 0;
}; };
// Health uptick when healty not thirsty or hungry // Health uptick when healty not thirsty or hungry
if (_foodVal >= 0.9 and _thirstVal >= 0.9) then { if (_foodVal >= 0.9 and _thirstVal >= 0.9) then {
if (!r_player_infected and !r_player_inpain and !r_player_injured and !DZE_InRadiationZone) then { if (!r_player_infected and !r_player_inpain and !r_player_injured and !DZE_InRadiationZone) then {
@@ -183,20 +183,20 @@ while {true} do {
}; };
}; };
}; };
//Record low blood //Record low blood
_lowBlood = player getVariable ["USEC_lowBlood", false]; _lowBlood = player getVariable ["USEC_lowBlood", false];
if ((r_player_blood < r_player_bloodTotal) and !_lowBlood) then { if ((r_player_blood < r_player_bloodTotal) and !_lowBlood) then {
player setVariable["USEC_lowBlood",true,true]; player setVariable["USEC_lowBlood",true,true];
}; };
//Broadcast Hunger/Thirst //Broadcast Hunger/Thirst
_messTimer = _messTimer + 1; _messTimer = _messTimer + 1;
if (_messTimer > 15) then { if (_messTimer > 15) then {
_messTimer = 0; _messTimer = 0;
player setVariable ["messing",[dayz_hunger,dayz_thirst],true]; player setVariable ["messing",[dayz_hunger,dayz_thirst],true];
}; };
// Update blood only if PVAR does not match GVAR. // Update blood only if PVAR does not match GVAR.
_currentBlood = player getVariable ["USEC_BloodQty", 12000]; _currentBlood = player getVariable ["USEC_BloodQty", 12000];
if (_currentBlood != r_player_blood) then { if (_currentBlood != r_player_blood) then {
@@ -218,7 +218,7 @@ while {true} do {
_startcombattimer = player getVariable["startcombattimer",0]; _startcombattimer = player getVariable["startcombattimer",0];
if (_startcombattimer == 1) then { if (_startcombattimer == 1) then {
player setVariable["combattimeout", time + 30, true]; player setVariable["combattimeout", time + 30, true];
player setVariable["startcombattimer", 0, true]; player setVariable["startcombattimer", 0];
dayz_combat = 1; dayz_combat = 1;
}; };
@@ -242,7 +242,7 @@ while {true} do {
_combatcontrol = _combatdisplay displayCtrl 1307; _combatcontrol = _combatdisplay displayCtrl 1307;
_combatcontrol ctrlShow true; _combatcontrol ctrlShow true;
}; };
//Melee Weapons ammo fix //Melee Weapons ammo fix
if(isNil {login_ammochecked}) then { if(isNil {login_ammochecked}) then {
login_ammochecked = true; login_ammochecked = true;
@@ -252,10 +252,10 @@ while {true} do {
call dayz_meleeMagazineCheck; call dayz_meleeMagazineCheck;
}; };
}; };
// Blood Effects // Blood Effects
"colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, (r_player_blood/r_player_bloodTotal)], [1, 1, 1, 0.0]]; "colorCorrections" ppEffectAdjust [1, 1, 0, [1, 1, 1, 0.0], [1, 1, 1, (r_player_blood/r_player_bloodTotal)], [1, 1, 1, 0.0]];
"colorCorrections" ppEffectCommit 0; "colorCorrections" ppEffectCommit 0;
sleep 2; sleep 2;
}; };