cleanup on player death

This commit is contained in:
Eero af Heurlin 2016-07-24 12:11:48 +03:00
parent 5992cdf24d
commit 1856cb8842
4 changed files with 9 additions and 2 deletions

View File

@ -23,10 +23,10 @@ diag_log format["createObj called, _target: %1, _playerno: %2, _player: %3", _ta
//(playersArray select _playerno) setCurrentTask _tsk1;
_taskid = format["p%1_lz%2", _playerno, _lzLoc];
[west,[_taskid],[format["Fly to and land within %1m of the next LZ", lzSize], "Next LZ", "LZ"],(getPos _lzLoc),true,5,true, "move", true] call BIS_fnc_taskCreate;
taskIdsArray set [_playerno, _taskid];
_trg = createTrigger["EmptyDetector",getPos _lzLoc];
_trg = createTrigger["EmptyDetector",getPos _lzLoc];
_trg setTriggerArea[lzSize,lzSize,0,false];
_trg setTriggerActivation["WEST","PRESENT",false];
_trg setTriggerTimeout [2.5, 2.5, 2.5, true];

View File

@ -50,6 +50,7 @@ ferryingArray = [];
landingCompleteArray = [];
squadLoadedArray = [];
playersArray = [];
taskIdsArray = [];
for [{_iX = 0}, {_iX < _maxplayers}, {_iX = _iX + 1}] do
@ -61,6 +62,7 @@ for [{_iX = 0}, {_iX < _maxplayers}, {_iX = _iX + 1}] do
landingCompleteArray set [_iX, false];
squadLoadedArray set [_iX, false];
playersArray set [_iX, null];
taskIdsArray set [_iX, null];
};
publicVariable "squadMDArray";
publicVariable "enemyMDArray";
@ -68,6 +70,7 @@ publicVariable "AAMDArray";
publicVariable "ferryingArray";
publicVariable "landingCompleteArray";
publicVariable "squadLoadedArray";
publicVariable "taskIdsArray";
missionInitComplete = true;
publicVariable "missionInitComplete";

View File

@ -3,6 +3,8 @@ waitUntil {!(isNil "missionInitComplete")};
_target = _this select 0;
_playerno = _this select 1;
playersArray set [_playerno, _target];
_target addMPEventHandler ["mpkilled", {Null = _this, _playerno execVM "playerkilled.sqf";}];
diag_log format["initPlayer called, _this: %1", _this];

View File

@ -34,6 +34,8 @@ if (_squadCount > 1) then
landingCompleteArray set [_playerno, true];
publicVariable "landingCompleteArray";
[_taskid] call BIS_fnc_deleteTask;
taskIdsArray set [_playerno, null];
publicVariable "taskIdsArray";
null = [_vehiclePlayer, (_squadArray select _squadCount -1), _playerno] execVM "loadSquad.sqf";