Jump to content
Sign in to follow this  
READTHESCROLL

Find all buildings with positions on the map?

Recommended Posts

Hey guys, I was wondering if there is a script out there that can find all the buildings placed on the map and (sans doubles) relay the building positions back into the RPT or something similar. Thanks!

Share this post


Link to post
Share on other sites
_allBuildings = [0,0,0] nearObjects ["Building", 50000];
	
{

	diag_log (getPosATL _x);
		
	sleep 0.1; //may not be needed, you decide

} forEach _allBuildings;

It may take a while to complete. Writing to the log may be a problem, depending on how many buildings the island has.

Share this post


Link to post
Share on other sites

I wrote that once for a single use and thought I would never use it again, but here you go:

//Get all buildings on an Island (also catches editor placed (or spawned via script) buildings).
private ["_toClipboard","_toLogfile","_start","_mapSize","_center","_radius","_buildings"];
_toClipboard = false;
_toLogfile = true;
_start = diag_tickTime;
_mapSize = getNumber(configFile >> "CfgWorlds" >> worldName >> "MapSize");
_center = [(_mapSize/2), (_mapSize/2), 0];
_radius = [0,0,0] distance _center;
_buildings = [];
if(_toLogfile)then{diag_log format["##### Building list for Island %1 #####", str worldName]}; 	
{
	if(_toLogfile)then{diag_log format["%1 : %2",typeOf _x, getPos _x]};
	_buildings pushBack [typeOf _x, getPos _x];
}forEach (_center nearObjects ["Building", _radius]);
if(_toClipboard)then{copyToClipboard str _buildings};
hint format["\nIsland: %1\n\nBuildings: %2\nWritten to logfile: %3\nSaved to Clipboard: %4\nProcessing Time: %5",
worldName, count _buildings, if(_toLogfile)then[{"Yes"},{"No"}], if(_toClipboard)then[{"Yes"},{"No"}], diag_tickTime - _start];

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  

×