Jump to content
Sign in to follow this  
hogmason

creating a marker on a town using nearestLocations with hint of selected towns name

Recommended Posts

ok so I am trying to select a random town using nearestLocations create a marker on it then give players a hint containing the selected towns name.

I found I can do it not using random like


   _position = nearestLocations [getPosATL center_pos, ["NameVillage","NameCity","NameCityCapital"], 25000];
   _town = _position select 0;

   _m = createMarker ["test",getPos _town];
   _m setMarkerShape "ELLIPSE";
   _m setMarkerSize [250,250];
   _m setMarkerBrush "Solid";
   _m setMarkerAlpha 0.7;
   _m setMarkerColor "ColorYellow";

hint parseText format["<t color=""#80FF00"">New Task At %1,",text _town];	

but when I try with random town selection it fails i.e


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

_town = _RandomTownPosition select 0;

   _m = createMarker ["test",_RandomTownPosition];
   _m setMarkerShape "ELLIPSE";
   _m setMarkerSize [250,250];
   _m setMarkerBrush "Solid";
   _m setMarkerAlpha 0.7;
   _m setMarkerColor "ColorYellow";

hint parseText format["<t color=""#80FF00"">New Task At %1",text _town];

it says type number expected string location

Share this post


Link to post
Share on other sites

I should off named it getting town name using random nearestLocations.

As that is what im trying to do

Share this post


Link to post
Share on other sites

count and such returns an integer value. Try using str to convert it to a string and see if it works.

_townmkr = str(_randomtownposition)
hint format ["%1",_townmkr];

to test. Not sure if it works.

Actually it'll just return the number in string format. Tried removing count?

Share this post


Link to post
Share on other sites

when I remove count like

_RandomTownPosition = position (_location select (floor (random (_location))));

I get this error

error random type array expected number

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  

×