Jump to content
emton

Positions in an array?

Recommended Posts

Hey can I have a list of positions that look like this

 

[8675,10225,575]

[13875,8400,400]

[9425,4050,350]

 

In an array?

And then maybe even choose one randomly with

 

_random = selectRandom _array;

 

so I guess like

 

_posArray = [[8675,10225,575],[13875,8400,400],[9425,4050,350]];

_pos = selectRandom _posArray;

 

Or will that not be working too good? Sorry if I've made you spit your drink out because of this noobie question. Edit: Oh I edited it to have more bracket things, I'm gonna try this and see if it works....  .. .

Share this post


Link to post
Share on other sites

You literally have answered your own question. Next time run that through debug before running it through the forums :)

  • Like 1

Share this post


Link to post
Share on other sites

How about this one

 

later on in the script (I'm just haxoring this script to work how I want I'm a noob script kidd, just reminding you)

 

 

 

// Create Markers
_markers =
[
    _pos,
    _missionName,
    _difficulty
] call DMS_fnc_CreateMarker;

(_markers select 1) setMarkerSize [500,500];

 

 

 

Instead of setting 500m for every one I want it to grab the size from the position (in the above array). To me that's just mind boggling where would I begin??

Share this post


Link to post
Share on other sites

OK now I get it. Your positions consist of a x- and a y-coordinate and the last entry is the size you want the marker to have.

Then:

_posArray = [[8675,10225,575],[13875,8400,400],[9425,4050,350]];

_size= (selectRandom _posArray) select 2;

/* if you want to use the same position

/ _pos = selectRandom _posArray;

/ _size = _pos select 2;

*/

This fetches the third entry of your randomly selected position array.

And now :

// code

(_markers select 1) setMarkerSize [_size, _size];

Hope I got your question right.

  • Like 1

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

×