Jump to content
Sign in to follow this  
FederalRazer89

Trying to get a position from arrays of nearestObjects

Recommended Posts

As the title suggest i am trying to get some position from arrays of the command "nearestObjects". I want the "nearestObjects" to look for a certain amount of house, so i can identify a village or town with the script and then use the average of all the listed house in the array. That way the position i am after will not be heavily affected by one or two houses caught in the calclated radius.
 

_Center  = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");
_mapsize = (_Center select 0)*2;

_RandomStartPos      = [_Center, (_mapsize*0.77), (_mapsize*0.78), 3, 1, 20, 0] call BIS_fnc_findSafePos;
sleep 1;

player moveInCargo [_heli,5];


_enemySpawnPos = [_RandomStartPos, (_mapsize*0.7), _mapsize*0.71, 3, 0, 20, 0] call BIS_fnc_findSafePos;
createMarker ["marker2",_enemySpawnPos];
"marker2" setMarkerShape "ELLIPSE";
"marker2" setMarkerSize [500,500];
"marker2" setMarkerText "Enemy resupply line";
"marker2" setMarkerAlpha 0.5;
 
_findhouses   = nearestObjects [[((_enemySpawnPos select 0)+(_mapsize*0.2)),((_enemySpawnPos select 1)+(_mapsize*0.2))], "house"", (_mapsize*0.2)];  
_divide       = count _findhouses; 
_fortifiedpos = _findhouses/_divide;

createMarker ["marker3",_fortifiedpos];
"marker3" setMarkerShape "ELLIPSE";
"marker3" setMarkerSize [500,500];
"marker3" setMarkerText "Enemy resupply line";
"marker3" setMarkerAlpha 0.5;

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  

×