get them triggers working

This commit is contained in:
Eero af Heurlin 2016-07-24 15:09:54 +03:00
parent 2daada7110
commit 2bfef953cc
5 changed files with 12 additions and 13 deletions

View File

@ -30,7 +30,7 @@ _trg = createTrigger["EmptyDetector",getPos _lzLoc];
_trg setTriggerArea[lzSize,lzSize,0,false];
_trg setTriggerActivation["WEST","PRESENT",false];
_trg setTriggerTimeout [2.5, 2.5, 2.5, true];
_trgcond = format["(vehicle (playersArray select %1) != (playersArray select %1)) && (vehicle ((playersArray select %1)) in thislist) && (isTouchingGround (vehicle (playersArray select %1)))", _playerno];
_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];
diag_log format["LZ trigger condition: %1", _trgcond];
diag_log format["LZ trigger action: %1", _trgaction];

View File

@ -4,15 +4,13 @@ diag_log format["initPlayer called, _this: %1", _this];
_target = _this select 0;
_playerno = _this select 1;
player addEventHandler ["Killed", {Null = _this, _playerno execVM "playerkilled.sqf";}];
player addMPEventHandler ["MPKilled", {Null = _this, _playerno execVM "playerkilled.sqf";}];
player addEventHandler ["Respawn", {Null = unit, _playerno execVM "playerspawn.sqf";}];
player addMPEventHandler ["MPRespawn", {Null = unit, _playerno execVM "playerspawn.sqf";}];
_target addEventHandler ["Killed", {Null = _this, _playerno execVM "playerkilled.sqf";}];
_target addMPEventHandler ["MPKilled", {Null = _this, _playerno execVM "playerkilled.sqf";}];
_target addEventHandler ["Respawn", {Null = unit, _playerno execVM "playerspawn.sqf";}];
_target addMPEventHandler ["MPRespawn", {Null = unit, _playerno execVM "playerspawn.sqf";}];
_killhandler = compile(format["{Null = [_this, %1] execVM 'playerkilled.sqf';}", _playerno]);
_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 addMPEventHandler ["MPKilled", call _killhandler];
_target addEventHandler ["Respawn", call _spawnhandler];
_target addMPEventHandler ["MPRespawn", call _spawnhandler];
[_target, _playerno] execVM "playerspawn.sqf";
[[_target], _playerno] execVM "playerspawn.sqf";

View File

@ -8,7 +8,7 @@ class EditorData
toggles=1;
class ItemIDProvider
{
nextID=131;
nextID=132;
};
class MarkerIDProvider
{

View File

@ -1,5 +1,6 @@
diag_log format["playerkilled called, _this: %1", _this];
_evt = _this select 0;
_target = _evt select 0;
_playerno = _this select 1;
_taskid = taskIdsArray select _playerno;

View File

@ -1,5 +1,5 @@
diag_log format["playerspawn called, _this: %1", _this];
_target = _this select 0;
_target = (_this select 0) select 0;
_playerno = _this select 1;
playersArray set [_playerno, _target];