macusercom 10 Posted December 28, 2014 I've been searching for 30 minutes now and nothing seems to work in ArmA 3: I want a bar gate trigger to activate only when a player in a vehicle is present. So no AI and of course it should be multiplayer compatible. I know how to do this by using all names of the playable units, but that's very inconvenient! Thanks in advance! Share this post Link to post Share on other sites
das attorney 858 Posted December 28, 2014 if (isPlayer driver NameOfTheVehicleNearTheGate) then {//do stuff}; Should do it. If you want more detail, then post some code up as I have no idea how you are calling your code. Share this post Link to post Share on other sites
macusercom 10 Posted December 28, 2014 This trigger should fire if any player in any vehicle is in the condition area. The thing you have posted only works for one single vehicle. Share this post Link to post Share on other sites
das attorney 858 Posted December 28, 2014 So iterate through the thisList magic parameter in the trigger and use the checks above. Also check the type of vehicle with isKindOf against "Car" and "Tank" so it doesn't open for men or aircraft. Share this post Link to post Share on other sites
macusercom 10 Posted December 28, 2014 Thanks! That did the trick. By using BLUFOR and "({_x isKindOf "Car"} count thisList) > 0 || ({_x isKindOf "Tank"} count thisList) > 0" together, it is now only opening when BLUFOR vehicles are nearby. With this I can place some BLUFOR guards without firing the trigger. Nice! Share this post Link to post Share on other sites
das attorney 858 Posted December 28, 2014 Good job :) As an extra, if you're doing this in MP, it might be worth scripting in the trigger on the server only as I think triggers placed via editor are placed on all machines. Something like: if (isServer) then { _trg=createTrigger["EmptyDetector",somePos]; // set the area, activation and statements here }; Share this post Link to post Share on other sites
drunken officer 18 Posted December 29, 2014 (edited) Try this. Untested code radius whatever / whatever activion: blue or red or everybody Condtion: this && (vehicle player) in thislist && vehicle player != player Act: your code Edited December 29, 2014 by Drunken Officer Share this post Link to post Share on other sites
shuko 59 Posted December 29, 2014 Try this. Untested coderadius whatever / whatever activion: blue or red or everybody Condtion: this && (vehicle player) in thislist && vehicle player != player Act: your code Never use "player" in multiplayer unless you know what you are doing. Triggers are local to each machine and not synchronized. The condition above will result the trigger firing on each machine at different times (if at all) and never on server. For MP, use playableUnits. And, you don't need "this" in trigger condition when using "thislist", because it already includes the trigger settings. Share this post Link to post Share on other sites
drunken officer 18 Posted December 29, 2014 He want to open a bargate. And in this case, you can work with player Share this post Link to post Share on other sites
killzone_kid 1333 Posted December 29, 2014 "animate" is global command, it should be triggered on one machine only, server for example, otherwise you will have every person in a vehicle trying to open it Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted December 29, 2014 (edited) See if this fits your needs: [color=#FF8040]trigger_awesome [color=#8B3E2F][b]=[/b][/color] [color=#191970][b]createTrigger[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#7A7A7A]"EmptyDetector"[/color][color=#8B3E2F][b],[/b][/color] [color=#191970][b]getPosATL[/b][/color] [color=#000000]player[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color] trigger_awesome [color=#191970][b]setTriggerArea[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#FF0000]10[/color][color=#8B3E2F][b],[/b][/color] [color=#FF0000]10[/color][color=#8B3E2F][b],[/b][/color] [color=#FF0000]0[/color][color=#8B3E2F][b],[/b][/color] [color=#000000]false[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color] trigger_awesome [color=#191970][b]setTriggerActivation[/b][/color] [color=#8B3E2F][b][[/b][/color][color=#7A7A7A]"ANY"[/color][color=#8B3E2F][b],[/b][/color] [color=#7A7A7A]"PRESENT"[/color][color=#8B3E2F][b],[/b][/color] [color=#000000]true[/color][color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color] trigger_awesome [color=#191970][b]setTriggerStatements[/b][/color] [color=#8B3E2F][b][[/b][/color] [color=#7A7A7A]" thisTrigger setVariable ['thisListPrev', +(thisTrigger getVariable ['thisList', []])]; thisTrigger setVariable ['thisList', +thisList]; this && ({if(_x isKindOf 'Car' && {driver _x == player}) exitWith {1}; false} count thisList) isEqualTo 1 && {count thisList >= count (thisTrigger getVariable 'thisListPrev')} "[/color][color=#8B3E2F][b],[/b][/color] [color=#7A7A7A]" { comment 'Do whatever for all entering units'; } forEach (thisList - (thisTrigger getVariable 'thisListPrev')); hintSilent 'entered area'; "[/color][color=#8B3E2F][b],[/b][/color] [color=#7A7A7A]" comment 'thisListPrev < thisList'; { comment 'Do whatever for all leaving units'; } forEach ((thisTrigger getVariable ['thisListPrev', []]) - (thisTrigger getVariable ['thisList', []])); hintSilent 'left area'; "[/color] [color=#8B3E2F][b]][/b][/color][color=#8B3E2F][b];[/b][/color][/color] Kudos to Killzone_Kid for his SQF to BBCode Converter. The trigger as-is will fire for each car entering the trigger area and will fire again, when the car leaves the area. So you could even manipulate the car, setVariable etc when it enters/leaves the area. This might be a bit overload for simply opening a gate, but I just had it right away, so ... yeah. But it will only fire on the machine of the client approaching/leaving the gate. As I don't know how far that's important, you could also make it fire on every client whenever a player approaches the gate. Therefore, you'd need to replace the && {driver _x == player} in the condition with && {isPlayer (driver _x)} Kind regards, Johnny Edited December 29, 2014 by Heeeere's Johnny! added some info about the trigger functionality Share this post Link to post Share on other sites