mirror of
https://github.com/rambo/arma3_missions.git
synced 2024-08-30 16:52:13 +00:00
task cleanup on death works
This commit is contained in:
parent
2bfef953cc
commit
ad0533ea2c
@ -1,4 +1,5 @@
|
||||
//null = [(playersArray select _playerno), [positionA, positionB, positionC...], previousLocation] execVM "createObj.sqf";
|
||||
diag_log format["createObj called, _this: %1", _this];
|
||||
|
||||
waitUntil {!(isNil "missionInitComplete")};
|
||||
|
||||
@ -9,20 +10,14 @@ _prevLZ = _this select 2;
|
||||
_playerno = _this select 3;
|
||||
_player = playersArray select _playerno;
|
||||
|
||||
if (!!(taskIdsArray select _playerno)) exitWith { diag_log format["createObj: Task %1 already exists for %2", (taskIdsArray select _playerno), _playerno] };
|
||||
|
||||
|
||||
_lzLoc = (_lzLocs - [_prevLZ]) call BIS_fnc_SelectRandom;
|
||||
|
||||
diag_log format["createObj called, _target: %1, _playerno: %2, _player: %3", _target, _playerno, _player];
|
||||
|
||||
// TODO: handle the case of player crash/death, reset the task etc
|
||||
|
||||
|
||||
|
||||
//_tsk1 = (playersArray select _playerno) createSimpleTask ["NextLZ"];
|
||||
//_tsk1 setSimpleTaskDescription [format["Fly to and land within %1m of the next LZ", lzSize], "Next LZ", "LZ"];
|
||||
//_tsk1 setSimpleTaskDestination (getPos _lzLoc);
|
||||
//(playersArray select _playerno) setCurrentTask _tsk1;
|
||||
_taskid = format["p%1_lz%2", _playerno, _lzLoc];
|
||||
[west,[_taskid],[format["Player %2: Fly to and land within %1m of the LZ", lzSize, _playerno], format["p%1 LZ", _playerno], "LZ"],(getPos _lzLoc),true,5,true, "move", true] call BIS_fnc_taskCreate;
|
||||
[west,[_taskid],[format["Player %2: Fly to and land within %1m of the LZ", lzSize, _playerno], format["p%1 LZ", _playerno], "LZ"],(getPos _lzLoc),"CREATED",1,true, "move", true] call BIS_fnc_taskCreate;
|
||||
taskIdsArray set [_playerno, _taskid];
|
||||
|
||||
|
||||
|
@ -62,7 +62,7 @@ for [{_iX = 0}, {_iX < _maxplayers}, {_iX = _iX + 1}] do
|
||||
landingCompleteArray set [_iX, false];
|
||||
squadLoadedArray set [_iX, false];
|
||||
playersArray set [_iX, ""];
|
||||
taskIdsArray set [_iX, ""];
|
||||
taskIdsArray set [_iX, false];
|
||||
};
|
||||
publicVariable "squadMDArray";
|
||||
publicVariable "enemyMDArray";
|
||||
|
@ -8,9 +8,9 @@ _killhandler = compile(format["{Null = [_this, %1] execVM 'playerkilled.sqf';}",
|
||||
_spawnhandler = compile(format["{Null = [_this, %1] execVM 'playerspawn.sqf';}", _playerno]);
|
||||
|
||||
// To pass the _playerno we must compile the value into the expression instead of passing variable as pointer
|
||||
_target addEventHandler ["Killed", call _killhandler];
|
||||
//_target addEventHandler ["Killed", call _killhandler];
|
||||
_target addMPEventHandler ["MPKilled", call _killhandler];
|
||||
_target addEventHandler ["Respawn", call _spawnhandler];
|
||||
//_target addEventHandler ["Respawn", call _spawnhandler];
|
||||
_target addMPEventHandler ["MPRespawn", call _spawnhandler];
|
||||
|
||||
[[_target], _playerno] execVM "playerspawn.sqf";
|
||||
|
@ -34,7 +34,7 @@ if (_squadCount > 1) then
|
||||
landingCompleteArray set [_playerno, true];
|
||||
publicVariable "landingCompleteArray";
|
||||
[_taskid] call BIS_fnc_deleteTask;
|
||||
taskIdsArray set [_playerno, null];
|
||||
taskIdsArray set [_playerno, false];
|
||||
publicVariable "taskIdsArray";
|
||||
|
||||
|
||||
|
@ -5,7 +5,8 @@ _playerno = _this select 1;
|
||||
|
||||
_taskid = taskIdsArray select _playerno;
|
||||
null = [_taskid, "FAILED", False] spawn BIS_fnc_taskSetState;
|
||||
taskIdsArray set [_playerno, ""];
|
||||
[_taskid] call BIS_fnc_deleteTask;
|
||||
taskIdsArray set [_playerno, false];
|
||||
publicVariable "taskIdsArray";
|
||||
|
||||
_squadArray = squadMDArray select _playerno;
|
||||
|
Loading…
Reference in New Issue
Block a user