Jump to content
Lorenz94

BIS_fnc_findSafePos blacklist options

Recommended Posts

Hello,

I'm trying to find n positions around a center using the command "BIS_fnc_findSafePos" and I would like to know if someone has ever successfully utilized the "advanced" blacklist settings, here in the spoiler:

Spoiler

blacklistPos (Optional): List of blacklisted areas in format [area1, area2, area3... areaN] (Default: []). Area could be one of:

Array - in format [topLeftCorner, bottomRightCorner] - top and bottom coordinates of blacklisted area

Object - trigger area

String - marker area

Location - location

Array - array in format [center, distance] or [center, [a, b, angle, rect]] or [center, [a, b, angle, rect, height]]


In particular, my interest is in blacklisting "slices" of the circle around a center. Can this be accomplished by using "[center, [a, b, angle, rect]]" as params? I tried some run of the code inside a loop, but I can't understand what these parameters do, first of all what does "rect" exactly means. If there's a way to set up triangle-shaped zones to be blacklisted it would be fine.

 

Thank you!

Share this post


Link to post
Share on other sites

A copy from my code:

 

_nspos = [_gpos, 3, 50, 0.5 , 0, 0.9, 0, _blackList] call BIS_fnc_findSafePos;
_blackList pushback [_nspos, 4];

 

what this code does it makes sure the BIS_fnc_findSafePos does not return same positions more than once. There has to be atleast 4 meters distance in the new positions returned

  • Like 3

Share this post


Link to post
Share on other sites

Yeah, thanks, but I don't need just a radius, the question is specific to a particular blacklisting option, not completely documented!

 

I would like to know what "[center, [a, b, angle, rect]]" does mean because I'm guessing is to build some kind of polygon shape, but I can't obtain what I need, that is a "slice"-shaped blacklist area.

Share this post


Link to post
Share on other sites
3 minutes ago, Lorenz94 said:

Yeah, thanks, but I don't need just a radius, the question is specific to a particular blacklisting option, not completely documented! I would like to know what "[center, [a, b, angle, rect]]" does mean because I'm guessing is to build some kind of polygon shape, but I can't obtain what I need, that is a "slice"-shaped blacklist area

 

The rect means rectangle

 

haven't used it my self so not sure

Share this post


Link to post
Share on other sites

Ok and that's what I also guessed. Is it a boolean? If true the function will do a*b? If false will be considered a triangle area? That's what I can't answer so anyone with direct experience would be appreciated!

Thanks.

Share this post


Link to post
Share on other sites
2 minutes ago, Lorenz94 said:

Is it a boolean? If true the function will do a*b? If false will be considered a triangle area?

 

Sorry I don't know but was thinking the same. My guess it's boolean for either rect or ellipse

Edited by gc8
ellipse

Share this post


Link to post
Share on other sites

It's a boolean that sets either rectangle or ellipse.

 

Clipped from my test code:

_pos = [player, 100, 1000, 2, 0, 0, 0, [[markerPos "blacklist", 250, 500, 45, false]], []] call BIS_fnc_findSafePos; 

I placed an objective marker named "blacklist." The parameters above create a 250x500 ellipse turned 45 degrees. Note that the blacklist entry is in double brackets as it is meant to be an array of arrays (a collection of positions).


1uxVUrG.png

  • Like 2

Share this post


Link to post
Share on other sites
2 hours ago, Harzach said:

It's a boolean that sets either rectangle or ellipse.

 

Clipped from my test code:


_pos = [player, 100, 1000, 2, 0, 0, 0, [[markerPos "blacklist", 250, 500, 45, false]], []] call BIS_fnc_findSafePos; 

I placed an objective marker named "blacklist." The parameters above create a 250x500 ellipse turned 45 degrees. Note that the blacklist entry is in double brackets as it is meant to be an array of arrays (a collection of positions).

Thank you Harzach,

please see what happens if I use the *suggested* syntax ([center, [a, b, angle, rect]]), so a square bracket in addition:

Spoiler

{
  if ("test_" in _x) then {
    deleteMarker _x;
  };  
} forEach allMapMarkers;

for "_i" from 1 to 10000 do {
  _pos = [player, 100, 500, 2, 0, 0, 0, [[markerPos "blacklist", [250, 500, 45, false]]], []] call BIS_fnc_findSafePos;

  _rnd = createmarker [format ["test_%1", _pos], _pos];
  _rnd setMarkerType "mil_dot";
  _rnd setMarkerColor "ColorGreen";
};

 


same code, with a larger radius: result

Share this post


Link to post
Share on other sites

Yeah, I'm seeing the same. I think it might be a mistake on the Biki. 

Share this post


Link to post
Share on other sites

This got me crazy over the afternoon 😔

 

Anyway thank you, now my code starts to work as expected.

Share this post


Link to post
Share on other sites

I see there is problem with using code with blacklist area and it is one more hope for me because I just want to use code as "default" format so without blacklist but I can't figure out how.

This is goal:  to randomly place artillery piece in big marker area but on safe flat place and in hope for do that I dropped marker "m1" and vehicle "art1"

I tried:  init.sqf:   _newpos = [m1, 1, 150, 3, 0, 20, 0] call BIS_fnc_findSafePos;    and after in game I run:   art1 setPos _newpos

I also tried with quotes because without them there is error in expression so:  _newpos = ["m1", 1, 150, 3, 0, 20, 0] call BIS_fnc_findSafePos; also does not work but this time there was not error. 

Please if anybody can help or tell me where I wrong I tried to simply follow BIS example: 

[center, minDist, maxDist, objDist, waterMode, maxGrad, shoreMode, blacklistPos, defaultPos] call BIS_fnc_findSafePos   ,but no results at all. Sorry for writting in thread older then limited but I thouth it is better then create new one just for simple thing like this (which I still cant make to work). 

So i tried to define _newpos and to run it after in game with debug but don't know where I mistake. Thanks in advance 

Share this post


Link to post
Share on other sites

newpos = [object1, 1, 500, 3, 0, 10, 0] call BIS_fnc_findSafePos; works fine. I was helped from friend on discord and this post is if someone need this where are: object1(center), 1(min distance from center), 500 (max distance from center), 3 (not closer to any other object) 0 (not in/on water), 10 (targeted gradient), 0 (not on shore).

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

×