mirror of
https://github.com/rambo/arma3_missions.git
synced 2024-08-30 16:52:13 +00:00
57 lines
2.0 KiB
Plaintext
57 lines
2.0 KiB
Plaintext
//null = [(playersArray select _playerno), [positionA, positionB, positionC...], previousLocation] execVM "createObj.sqf";
|
|
diag_log format["createObj called, _this: %1", _this];
|
|
|
|
waitUntil {!(isNil "missionInitComplete")};
|
|
|
|
|
|
_target = _this select 0;
|
|
_lzLocs = _this select 1;
|
|
_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;
|
|
|
|
|
|
_taskid = format["p%1_lz%2", _playerno, _lzLoc];
|
|
[[_player, west],[_taskid],[format["Player %2: Fly to and land within %1m of the LZ", lzSize, _playerno], format["p%1 LZ", _playerno], "LZ"],(getPos _lzLoc),"AUTOASSIGNED",1,true, "move", true] call BIS_fnc_taskCreate;
|
|
taskIdsArray set [_playerno, _taskid];
|
|
|
|
|
|
_trg = createTrigger["EmptyDetector",getPos _lzLoc, true];
|
|
_trg setTriggerArea[lzSize,lzSize,0,false];
|
|
_trg setTriggerActivation["WEST","PRESENT",false];
|
|
_trg setTriggerTimeout [2.5, 2.5, 2.5, true];
|
|
_trgaction = format["null = [thisTrigger, '%2', (playersArray select %1), %3, %4, %1] execVM 'landingComplete.sqf'", _playerno, _taskid, _lzLoc, _lzLocs];
|
|
_trgcond = "[thisList] call lzlanded";
|
|
diag_log format["LZ trigger condition: %1", _trgcond];
|
|
diag_log format["LZ trigger action: %1", _trgaction];
|
|
_trg setTriggerStatements[_trgcond, _trgaction, ""];
|
|
|
|
// TODO: delete the trigger when deleting the task on player death or similar
|
|
|
|
null = [(getPos _lzLoc), (playersArray select _playerno), _playerno] execVM 'createSquad.sqf';
|
|
|
|
//Make the LZ hot if the roll demands it
|
|
if ((random 1) < hotLZChance) then
|
|
{
|
|
null = [(getPos _lzLoc), _playerno] execVM 'enemySquad.sqf';
|
|
hintSilent "LZ is hot";
|
|
};
|
|
if ((random 1) < AAChance) then
|
|
{
|
|
null = [(getPos _lzLoc), _playerno] execVM 'AASquad.sqf';
|
|
hint "LZ has AA!";
|
|
};
|
|
|
|
landingCompleteArray set [_playerno, false];
|
|
publicVariable "landingCompleteArray";
|
|
|
|
if (bSmoke) then
|
|
{
|
|
null = [(getPos _lzLoc), _playerno] execVM 'spawnSmoke.sqf';
|
|
};
|