dyrmoon 21 Posted December 6, 2017 Hello, I need help with this script. I want created dynamic markers. But the condition is that new mark must not be closer (3000m) than any other markers. POS_ARRAY = [[0,0,0]]; While { (count (POS_ARRAY) <= 10) } Do { _MarkerPos = ([(GetPosWorld Player),0,100000,0,0,10,0] call BIS_fnc_findSafePos); if ({(_MarkerPos Distance (_x)) > 3000} foreach POS_ARRAY) then { POS_ARRAY pushback _MarkerPos; _marker = createMarker [str (_MarkerPos),_MarkerPos]; _marker setMarkerShape "ELLIPSE"; _marker setMarkerColor "ColorRed"; _marker setMarkerBrush "SolidBorder"; _marker setMarkerAlpha 1; _marker setMarkerSize [500,500]; }; }; After several attempts, unfortunately my script still does not work. (Do not think about logic the used function BIS_fnc_findSafePos and name marker. I have use it later (create spawn point).) The problem is that some markers sometimes intersect each other, regardless of the set distance. Do you know any other solution? Thank you for answer. Share this post Link to post Share on other sites
rebel12340 46 Posted December 7, 2017 The problem is that you have your foreach in the wrong place. Your foreach should look like this: { if (_MarkerPos Distance _x > 3000) then { POS_ARRAY pushback _MarkerPos; _marker = createMarker [str (_MarkerPos),_MarkerPos]; _marker setMarkerShape "ELLIPSE"; _marker setMarkerColor "ColorRed"; _marker setMarkerBrush "SolidBorder"; _marker setMarkerAlpha 1; _marker setMarkerSize [500,500]; }; } foreach POS_ARRAY Share this post Link to post Share on other sites
dyrmoon 21 Posted December 7, 2017 22 hours ago, rebel12340 said: The problem is that you have your foreach in the wrong place. Your foreach should look like this: Thank you for advice. But, the script still does not work. POS_ARRAY = [[0,0,0]]; { While { (count (POS_ARRAY) < 10) } Do { _PosMarker = ([(GetPosWorld Player),0,100000,0,0,10,0] call BIS_fnc_findSafePos); if ( (_PosMarker) Distance _x > 1000) then { POS_ARRAY pushBack _PosMarker; _marker = createMarker [str (_PosMarker),_PosMarker]; _marker setMarkerShape "ELLIPSE"; _marker setMarkerColor "ColorRed"; _marker setMarkerBrush "SolidBorder"; _marker setMarkerAlpha 1; _marker setMarkerSize [500,500]; }; Sleep 0.01; }; } foreach POS_ARRAY; Still some positions sometimes intersect each other, regardless of the set distance. Share this post Link to post Share on other sites
rebel12340 46 Posted December 8, 2017 I think I figured out how to accomplish what you're generally trying to do with the following code: POS_ARRAY = [[0,0,0]]; _blacklistArray = []; // Define _blacklistArray for blacklisting the area around the markers. While { (count (POS_ARRAY) <= 10) } Do { _MarkerPos = ([(GetPosWorld Player),0,100000,0,0,10,0, _blacklistArray] call BIS_fnc_findSafePos); POS_ARRAY pushback _MarkerPos; _marker = createMarker [str (_MarkerPos),_MarkerPos]; _marker setMarkerShape "ELLIPSE"; _marker setMarkerColor "ColorRed"; _marker setMarkerBrush "SolidBorder"; _marker setMarkerAlpha 1; _marker setMarkerSize [500,500]; _blacklistArray = _blacklistArray + [[_MarkerPos, 3000]]; // Add the position of the marker and the desired blacklist area around the marker (3000m in this case) to _blacklistArray. } BIS_fnc_findSafePos has an argument for blacklisted areas, so I used that to blacklist a 3000m area around the position of the marker that is created, so, the center point of each marker shouldn't be any closer than 3000m away. I also went ahead and removed the if statement and the foreach loop. Let me know if you have any problems. 1 Share this post Link to post Share on other sites
Chuc 83 Posted December 15, 2017 Is there a way to get this to make empty markers? Share this post Link to post Share on other sites
mrcurry 410 Posted December 15, 2017 5 hours ago, Chuc said: Is there a way to get this to make empty markers? If I remember right a marker is created empty by default. Replace this: On 08/12/2017 at 2:31 AM, rebel12340 said: _marker = createMarker [str (_MarkerPos),_MarkerPos]; _marker setMarkerShape "ELLIPSE"; _marker setMarkerColor "ColorRed"; _marker setMarkerBrush "SolidBorder"; _marker setMarkerAlpha 1; _marker setMarkerSize [500,500]; With: _marker = createMarker [str (_MarkerPos),_MarkerPos]; Share this post Link to post Share on other sites