DChristy87 1 Posted August 24, 2013 As the title says, how can I activate a trigger by a players only in multiplayer? Thanks in advance! Share this post Link to post Share on other sites
bob100101 10 Posted August 24, 2013 (edited) if (isServer) exitWith {}; **EDIT** I see you needed it for a trigger, so something like !(isServer) && (something) && (something) Should work. (I've never really made triggers before, but I know the general idea of how they work) Edited August 24, 2013 by bob100101 Share this post Link to post Share on other sites
KevsNoTrev 44 Posted August 24, 2013 would it be something like count (playableunits in thislist) >0 can't remember the right order at this time. too late or early or just too drunk! Share this post Link to post Share on other sites
bob100101 10 Posted August 24, 2013 Not sure, but that sounds like it would work to me. Share this post Link to post Share on other sites
kylania 568 Posted August 24, 2013 {_x in thisList} count (playableUnits + switchableUnits) > 0 Share this post Link to post Share on other sites
DChristy87 1 Posted August 24, 2013 ahhh, Would I just leave none and none with present and condition as {_x in thisList} count (playableUnits + switchableUnits) > 0 ? Share this post Link to post Share on other sites
galzohar 31 Posted August 24, 2013 Depends what you want the trigger to do. "ANYBODY" will add to thislist any unit that gets inside the trigger. "WEST" would only add to thislist units that are on west side. NONE will add none so thislist will always be empty... The above code will then iterate over all playable and switchable units and only count those that are in thislist. https://community.bistudio.com/wiki/count Share this post Link to post Share on other sites
Larrow 2822 Posted August 27, 2013 To add to galzohar's post, As galzohar says if you were to leave the trigger as NONE thisList will be empty as its not checking for anyone but you can still use the triggers area to check for things for example playersInTrigger = []; { if ( [myTrigger, _x] call BIS_fnc_inTrigger ) then { playersInTrigger = playersInTrigger + [_x]; }; }forEach playableUnits; playersInTrigger will hold all playableUnits that are in the triggers area. A nice little up shot to this is that because inTrigger checks against a position it will also detect dead units aswell. Remember playableunits also includes any AI that are currently using a playable slot, if you only want actual players you would need to check against isPlayer aswell. Share this post Link to post Share on other sites
kylania 568 Posted August 27, 2013 Just a tip, but use playableUnits + switchableUnits to avoid everything failing in the Editor since playableUnits doesn't exist in Single Player (and therefore the editor) and you do test your missions, right? :) playableUnits returns all playable units in multiplayer and nothing in single player. switchableUnits returns all playable units in single player and nothing in multiplayer. So add them together to always know how many playable units you have in editor or multiplayer. Share this post Link to post Share on other sites
galzohar 31 Posted August 27, 2013 Well, I found it's usually best to just go straight to testing in the MP editor (multiplayer->new->create the server->open editor or edit a mission). That way you can test stuff like MP parameters and other things that work differently in multiplayer even when there is only 1 player. After that, I test with some more players, and then if all works then I PBO the mission and test on dedicated (usually my functions work fine on both, but rarely you do find out you missed something that is needed only on dedicated). Share this post Link to post Share on other sites
Doodle 10 Posted October 25, 2013 Currently in triggers I have {isPlayer _x} count thisList > 0 so trigger is only activated by human playes on our dedi server and it works fine. Now heres the bit I cant work out How would I go about so that ALL human blue playes (there is no blue ai) have to be in trigger area to activate it keeping in mind that sometimes there are three of us playing other times eight Thanks in advance Share this post Link to post Share on other sites
KevsNoTrev 44 Posted October 25, 2013 [color=#333333]{isPlayer _x} count thisList == count ( playableunits)[/color] assuming there are no enemy human players that is Share this post Link to post Share on other sites
Doodle 10 Posted October 25, 2013 Correct no human enemy - Thanks for this been bugging me for a while Share this post Link to post Share on other sites
galzohar 31 Posted October 25, 2013 Of course if you want to have human enemy you can use {isPlayer _x} count thisList == {side _x == WEST} count (playableunits) Also you need to make sure to disable the "sideEnemy" thing or your mission may break if someone does a teamkill (and teamkill punishing is fine, but breaking the mission on teamkills is not fine :P). Share this post Link to post Share on other sites
Doodle 10 Posted October 25, 2013 Can anyone help with the following - I am using this {isPlayer _x} count thisList == count ( playableunits) in triggers so all human players on dedi server have to be in trigger to "activate" it - Problem is this doesnt work in editor mode (guess cos Player doesnt exist in editor?) anyhow is there something I can add to this so it will work in editor/sp for testing? Cheers in advance Share this post Link to post Share on other sites
KevsNoTrev 44 Posted October 26, 2013 (edited) doodle check Kylania's post a few up, use switchableunits + playableunits Edited December 9, 2014 by KevsnoTrev spelling error Share this post Link to post Share on other sites
Doodle 10 Posted October 26, 2013 doodle check Kylania's post a few up, use swtichableunits + playableunits Thanks for the heads up - not tested on dedi but has solved the "not working in editor" issue I was having. Share this post Link to post Share on other sites
jandrews 116 Posted December 9, 2014 {_x in thisList} count (playableUnits + switchableUnits) > 0 for some reason this code is not working for the editor. Has something changed with ARMA? I have the trigger set up with none,none, once, present, condition: {_x in thisList} count (playableUnits + switchableUnits) > 0 Share this post Link to post Share on other sites
jshock 513 Posted December 9, 2014 for some reason this code is not working for the editor. Has something changed with ARMA?I have the trigger set up with none,none, once, present, condition: {_x in thisList} count (playableUnits + switchableUnits) > 0 thisList is defined by units that satisfy the trigger's condition/activation, right now you have it set as None, so thisList is undefined/empty, try: none, anybody, once, present, and the same condition. Share this post Link to post Share on other sites
KernelPanicAkr 13 Posted December 10, 2014 I managed to make them work (locally at least, but only with human players) using: this && (local player) && (vehicle player in thisList) Borrowed from somewhere in AltisLife code, can't remember author. Share this post Link to post Share on other sites
kromka 40 Posted March 2, 2015 Is it possible to figure out who precisely has been activated trigger? I would like to have an area which player can left and automatically save his gear. But how to check which of them (this is MP mission) just left area of trigger? Share this post Link to post Share on other sites
cyborg111 32 Posted February 9, 2016 cond = {isplayer _x && local _x} count list thistrigger > 0 expr = (name player) remoteExec ["hint",0,false]now all players and the server knows who was stealing the cookie ;) Share this post Link to post Share on other sites
cc_kronus 9 Posted June 6, 2017 On 2013-8-24 at 7:36 AM, kylania said: {_x in thisList} count (playableUnits + switchableUnits) > 0 would that work if player is being transported in a vehicle, say a medevac helicopter? Share this post Link to post Share on other sites
sarogahtyp 1108 Posted June 6, 2017 Yes it should work. For missions without AI which uses player slots (playableUnits) and without switchable slots where you only need to have current alive players to be affected I would suggest this: {alive _x and _x in thisList} count (allPlayers - entities "HeadlessClient_F"); Share this post Link to post Share on other sites
pierremgi 4886 Posted June 6, 2017 Why don't you use "any player" in the trigger activation? 1 Share this post Link to post Share on other sites