Prevent errors if zombie is deleted suddenly

This commit is contained in:
ebaydayz
2016-05-05 20:03:41 -04:00
parent 00cb76a496
commit b0ffc1421e
3 changed files with 4 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ _playerDodged = false;
if (_type != "zombie") exitWith { diag_log ("not a zombie"); }; // we deal only with zombies in this function if (_type != "zombie") exitWith { diag_log ("not a zombie"); }; // we deal only with zombies in this function
if (_unit distance _vehicle > 3) exitWith {}; // distance too far according to any logic dealt here //+str(_unit distance _nextPlayerPos)+"/"+str(_areaAffect) if (_unit distance _vehicle > 3) exitWith {}; // distance too far according to any logic dealt here //+str(_unit distance _nextPlayerPos)+"/"+str(_areaAffect)
if (isNull _unit) exitWith {}; // Prevent errors if zombie is deleted suddenly
// compute the animation move // compute the animation move
_rnd = 0; _rnd = 0;
@@ -85,7 +86,7 @@ if (local _unit) then {
*/ */
[objNull, _unit, rplaymove, _move] call RE; [objNull, _unit, rplaymove, _move] call RE;
uiSleep 0.5; uiSleep 0.5;
if (isNull _unit) exitWith {}; // Prevent errors if zombie is deleted suddenly
//slow it down make sure the animation isnt running after the damage //slow it down make sure the animation isnt running after the damage
//_timeout = diag_tickTime + 0.3; //_timeout = diag_tickTime + 0.3;
//waitUntil { diag_tickTime >= _timeout; }; //waitUntil { diag_tickTime >= _timeout; };

View File

@@ -1,5 +1,6 @@
private ["_target","_targets","_man","_manDis","_localtargets","_remotetargets"]; private ["_target","_targets","_man","_manDis","_localtargets","_remotetargets"];
_agent = _this; _agent = _this;
if (isNull _agent) exitWith {objNull}; // Prevent errors if zombie is suddenly deleted
_target = objNull; _target = objNull;
_targets = []; _targets = [];
//_targetDis = []; //_targetDis = [];

View File

@@ -760,6 +760,7 @@ class FSM
"_remotetargets = _agent getVariable [""remotetargets"",[]];" \n "_remotetargets = _agent getVariable [""remotetargets"",[]];" \n
"" \n "" \n
"//Clear remote on reset" \n "//Clear remote on reset" \n
"if (isNull _agent) then {_remotetargets = [];};" \n
"if (count _remotetargets > 0) then {" \n "if (count _remotetargets > 0) then {" \n
" _agent setVariable [""remotetargets"",[],true];" \n " _agent setVariable [""remotetargets"",[],true];" \n
"};" \n "};" \n