Jump to content
Sign in to follow this  
hogmason

clear marker array & marker text via variable

Recommended Posts

hi guys i have done a little script to create random false intell markers on a map all works fine but i need to delete the intell markers once

it reaches a set amount so i dont crowed the map to do this i have used


    _limit = count Intell_Marker_Array;	
  if (_limit > 3) then 
     {
       {deleteMarker _x} forEach Intell_Marker_Array;
     };

which works fine but it does not clear the markers in the array only on the map so every time a new marker is created the code still thinks there are over 3 markers so it deletes them again.

so i guess i need to know how to clear an array

this is how i do my array


Intell_Marker_Array = [];

// to add a marker i use this after i create the marker
Intell_Marker_Array set[(count Intell_Marker_Array), _intellmarker];

////////////////////////////////////////////////////////////////////////////////////////

Also how can i add txt to the marker that is a distance to an object this is what i tried but does not work

      [color="#FF0000"]_distance = random 1500;[/color]

	    [color="#FF0000"]_intellmarker setMarkerTextLocal [_distance];[/color]

Share this post


Link to post
Share on other sites

Have you tried

  if (_limit > 3) then 
     {
       {deleteMarker _x} forEach Intell_Marker_Array;
         Intell_Marker_Array = [];
     };

Share this post


Link to post
Share on other sites

lmao the only thing i diddnt think off cheers mate ill try that

Share this post


Link to post
Share on other sites

If you instead do not want to actually clear the array, but limit the number. You could do this...

_a = 0;
while {count Intell_Marker_Array > 3} do
{
  deleteMarker (Intell_Marker_Array select _a);
  Intell_Marker_Array set [_a,-1];
  Intell_Marker_Array = Intell_Marker_Array - [-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
Sign in to follow this  

×