Cleanup on death, init on spawn

This commit is contained in:
Eero af Heurlin 2016-07-24 12:34:55 +03:00
parent 1856cb8842
commit d65d077f7d
3 changed files with 35 additions and 9 deletions

View File

@ -1,17 +1,11 @@
waitUntil {!(isNil "missionInitComplete")};
diag_log format["initPlayer called, _this: %1", _this];
_target = _this select 0;
_playerno = _this select 1;
playersArray set [_playerno, _target];
_target addMPEventHandler ["mpkilled", {Null = _this, _playerno execVM "playerkilled.sqf";}];
_target addMPEventHandler ["respawn", {Null = _this, _playerno execVM "playerspawn.sqf";}];
diag_log format["initPlayer called, _this: %1", _this];
ferryingArray set [_playerno, false];
landingCompleteArray set [_playerno, false];
publicVariable "ferryingArray";
publicVariable "landingCompleteArray";
null = [_target, lzList, [], _playerno] execVM "createObj.sqf";
(playersArray select _playerno) addItem "SatchelCharge_Remote_Mag";
(playersArray select _playerno) addweapon "NVGoggles";
[null, _playerno] execVM "playerspawn.sqf";

View File

@ -0,0 +1,21 @@
diag_log format["playerkilled called, _this: %1", _this];
_evt = _this select 0;
_playerno = _this select 1;
_taskid = taskIdsArray select _playerno;
null = [_taskid, "FAILED", False] spawn BIS_fnc_taskSetState;
taskIdsArray set [_playerno, null];
publicVariable "taskIdsArray";
_squadArray = squadMDArray select _playerno;
_enemyArray = enemyMDArray select _playerno;
{
[_x, "east", _playerno] execVM "deleteSquad.sqf";
} foreach _enemyArray;
publicVariable "enemyMDArray";
{
[_x, "west", _playerno] execVM "deleteSquad.sqf";
} foreach _squadArray;
publicVariable "squadMDArray";

View File

@ -0,0 +1,11 @@
diag_log format["playerspawn called, _this: %1", _this];
_evt = _this select 0;
_playerno = _this select 1;
ferryingArray set [_playerno, false];
landingCompleteArray set [_playerno, false];
publicVariable "ferryingArray";
publicVariable "landingCompleteArray";
null = [(playersArray select _playerno), lzList, [], _playerno] execVM "createObj.sqf";
(playersArray select _playerno) addItem "SatchelCharge_Remote_Mag";
(playersArray select _playerno) addweapon "NVGoggles";