Lucky44 13 Posted July 21, 2016 This is something that I've always fudged around in the past. But I know there's a way to do it; the scripting is just beyond me. What I want to do is end a mission when ALL THE PLAYERS have reached a trigger zone, if they are in vehicles or not. I was trying to use this in the trigger's Condition Box: {vehicle _x != player} count thislist >= (west countside allunits); But I think that's counting vehicles, not players. ?? I also tried making an array of all the vehicles in the trigger zone, then counting players in the crew of the vehicles, but I think I didn't code it right. Any suggestions? Share this post Link to post Share on other sites
sarogahtyp 1104 Posted July 21, 2016 fires if all living players reached: {isPlayer _x && alive _x} count thisList == {alive _x}count (allPlayers - entities "HeadlessClient_F"); or if u dont support headless clients: {isPlayer _x && alive _x} count thisList == {alive _x} count allPlayers; Share this post Link to post Share on other sites
Lucky44 13 Posted July 21, 2016 fires if all living players reached: {isPlayer _x && alive _x} count thisList == {alive _x}count (allPlayers - entities "HeadlessClient_F"); or if u dont support headless clients: {isPlayer _x && alive _x} count thisList == {alive _x} count allPlayers; Thanks for the quick response. I appreciate seeing both approaches (HC and non-HC). I tried the non-HC one, but it doesn't work when I have two players, both in the same boat, enter the trigger zone. I think this is the central challenge: that when you have players in vehicles, it doesn't count them right in thisList. Any ideas?? Share this post Link to post Share on other sites
sarogahtyp 1104 Posted July 21, 2016 (edited) but it works if both players r on foot? edit: ensure that there is no ; sign at the end of the condition. thats a mistake. Edited July 21, 2016 by sarogahtyp Share this post Link to post Share on other sites
gc8 970 Posted July 21, 2016 I wrote this little script to do that.. hope it works for you. allPlayersInTrigger = { _list = _this; _add = { _man = _this; if(!isnull _man && !(_man in _players) && isPlayer _man) then { _players append [_man]; }; }; _players = []; { _mv = _x; if(!(_mv iskindof "man")) then { _units = (assignedCargo _mv) + (crew _mv); { _x call _add; } foreach _units; } else { _mv call _add; }; } foreach _list; //hint (str _players); ((count _players) == (count allplayers)); }; just put thislist call allPlayersInTrigger in the triggers condition field Share this post Link to post Share on other sites
sarogahtyp 1104 Posted July 21, 2016 (edited) i cant believe that players in a vehicle r not c0ntent of thisList. i think it would be noticed in the wiki already if that is the case. i didnt find a wiki entry confirming this. so i doubt that gc8s script is neccessary. but if im wrong then this should be enough: {alive _x && _x inArea thisTrigger} count allPlayers == {alive _x} count allPlayers Edited July 21, 2016 by sarogahtyp 3 Share this post Link to post Share on other sites
gc8 970 Posted July 21, 2016 i cant believe that players in a vehicle r not c0ntent of thisList. i think it would be noticed in the wiki already if that is the case. i didnt find a wiki entry confirming this. so i doubt that gc8s script is neccessary. but if im wrong then this should be enough: {alive _x && _x inArea thisTrigger} count allPlayers == {alive _x} count allPlayers that looks so much better than my code. But I would change "{alive _x} count allPlayers" simply to "count allPlayers" so that all the players would need to be in the trigger, not just alive ones. But of course the OP knows best which way he needs it.. Share this post Link to post Share on other sites
Tajin 348 Posted July 21, 2016 Ooooh, that new inArea command has somehow eluded my attention so far. Nifty! Share this post Link to post Share on other sites
Lucky44 13 Posted July 21, 2016 but it works if both players r on foot? edit: ensure that there is no ; sign at the end of the condition. thats a mistake. i cant believe that players in a vehicle r not c0ntent of thisList. i think it would be noticed in the wiki already if that is the case. i didnt find a wiki entry confirming this. so i doubt that gc8s script is neccessary. but if im wrong then this should be enough: {alive _x && _x inArea thisTrigger} count allPlayers == {alive _x} count allPlayers Test the first version for yourself if you doubt me. (BISwiki is far from perfect...) But I tried this: {alive _x && _x inArea thisTrigger} count allPlayers == {alive _x} count allPlayers and it works great. It works if I have two players in one boat or two players in two boats. And it didn't fire if only one player entered and the other was not in the trigger. Thanks very much for the help! Share this post Link to post Share on other sites