__d0ct0r__ 0 Posted August 4, 2020 I am making a multiplayer mission. In this mission, I need to count the number of players in an area (inside of a circle marker). Could someone inform me how I can do this. Many thanks. Share this post Link to post Share on other sites
Tankbuster 1733 Posted August 4, 2020 _playerswithincircle = allplayers select { (_x distance2d _centreposofmycircle) < _radiusofmycircle }; 2 Share this post Link to post Share on other sites
Harzach 2507 Posted August 4, 2020 Tanky's solution also works to get players with a radius of a position/object/etc. If you are working with other shapes of markers/triggers, use inArea: //marker _playersInArea = allplayers select {_x inArea "markerName"}; //trigger _playersInArea = allplayers select {_x inArea triggerName}; 3 Share this post Link to post Share on other sites
Tankbuster 1733 Posted August 4, 2020 Or, if the players are all west and no other west units will be there... _playerswithincircle = (_centreposofmycircle nearentities ["SoldierWB", _radiusofmycircle]) Note this method won't get deads or mounteds. 2 Share this post Link to post Share on other sites
Harzach 2507 Posted August 4, 2020 Lots of options, depending on case! Share this post Link to post Share on other sites
Tankbuster 1733 Posted August 4, 2020 Just now, Harzach said: Lots of options, depending on case! Yes. I've run them all of them through the debug timer thingy, there wasn't an appreciable difference in CPU cost. Share this post Link to post Share on other sites
pierremgi 4739 Posted August 4, 2020 you can even use inArea without marker or trigger, just your data of area... or even: allPlayers inAreaArray location_1; or the forgotten but very nice: position inPolygon polygon 2 Share this post Link to post Share on other sites
Janez 507 Posted August 4, 2020 Hah, I love it, just like the good old days. 3 Share this post Link to post Share on other sites