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

View File

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

View File

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