Jump to content
Sign in to follow this  
hogmason

select random array value

Recommended Posts

ok so i spawn heaps of POWs dynamically and store them in an array now i need to create intell mkrs around them

but just cant seem to select a random pow from the array to create the mkr on this is what i tried.


limit_intell = {

    _a = 0;
      while {count Intell_Marker_Array > 6} do
      {
     //hint "deleting mkrs";
        deleteMarker (Intell_Marker_Array select _a);
        Intell_Marker_Array set [_a,-1];
        Intell_Marker_Array = Intell_Marker_Array - [-1];
       };

};

Intell_Marker_Array = [];

   while {true} do
   {

   sleep 10;

//decide what POW to give intell on

     _time = [300,600] call BIS_fnc_selectRandom;
    [color="#FF0000"] _POW = POW_Array select _x;[/color]
   _dist = [100,150,200,300] call BIS_fnc_selectRandom;
   _distance = _dist;
      _dir = random 360;
      _pos = [((getPos _POW) select 0) + (sin _dir) * _dist, ((getPos _POW) select 1) + (cos _dir) * _dist, 0];	   
   //_pos = ["AO",false,["safe_zone"]] call SHK_pos;

       _intellmarker = createMarkerLocal [format ["mrk%1",random 100000], _pos];
       _intellmarker setMarkerTypeLocal "hd_unknown";
       _intellmarker setMarkerColorLocal "ColorRed";
	_intellmarker setMarkerSize [0.3,0.3];
	_intellmarker setMarkerTextLocal format["Possible POW within %1mtrs", _distance];

	Intell_Marker_Array set[(count Intell_Marker_Array), _intellmarker];

	[sgt,nil,rgroupChat,"Intell Recieved Check Map!"] call RE;

	sleep _time;

	[] call limit_intell;
};	


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  

×