Jump to content
XOSPECTRE

Create marker on random map loc

Recommended Posts

hello. I have problem to create marker on absolutely random location I can create marker but I want create it on random location on map  I use this:

 

 BLACK_SITE1 = createMarker ["BLACK_SITE1", [6859,7318,0]];
BLACK_SITE1 setMarkerType "hd_dot";
"BLACK_SITE1" setMarkerSize [0, 0];

 

and I need some number somewhere what put this marker randomly enywhere on map or at least at random distance from its created location.. 

Share this post


Link to post
Share on other sites

I try this many times its just not working … I mean I cant implement it. don't know what im doing wrong ..

 

BLACK_SITE1 = [] call BIS_fnc_randomPos;  does nothing  

Share this post


Link to post
Share on other sites
_randomPositionOnMap = [] call BIS_fnc_randomPos;

BLACK_SITE1 = createMarker ["BLACK_SITE1", _randomPositionOnMap];
BLACK_SITE1 setMarkerType "hd_dot";
BLACK_SITE1 setMarkerSize [0, 0];	//	Are you sure you want the marker to be 0 size?

- Or -

_randomPositionAroundPosition = [[[[6859,7318,0], 1500]], ["water"]] call BIS_fnc_randomPos;

BLACK_SITE1 = createMarker ["BLACK_SITE1", _randomPositionAroundPosition];
BLACK_SITE1 setMarkerType "hd_dot";
BLACK_SITE1 setMarkerSize [0, 0];	//	Are you sure you want the marker to be 0 size?

 

Edited by Maff
I always miss out brackets in the second example. Always!
  • Like 2

Share this post


Link to post
Share on other sites

For an absolutely random position as stated in the first post one could use something like this:

_rndMapPos = [(worldSize / 2),(worldSize / 2),0] getPos [random (worldSize / 2) * 1.4142,random 360];

//simple test
for "_i" from 1 to 100 do {
	_rndMapPos = [(worldSize / 2),(worldSize / 2),0] getPos [random ((worldSize / 2) * 1.4142),random 360];
	_markerstr = createMarker [str _rndMapPos, _rndMapPos];
	_markerstr setMarkerShape "ICON";
	_markerstr setMarkerType "mil_dot" ;
};

Again, this will return a position that can be anywhere on the map, can be on water, far away from any landmass etc.

 

Cheers

  • Like 2

Share this post


Link to post
Share on other sites

Thank you so much guys  really appreciate your help. Sometimes I just don't understand scripting 

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

×