Jump to content
MiB_rus

Array in blacklist of BIS_fnc_randomPos

Recommended Posts

I am trying to use array in blacklist of BIS_fnc_randomPos.

In array all Towns of map.

My task: to make spawn everywhere, except for the area of cities.

towns = (nearestLocations [[worldSize / 2, worldsize / 2, 0], ["NameCity", "NameVillage", "NameCityCapital"], worldSize]);
townsPosSize = [];
{
	townsPosSize pushBack [(locationPosition _x select 0), (locationPosition _x select 1), ((size _x) select 0)*3];

   _name = format["mrk_%1", text _x];
   _foo = createmarker [_name, [locationPosition _x select 0, locationPosition _x select 1]];
   _foo setMarkerSize [((size _x) select 0)*3, ((size _x) select 0)*3];
   _foo setMarkerShape "ELLIPSE";
   _foo setMarkerBrush "SOLID";
   _foo setMarkerColor "ColorRed";
} forEach towns;

//test
for "_i" from 1 To 200 do {
	_newPosTest = [nil, [townsPosSize,"water", [getPos player, 600]]] call BIS_fnc_randomPos;
   _nameT = format["mrk_%1", _i];
   _fooT = createmarker [_nameT, _newPosTest];
   _fooT setMarkerType "hd_dot";
   _fooT setMarkerColor "ColorGreen";
};

But the function BIS_fnc_randomPos ignores this (area of cities).

 

I also tried

_newPosTest = [nil, [towns,"water"]] call BIS_fnc_randomPos;

But the result is the same. "water"  - works, towns - not works.

Share this post


Link to post
Share on other sites

I could never make it work either. I do remember reading ages ago that I was doing something wrong, but I don't remember exactly what.

Share this post


Link to post
Share on other sites

The code itself works fine, you just have corrupted characters.

58UJygm.png

 

Copy/paste into a code block as in my screenshot above, delete the red dots, then copy/paste that edited code into your script or whatever.

 

wkFjFWS.jpg

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites

It's just a question about how you build your blacklist. Try:

 

towns = (nearestLocations [[worldSize / 2, worldsize / 2, 0], ["NameCity", "NameVillage", "NameCityCapital"], worldSize]);
townsPosSize = ["water",[getpos player,600]];
{
 townsPosSize pushBack [[(locationPosition _x)#0,(locationPosition _x)#1],((size _x)#0)*3];
 

   _name = format["mrk_%1", text _x];
   _foo = createmarker [_name, [locationPosition _x select 0, locationPosition _x select 1]];
   _foo setMarkerSize [((size _x) select 0)*3, ((size _x) select 0)*3];
   _foo setMarkerShape "ELLIPSE";
   _foo setMarkerBrush "SOLID";
   _foo setMarkerColor "ColorRed";
} forEach towns;
 for "_i" from 1 To 200 do {
 _newPosTest = [nil, townsPosSize] call BIS_fnc_randomPos;
   _nameT = format["mrk_%1", _i];
   _fooT = createmarker [_nameT, _newPosTest];
   _fooT setMarkerType "hd_dot";
   _fooT setMarkerColor "ColorGreen";
};

  • Like 3

Share this post


Link to post
Share on other sites

Yeah, I'm not firing on all cylinders lately and completely misunderstood the problem. @pierremgi's code works.

  • Like 2

Share this post


Link to post
Share on other sites

how could I whitelist the townsPosSize with the same @pierremgi script?

tried switching their place at the randomPos call but it gives me the error: 2 elements provided, 3 expected

Share this post


Link to post
Share on other sites

In the code above, townsposSize is a variable (array) with all locations like ["NameCity", "NameVillage", "NameCityCapital"]
Feel free to add or subtract existing location types for Arma3 . I mean existing on map... Not sure you can find a strongPointArea on Stratis, for example.

 

For their positions, always use locationPosition and setPosition .... Not tested on existing locations. You can create your own locations.

 

 

Share this post


Link to post
Share on other sites
3 hours ago, pierremgi said:

Not tested on existing locations.

From memory( and I don't think it was ever changed ) vanilla locations are the name tag for the location on the map and not the actually town/city etc itself. Which makes them worthless as town/city area definitions.

 

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

×