mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-04 07:12:55 +03:00
Update combat handling
- Remove startcombattimer variable - Add combatNoTimeout variable to handle a combat without a time limit
This commit is contained in:
@@ -140,6 +140,7 @@ fnc_evr = {
|
||||
};
|
||||
|
||||
if (_this == "Stage4") exitWith {
|
||||
[player,false] call fnc_setCombat; // Start endless combat until storm has ended
|
||||
if (_hasAPSI) then {
|
||||
playSound "ns_evrDetect";
|
||||
uiSleep 0.2;
|
||||
@@ -187,7 +188,7 @@ fnc_evr = {
|
||||
|
||||
if (_this == "Stage5") exitWith {
|
||||
DZE_EVRStormRunning = true;
|
||||
[player,false] call fnc_setCombat;
|
||||
[player,false] call fnc_setCombat; // Start endless combat until storm has ended
|
||||
|
||||
if (_hasAPSI) then {
|
||||
playSound "ns_evrDetect";
|
||||
@@ -235,6 +236,7 @@ fnc_evr = {
|
||||
};
|
||||
|
||||
if (_this == "Stage6") exitWith {
|
||||
[player,false] call fnc_setCombat; // Start endless combat until storm has ended
|
||||
if (_hasAPSI) then {
|
||||
playSound "ns_evrDetect";
|
||||
uiSleep 0.2;
|
||||
@@ -281,6 +283,7 @@ fnc_evr = {
|
||||
};
|
||||
|
||||
if (_this == "Stage7") exitWith {
|
||||
[player,false] call fnc_setCombat; // Start endless combat until storm has ended
|
||||
if (_hasAPSI) then {
|
||||
playSound "ns_evrDetect";
|
||||
cutRsc ["RscAPSI_Start","PLAIN"];
|
||||
@@ -481,7 +484,7 @@ fnc_evr = {
|
||||
disableUserInput true; disableUserInput true;
|
||||
disableUserInput false; disableUserInput false;
|
||||
DZE_EVRStormRunning = false;
|
||||
player setVariable["startcombattimer", 0];
|
||||
player setVariable["combatNoTimeout", 0];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -115,7 +115,7 @@ if (r_player_unconscious) then {
|
||||
};
|
||||
|
||||
//Lets make sure the player is looking at the target
|
||||
if (isPlayer cursorTarget) then {
|
||||
if (isPlayer cursorTarget && _hasPatient) then {
|
||||
if (!r_player_unconscious && !_inVehicle && {!r_drag_sqf && !r_action && player distance _menClose < 3}) then {
|
||||
local _unit = cursorTarget;
|
||||
player reveal _unit;
|
||||
@@ -153,9 +153,8 @@ if (isPlayer cursorTarget) then {
|
||||
};
|
||||
|
||||
local _vehClose = (getPosATL player) nearEntities [["Car","Tank","Helicopter","Plane","StaticWeapon","Ship"],5];
|
||||
|
||||
if (_hasPatient) then {
|
||||
local _action = [];
|
||||
|
||||
//Allow player to drag
|
||||
if(_unconscious && !_dragged) then {
|
||||
r_action = true;
|
||||
@@ -258,7 +257,6 @@ if (isPlayer cursorTarget) then {
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
//Remove Actions
|
||||
if ((!_isClose || !_hasPatient) && r_action) then {
|
||||
|
||||
@@ -86,10 +86,7 @@ if (DZE_PVE_Mode && {_isPlayer} && {!_falling}) exitWith {};
|
||||
|
||||
if (_unit == player) then {
|
||||
//Set player in combat
|
||||
_unit setVariable["startcombattimer", 1];
|
||||
if !(_unit getVariable["inCombat",false]) then {
|
||||
_unit setVariable["inCombat",true,true];
|
||||
};
|
||||
[_unit,true] call fnc_setCombat;
|
||||
|
||||
if (r_player_timeout == 0 && {!_inVehicle}) then {
|
||||
if (_ammo == "tranquiliser_bolt") then {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
local _object = _this select 0;
|
||||
local _setCombatOverTime = _this select 1;
|
||||
local _setCombatOverTime = _this select 1; // if true, combat has a time limit
|
||||
|
||||
if (_setCombatOverTime) then {
|
||||
_object setVariable["combattimeout", diag_tickTime + DZE_CombatTimer];
|
||||
_object setVariable["combatTimeout", diag_tickTime + DZE_CombatTimer]; // Combat time limited based on DZE_CombatTimer
|
||||
} else {
|
||||
_object setVariable["startcombattimer", 1];
|
||||
_object setVariable["combatNoTimeout", 1]; // Endless combat until the combat variable will be resetted
|
||||
};
|
||||
|
||||
if !(_object getVariable ["inCombat",false]) then {
|
||||
|
||||
@@ -177,12 +177,6 @@ disableUserInput true;
|
||||
if (dayz_soundMuted) then {call player_toggleSoundMute;}; // hide icon before fadeSound
|
||||
0.1 fadeSound 0;
|
||||
|
||||
_body setVariable ["NORRN_unconscious", false, true];
|
||||
_body setVariable ["unconsciousTime", 0, true];
|
||||
_body setVariable ["USEC_isCardiac",false,true];
|
||||
_body setVariable ["bloodTaken", false, true];
|
||||
_body setVariable ["startcombattimer", 0]; //remove combat timer on death
|
||||
_body setVariable ["inCombat", false, true];
|
||||
r_player_unconscious = false;
|
||||
r_player_cardiac = false;
|
||||
dayz_autoRun = false;
|
||||
@@ -212,8 +206,6 @@ deleteGroup _myGroup;
|
||||
3 cutRsc ["default", "PLAIN",3];
|
||||
4 cutRsc ["default", "PLAIN",3];
|
||||
|
||||
_body setVariable["combattimeout", 0, true];
|
||||
|
||||
_animState = toLower (animationState _body);
|
||||
_animStateArray = toArray _animState;
|
||||
_animCheck = toString ([(_animStateArray select 0),(_animStateArray select 1),(_animStateArray select 2),(_animStateArray select 3)]);
|
||||
|
||||
@@ -22,7 +22,8 @@ local _zombieKills = player getVariable ["zombieKills",0];
|
||||
local _headShots = player getVariable ["headShots",0];
|
||||
local _humanKills = player getVariable ["humanKills",0];
|
||||
local _banditKills = player getVariable ["banditKills",0];
|
||||
local _combattimeout = player getVariable["combattimeout",0];
|
||||
local _combattimeout = player getVariable["combatTimeout",0];
|
||||
local _combatNoTimeout = player getVariable["combatNoTimeout",0];
|
||||
local _inCombat = player getVariable ["inCombat",false];
|
||||
local _survivalTime = player getVariable ["SurvivalTime",0];
|
||||
local _ConfirmedHumanKills = player getVariable ["ConfirmedHumanKills",0];
|
||||
@@ -91,7 +92,8 @@ if (count _medical > 0) then {
|
||||
//player setVariable ["banditKills",_banditKills,true]; //Moved to player_switchModel
|
||||
//player setVariable ["characterID",_charID,true]; //Moved to player_switchModel
|
||||
player setVariable ["worldspace",_worldspace];
|
||||
player setVariable ["combattimeout",_combattimeout,false];
|
||||
player setVariable ["combatTimeout",_combattimeout,false];
|
||||
player setVariable ["combatNoTimeout",_combatNoTimeout,false];
|
||||
player setVariable ["inCombat",_inCombat,true];
|
||||
player setVariable ["SurvivalTime",_survivalTime,false];
|
||||
player setVariable ["ConfirmedHumanKills",_ConfirmedHumanKills,true];
|
||||
|
||||
@@ -23,9 +23,8 @@ if (diag_tickTime - dayz_lastSave > 10) then {
|
||||
};
|
||||
|
||||
while {(!isNull _display) && !r_player_dead} do {
|
||||
_timeout = 30;
|
||||
_timeout = player getVariable["combattimeout", 0];
|
||||
_inCombat = (_timeout >= diag_tickTime);
|
||||
_timeout = player getVariable["combatTimeout", 0];
|
||||
_inCombat = (_timeout >= diag_tickTime) || (player getVariable["combatNoTimeout", 0] == 1);
|
||||
_playerCheck = ({isPlayer _x} count (player nearEntities ["AllVehicles",5]) > 1);
|
||||
_zedCheck = ((count (player nearEntities ["zZombie_Base",10]) > 0) && !_isPZombie);
|
||||
_gearDisplay = findDisplay 106;
|
||||
@@ -70,7 +69,7 @@ while {(!isNull _display) && !r_player_dead} do {
|
||||
};
|
||||
case (_inCombat) : {
|
||||
_btnAbort ctrlEnable false;
|
||||
_btnAbort ctrlSetText format["%1 (in %2)", _btnAbortText, ceil (_timeout - diag_tickTime)];
|
||||
_btnAbort ctrlSetText format["%1 (in %2)", _btnAbortText,[DZE_CombatTimer,ceil (_timeout - diag_tickTime)] select ((player getVariable["combatNoTimeout", 0] == 0))];
|
||||
[localize "str_abort_playerincombat",1] call dayz_rollingMessages;
|
||||
if (TimeOutDisplayed) then {
|
||||
_display closeDisplay 2;
|
||||
|
||||
@@ -15,7 +15,7 @@ local _foodVal = 1 - (dayz_hunger / SleepFood);
|
||||
local _thirstVal = 1 - (dayz_thirst / SleepWater);
|
||||
local _tempVal = 1 - ((dayz_temperatur - dayz_temperaturmin)/(dayz_temperaturmax - dayz_temperaturmin)); // Normalise to [0,1]
|
||||
local _bloodVal = r_player_blood / r_player_bloodTotal;
|
||||
local _combatVal = if (player getVariable["combattimeout",0] >= diag_tickTime) then {0} else {1};
|
||||
local _combatVal = if ((player getVariable["combatTimeout",0] >= diag_tickTime) || (player getVariable["combatNoTimeout", 0] == 1)) then {0} else {1};
|
||||
local _ctrlBloodOuter = 0;
|
||||
local _ctrlFoodBorder = 0;
|
||||
local _ctrlThirstBorder = 0;
|
||||
|
||||
@@ -260,12 +260,6 @@ while {1 == 1} do {
|
||||
pickupInit = true;
|
||||
};
|
||||
|
||||
_startcombattimer = player getVariable["startcombattimer", 0];
|
||||
if (_startcombattimer == 1) then { //Do not use _PlayerNearby it makes building impossible, this is handled in player_onPause.sqf just fine
|
||||
[player,true] call fnc_setCombat;
|
||||
player setVariable["startcombattimer", 0, false];
|
||||
};
|
||||
|
||||
uiSleep 2;
|
||||
|
||||
_myPos = player getVariable["lastPos",[]];
|
||||
|
||||
@@ -9,7 +9,7 @@ sched_playerActions = {
|
||||
};
|
||||
|
||||
//combat check
|
||||
if ((player getVariable ["combattimeout",0] < diag_tickTime) && {player getVariable ["inCombat",false]} && {player getVariable["startcombattimer", 0] == 0}) then {
|
||||
if ((player getVariable ["combatTimeout",0] < diag_tickTime) && {player getVariable ["inCombat",false]} && {player getVariable["combatNoTimeout", 0] == 0}) then {
|
||||
player setVariable ["inCombat", false, true];
|
||||
};
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ sched_throwable = {
|
||||
sched_throwable_prevmuzz = currentMuzzle player;
|
||||
sched_throwable_time = diag_tickTime+11;
|
||||
};
|
||||
if (((player getVariable["combattimeout", diag_tickTime])-diag_tickTime)>27) then {
|
||||
if (((player getVariable["combatTimeout", diag_tickTime])-diag_tickTime)>27) then {
|
||||
sched_throwable_time = diag_tickTime+21;
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user