Jump to content
Sign in to follow this  
hogmason

creating a marker on all towns using nearestLocations

Recommended Posts

ok so I need to create a marker on all towns on a map at the start of a game.

I know how to select random towns using nearestLocations but I need to select all towns and create a marker on them all.

this is how I get random town selection for a marker


_gamelogic = CENTER;
_towns = nearestLocations [getPosATL _gamelogic, ["NameVillage","NameCity","NameCityCapital"], 25000]; 
_RandomTownPosition = position (_towns select (floor (random (count _towns))));
_m = createMarker [format ["mrk%1",random 100000],_RandomTownPosition];
_m setMarkerShape "ELLIPSE";
_m setMarkerSize [500,500];
_m setMarkerBrush "Solid";
_m setMarkerAlpha 0.5;
_m setMarkerColor "ColorRed";

so how can I use this to get all towns a place a marker

Share this post


Link to post
Share on other sites

This should work:


_gamelogic = CENTER;
_towns = nearestLocations [getPosATL _gamelogic, ["NameVillage","NameCity","NameCityCapital"], 25000];
_RandomTownPosition = position (_towns select (floor (random (count _towns))));

{
   _pos = position _x;
   _m = createMarker [format ["mrk%1",random 100000],_pos];
   _m setMarkerShape "ELLIPSE";
   _m setMarkerSize [500,500];
   _m setMarkerBrush "Solid";
   _m setMarkerAlpha 0.5;
   _m setMarkerColor "ColorRed";


} forEach _towns;


Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×