mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-04 15:22:53 +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 {
|
if (_this == "Stage4") exitWith {
|
||||||
|
[player,false] call fnc_setCombat; // Start endless combat until storm has ended
|
||||||
if (_hasAPSI) then {
|
if (_hasAPSI) then {
|
||||||
playSound "ns_evrDetect";
|
playSound "ns_evrDetect";
|
||||||
uiSleep 0.2;
|
uiSleep 0.2;
|
||||||
@@ -187,7 +188,7 @@ fnc_evr = {
|
|||||||
|
|
||||||
if (_this == "Stage5") exitWith {
|
if (_this == "Stage5") exitWith {
|
||||||
DZE_EVRStormRunning = true;
|
DZE_EVRStormRunning = true;
|
||||||
[player,false] call fnc_setCombat;
|
[player,false] call fnc_setCombat; // Start endless combat until storm has ended
|
||||||
|
|
||||||
if (_hasAPSI) then {
|
if (_hasAPSI) then {
|
||||||
playSound "ns_evrDetect";
|
playSound "ns_evrDetect";
|
||||||
@@ -235,6 +236,7 @@ fnc_evr = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (_this == "Stage6") exitWith {
|
if (_this == "Stage6") exitWith {
|
||||||
|
[player,false] call fnc_setCombat; // Start endless combat until storm has ended
|
||||||
if (_hasAPSI) then {
|
if (_hasAPSI) then {
|
||||||
playSound "ns_evrDetect";
|
playSound "ns_evrDetect";
|
||||||
uiSleep 0.2;
|
uiSleep 0.2;
|
||||||
@@ -281,6 +283,7 @@ fnc_evr = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (_this == "Stage7") exitWith {
|
if (_this == "Stage7") exitWith {
|
||||||
|
[player,false] call fnc_setCombat; // Start endless combat until storm has ended
|
||||||
if (_hasAPSI) then {
|
if (_hasAPSI) then {
|
||||||
playSound "ns_evrDetect";
|
playSound "ns_evrDetect";
|
||||||
cutRsc ["RscAPSI_Start","PLAIN"];
|
cutRsc ["RscAPSI_Start","PLAIN"];
|
||||||
@@ -481,7 +484,7 @@ fnc_evr = {
|
|||||||
disableUserInput true; disableUserInput true;
|
disableUserInput true; disableUserInput true;
|
||||||
disableUserInput false; disableUserInput false;
|
disableUserInput false; disableUserInput false;
|
||||||
DZE_EVRStormRunning = 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
|
//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 {
|
if (!r_player_unconscious && !_inVehicle && {!r_drag_sqf && !r_action && player distance _menClose < 3}) then {
|
||||||
local _unit = cursorTarget;
|
local _unit = cursorTarget;
|
||||||
player reveal _unit;
|
player reveal _unit;
|
||||||
@@ -153,9 +153,8 @@ if (isPlayer cursorTarget) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
local _vehClose = (getPosATL player) nearEntities [["Car","Tank","Helicopter","Plane","StaticWeapon","Ship"],5];
|
local _vehClose = (getPosATL player) nearEntities [["Car","Tank","Helicopter","Plane","StaticWeapon","Ship"],5];
|
||||||
|
|
||||||
if (_hasPatient) then {
|
|
||||||
local _action = [];
|
local _action = [];
|
||||||
|
|
||||||
//Allow player to drag
|
//Allow player to drag
|
||||||
if(_unconscious && !_dragged) then {
|
if(_unconscious && !_dragged) then {
|
||||||
r_action = true;
|
r_action = true;
|
||||||
@@ -257,7 +256,6 @@ if (isPlayer cursorTarget) then {
|
|||||||
call fnc_usec_medic_removeActions;
|
call fnc_usec_medic_removeActions;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//Remove Actions
|
//Remove Actions
|
||||||
|
|||||||
@@ -85,11 +85,8 @@ _isPlayer = (isPlayer _source);
|
|||||||
if (DZE_PVE_Mode && {_isPlayer} && {!_falling}) exitWith {};
|
if (DZE_PVE_Mode && {_isPlayer} && {!_falling}) exitWith {};
|
||||||
|
|
||||||
if (_unit == player) then {
|
if (_unit == player) then {
|
||||||
//Set player in combat
|
//Set player in combat
|
||||||
_unit setVariable["startcombattimer", 1];
|
[_unit,true] call fnc_setCombat;
|
||||||
if !(_unit getVariable["inCombat",false]) then {
|
|
||||||
_unit setVariable["inCombat",true,true];
|
|
||||||
};
|
|
||||||
|
|
||||||
if (r_player_timeout == 0 && {!_inVehicle}) then {
|
if (r_player_timeout == 0 && {!_inVehicle}) then {
|
||||||
if (_ammo == "tranquiliser_bolt") then {
|
if (_ammo == "tranquiliser_bolt") then {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
local _object = _this select 0;
|
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 {
|
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 {
|
} else {
|
||||||
_object setVariable["startcombattimer", 1];
|
_object setVariable["combatNoTimeout", 1]; // Endless combat until the combat variable will be resetted
|
||||||
};
|
};
|
||||||
|
|
||||||
if !(_object getVariable ["inCombat",false]) then {
|
if !(_object getVariable ["inCombat",false]) then {
|
||||||
|
|||||||
@@ -177,12 +177,6 @@ disableUserInput true;
|
|||||||
if (dayz_soundMuted) then {call player_toggleSoundMute;}; // hide icon before fadeSound
|
if (dayz_soundMuted) then {call player_toggleSoundMute;}; // hide icon before fadeSound
|
||||||
0.1 fadeSound 0;
|
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_unconscious = false;
|
||||||
r_player_cardiac = false;
|
r_player_cardiac = false;
|
||||||
dayz_autoRun = false;
|
dayz_autoRun = false;
|
||||||
@@ -212,8 +206,6 @@ deleteGroup _myGroup;
|
|||||||
3 cutRsc ["default", "PLAIN",3];
|
3 cutRsc ["default", "PLAIN",3];
|
||||||
4 cutRsc ["default", "PLAIN",3];
|
4 cutRsc ["default", "PLAIN",3];
|
||||||
|
|
||||||
_body setVariable["combattimeout", 0, true];
|
|
||||||
|
|
||||||
_animState = toLower (animationState _body);
|
_animState = toLower (animationState _body);
|
||||||
_animStateArray = toArray _animState;
|
_animStateArray = toArray _animState;
|
||||||
_animCheck = toString ([(_animStateArray select 0),(_animStateArray select 1),(_animStateArray select 2),(_animStateArray select 3)]);
|
_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 _headShots = player getVariable ["headShots",0];
|
||||||
local _humanKills = player getVariable ["humanKills",0];
|
local _humanKills = player getVariable ["humanKills",0];
|
||||||
local _banditKills = player getVariable ["banditKills",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 _inCombat = player getVariable ["inCombat",false];
|
||||||
local _survivalTime = player getVariable ["SurvivalTime",0];
|
local _survivalTime = player getVariable ["SurvivalTime",0];
|
||||||
local _ConfirmedHumanKills = player getVariable ["ConfirmedHumanKills",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 ["banditKills",_banditKills,true]; //Moved to player_switchModel
|
||||||
//player setVariable ["characterID",_charID,true]; //Moved to player_switchModel
|
//player setVariable ["characterID",_charID,true]; //Moved to player_switchModel
|
||||||
player setVariable ["worldspace",_worldspace];
|
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 ["inCombat",_inCombat,true];
|
||||||
player setVariable ["SurvivalTime",_survivalTime,false];
|
player setVariable ["SurvivalTime",_survivalTime,false];
|
||||||
player setVariable ["ConfirmedHumanKills",_ConfirmedHumanKills,true];
|
player setVariable ["ConfirmedHumanKills",_ConfirmedHumanKills,true];
|
||||||
|
|||||||
@@ -23,9 +23,8 @@ if (diag_tickTime - dayz_lastSave > 10) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
while {(!isNull _display) && !r_player_dead} do {
|
while {(!isNull _display) && !r_player_dead} do {
|
||||||
_timeout = 30;
|
_timeout = player getVariable["combatTimeout", 0];
|
||||||
_timeout = player getVariable["combattimeout", 0];
|
_inCombat = (_timeout >= diag_tickTime) || (player getVariable["combatNoTimeout", 0] == 1);
|
||||||
_inCombat = (_timeout >= diag_tickTime);
|
|
||||||
_playerCheck = ({isPlayer _x} count (player nearEntities ["AllVehicles",5]) > 1);
|
_playerCheck = ({isPlayer _x} count (player nearEntities ["AllVehicles",5]) > 1);
|
||||||
_zedCheck = ((count (player nearEntities ["zZombie_Base",10]) > 0) && !_isPZombie);
|
_zedCheck = ((count (player nearEntities ["zZombie_Base",10]) > 0) && !_isPZombie);
|
||||||
_gearDisplay = findDisplay 106;
|
_gearDisplay = findDisplay 106;
|
||||||
@@ -70,7 +69,7 @@ while {(!isNull _display) && !r_player_dead} do {
|
|||||||
};
|
};
|
||||||
case (_inCombat) : {
|
case (_inCombat) : {
|
||||||
_btnAbort ctrlEnable false;
|
_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;
|
[localize "str_abort_playerincombat",1] call dayz_rollingMessages;
|
||||||
if (TimeOutDisplayed) then {
|
if (TimeOutDisplayed) then {
|
||||||
_display closeDisplay 2;
|
_display closeDisplay 2;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ local _foodVal = 1 - (dayz_hunger / SleepFood);
|
|||||||
local _thirstVal = 1 - (dayz_thirst / SleepWater);
|
local _thirstVal = 1 - (dayz_thirst / SleepWater);
|
||||||
local _tempVal = 1 - ((dayz_temperatur - dayz_temperaturmin)/(dayz_temperaturmax - dayz_temperaturmin)); // Normalise to [0,1]
|
local _tempVal = 1 - ((dayz_temperatur - dayz_temperaturmin)/(dayz_temperaturmax - dayz_temperaturmin)); // Normalise to [0,1]
|
||||||
local _bloodVal = r_player_blood / r_player_bloodTotal;
|
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 _ctrlBloodOuter = 0;
|
||||||
local _ctrlFoodBorder = 0;
|
local _ctrlFoodBorder = 0;
|
||||||
local _ctrlThirstBorder = 0;
|
local _ctrlThirstBorder = 0;
|
||||||
|
|||||||
@@ -260,12 +260,6 @@ while {1 == 1} do {
|
|||||||
pickupInit = true;
|
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;
|
uiSleep 2;
|
||||||
|
|
||||||
_myPos = player getVariable["lastPos",[]];
|
_myPos = player getVariable["lastPos",[]];
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ sched_playerActions = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//combat check
|
//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];
|
player setVariable ["inCombat", false, true];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ sched_throwable = {
|
|||||||
sched_throwable_prevmuzz = currentMuzzle player;
|
sched_throwable_prevmuzz = currentMuzzle player;
|
||||||
sched_throwable_time = diag_tickTime+11;
|
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;
|
sched_throwable_time = diag_tickTime+21;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user