Jump to content
Sign in to follow this  
Valixx

Choose random position out of given markers

Recommended Posts

Hey guys. After a little break, i got a question. :/

Is it possible to get a random position out of given markers? I've placed a lot of markers on altis and they are set up like:

town_name1
town_name2
airfield_name1
airfield_name2
cap_name1
cap_name2

and so on..

If you need more information, please ask.

Share this post


Link to post
Share on other sites

_marker = ["town_name1", "town_name2", "airfield_name1", "airfield_name2", "cap_name1", "cap_name2"] call BIS_fnc_selectRandom;
player setPos getMarkerPos _marker;

If you wanted to place an objective or something at one of those places you could do this:

_tower = createVehicle ["Land_TTowerBig_1_F", getMarkerPos "town_name1", ["town_name2", "airfield_name1", "airfield_name2", "cap_name1", "cap_name2"], 0, "CAN_COLLIDE"];
missionNamespace setVariable ["tower",_tower];
publicVariable "tower";

Then you'd end up with a transmitter tower named tower at one of those markers.

Share this post


Link to post
Share on other sites

omg i'm so stupid :mad:... totally forgot the "call BIS_fnc_selectRandom" function... Thanks kylania. *ashamed*

If i got further questions, i'll ask in this thread if you don't mind.

Cheers,

Valixx

---------- Post added at 20:04 ---------- Previous post was at 19:19 ----------

Next question..

If i don't remember all of the placed markers, is there a way of getting the names? Like "getall markers starting with town_"..

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  

×