diff --git a/helotraining.Altis/createObj.sqf b/helotraining.Altis/createObj.sqf index 0b7d125..cd43d3e 100644 --- a/helotraining.Altis/createObj.sqf +++ b/helotraining.Altis/createObj.sqf @@ -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]; diff --git a/helotraining.Altis/init.sqf b/helotraining.Altis/init.sqf index 395d52c..36210e4 100644 --- a/helotraining.Altis/init.sqf +++ b/helotraining.Altis/init.sqf @@ -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"; diff --git a/helotraining.Altis/initPlayer.sqf b/helotraining.Altis/initPlayer.sqf index 6f95dc8..f637d9b 100644 --- a/helotraining.Altis/initPlayer.sqf +++ b/helotraining.Altis/initPlayer.sqf @@ -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"; diff --git a/helotraining.Altis/landingComplete.sqf b/helotraining.Altis/landingComplete.sqf index 1e32739..df4d96f 100644 --- a/helotraining.Altis/landingComplete.sqf +++ b/helotraining.Altis/landingComplete.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"; diff --git a/helotraining.Altis/playerkilled.sqf b/helotraining.Altis/playerkilled.sqf index b2a1f75..870f3f5 100644 --- a/helotraining.Altis/playerkilled.sqf +++ b/helotraining.Altis/playerkilled.sqf @@ -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;