From ad471edf9eed4b18ca5ed39a9f78c3881a69e320 Mon Sep 17 00:00:00 2001 From: Eero af Heurlin Date: Sun, 24 Jul 2016 16:29:32 +0300 Subject: [PATCH] fix lz landing trigger for MP --- helotraining.Altis/createObj.sqf | 9 +++++---- helotraining.Altis/description.ext | 2 +- helotraining.Altis/init.sqf | 3 +++ helotraining.Altis/lzlanded.sqf | 14 ++++++++++++++ 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 helotraining.Altis/lzlanded.sqf diff --git a/helotraining.Altis/createObj.sqf b/helotraining.Altis/createObj.sqf index cd43d3e..1ecf18a 100644 --- a/helotraining.Altis/createObj.sqf +++ b/helotraining.Altis/createObj.sqf @@ -17,20 +17,21 @@ _lzLoc = (_lzLocs - [_prevLZ]) call BIS_fnc_SelectRandom; _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),"CREATED",1,true, "move", true] call BIS_fnc_taskCreate; +[[_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]; +_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]; -_trgcond = "{ _plr = _x; _veh = vehicle _plr; if ((_plr != _veh) && (_veh in thisList) && (isTouchingGround _veh)) then { True } } forEach playableUnits; False;"; _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, ""]; +_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'; diff --git a/helotraining.Altis/description.ext b/helotraining.Altis/description.ext index 7401512..f98c5ed 100644 --- a/helotraining.Altis/description.ext +++ b/helotraining.Altis/description.ext @@ -4,7 +4,7 @@ disabledAI=1; debriefing=1; showGPS=1; Respawn = 3; -RespawnDelay = 12; +RespawnDelay = 8; RespawnDialog = 0; enabledebugconsole = 1; loadScreen = "main.jpg"; diff --git a/helotraining.Altis/init.sqf b/helotraining.Altis/init.sqf index 36210e4..a987230 100644 --- a/helotraining.Altis/init.sqf +++ b/helotraining.Altis/init.sqf @@ -1,3 +1,6 @@ +lzLanded = compile preProcessfile "lzlanded.sqf"; + + null = execVM "briefing.sqf"; _maxplayers = 4; _lzCount = 86; diff --git a/helotraining.Altis/lzlanded.sqf b/helotraining.Altis/lzlanded.sqf new file mode 100644 index 0000000..bbbbc57 --- /dev/null +++ b/helotraining.Altis/lzlanded.sqf @@ -0,0 +1,14 @@ +_triggerList = _this select 0; +_returnValue = false; + +{ + _plr = _x; + _veh = vehicle _plr; + systemChat format["_plr: %1 _veh: %2 (isTouchingGround _veh): %3 _triggerList: %4", _plr, _veh, (isTouchingGround _veh), _triggerList]; + if ( (_plr != _veh) && (isTouchingGround _veh) && (_veh in _triggerList) ) then + { + _returnValue = true; + } +} forEach playableUnits; + +_returnValue \ No newline at end of file