Jump to content
linuxmaster9

Looking for a script that finds building names

Recommended Posts

I am looking for a script that scans the terrain and outputs the results to the RPT or clipboard. It would list all the building names. I need it for loot spawn systems. Im using the Lingor A3 terrain.

 

Maybe something that automates this:

typeof BIS_fnc_camera_target?
  • Like 1

Share this post


Link to post
Share on other sites

Well you could have searched for like 10 of these results, but here is the code for your unit (just point and click):

player addAction ["House to RPT", {diag_log format ["Building: %1", typeOf cursorTarget]; hint format ["%1 Saved!", typeOf cursorTarget]}];

Share this post


Link to post
Share on other sites

yeah, i saw several like that but as far as I can tell, you have to look at each and every building to do that. I want a script that I can run that will scan the map and post the building names to the RPT or clipboard or sqf file.

Share this post


Link to post
Share on other sites

that and there is the issue that some buildings dont show a class name. They just give me the "" and no classname.

  • Like 1

Share this post


Link to post
Share on other sites

You could try something like this, I'm not sure if it works, and it probably isn't very efficient overall, but it is a one and done deal so...:

_buildingClasses = [];
_trackerVar = 0;//just so you can see progression of the script, as well as how many classnames there are in the end
_buildings = nearestObjects [[0,0,0],["Building"],(worldSize/2)];

{
	if !(typeOf _x in _buildingClasses) then
	{
		_buildingClasses pushBack (typeOf _x);
		_trackerVar = _trackerVar + 1;
	};
	hintSilent str(_trackerVar);
} forEach _buildings;

diag_log str(_buildingClasses);//rpt
copyToClipboard str(_buildingClasses);//clipboard

hintC format ["Building Search Complete. Buildings Found: %1",count _buildingClasses];
  • Like 2

Share this post


Link to post
Share on other sites

that and there is the issue that some buildings dont show a class name. They just give me the "" and no classname.

 

That is because the item is either a classless object (e.g. vegetation and rocks) or it was given no class when placed in the Map Builder. 

 

 

Haven't tested the below, but try it in your mission. :) (But take note that this process will take some time. After that it should all be populated in your .RPT)

//init.sqf or unit's init
player addAction ["Populate RPT", "search.sqf"];

//search.sqf
buildings = [];
Houselist = nearestObjects [player, ["House_F"], (worldSize / 2)];
{
	_houseClass = typeOf _x;
	HouseExists = false;
	//Check
	for "_i" from 0 To (count buildings) - 1 do {
		_index = (buildings select _i);
		_selClass = typeOf _index;
		if (_houseClass isEqualTo _selClass) exitWith {HouseExists = true};
	};
	if (!HouseExists) then {diag_log format ["Building Classname: %1", _houseClass]; buildings = buildings + _houseClass};
} forEach Houselist;

hint "Search Complete!";

 

 

EDIT: Darn, too late again. Well just try both examples to see if you can find what you were after. :D

  • Like 1

Share this post


Link to post
Share on other sites


21:03:53 "Building Classname: Land_Lampa_ind"

21:03:53 Error in expression <1", _houseClass]; buildings = buildings + _houseClass};

} forEach Houselist;

hi>

21:03:53   Error position: <+ _houseClass};

} forEach Houselist;

hi>

21:03:53   Error Generic error in expression

21:03:53 File missions\testcrash.lingor3\search.sqf, line 12

Share this post


Link to post
Share on other sites

 

You could try something like this, I'm not sure if it works, and it probably isn't very efficient overall, but it is a one and done deal so...:

_buildingClasses = [];
_trackerVar = 0;//just so you can see progression of the script, as well as how many classnames there are in the end
_buildings = nearestObjects [[0,0,0],["Building"],(worldSize/2)];

{
	if !(typeOf _x in _buildingClasses) then
	{
		_buildingClasses pushBack (typeOf _x);
		_trackerVar = _trackerVar + 1;
	};
	hintSilent str(_trackerVar);
} forEach _buildings;

diag_log str(_buildingClasses);//rpt
copyToClipboard str(_buildingClasses);//clipboard

hintC format ["Building Search Complete. Buildings Found: %1",count _buildingClasses];

This one seems to have done something. It said it found 162 buildings.

 

Here is what it found:

["Land_House_C_5_V3_EP1","Land_House_C_2_EP1","Land_House_C_1_EP1","Land_House_K_3_EP1","Land_House_C_5_V2_EP1","Land_House_C_5_EP1","Land_House_C_4_EP1","Land_Army_hut2_int","Land_Army_hut3_long_int","Land_Garaz_bez_tanku","Land_Zed_dira_civil","Land_House_C_5_V1_EP1","Land_Kulna","Land_House_C_12_EP1","Land_House_C_11_EP1","Land_House_L_8_EP1","Land_House_K_8_EP1","Land_House_L_3_EP1","Land_House_L_6_EP1","Land_A_GeneralStore_01a","Land_House_K_1_EP1","Land_Lampa_ind","Land_House_L_4_EP1","Land_Shed_wooden","Land_Shed_M01","Land_Brana02nodoor","Land_Ind_Garage01","Land_ibr_FuelStation_Build","Land_Shed_W02","Land_Ind_Shed_01_EP1","Land_ibr_FuelStation_Feed","Land_ibr_FuelStation_Shed","Land_Shed_M03","Land_House_K_6_EP1","Land_Ind_Workshop01_01","Land_Shed_W01","Land_R_HouseV2_01A","Land_Hut06","Land_Wall_L1_gate_EP1","Land_Nav_Boathouse_PierL","Land_Misc_Well_L_EP1","Land_MBG_Police_Station","Land_ibrhotel","Land_Kontejner","Land_House_C_1_v2_EP1","Land_Ind_Workshop01_04","Land_Hangar_2","LAND_ibr_bank","Land_Misc_Cargo1B","Land_Nasypka","Land_Misc_Cargo1C","Land_Ind_Shed_01_end","Land_Ind_Shed_01_main","Land_Ind_BoardsPack1","Land_Ind_BoardsPack2","Land_Tovarna2","Land_House_C_3_EP1","Land_ibrPanelak","Land_Misc_Cargo2D","Land_BoatSmall_1","Land_Misc_Cargo2B","Land_A_Pub_01","Land_A_statue01","Land_Hlidac_budka","Land_Misc_Cargo1D","Land_House_C_10_EP1","Land_House_C_9_EP1","Land_a_stationhouse","Land_House_L_7_EP1","Land_Wall_CBrk_5_D","Land_Telek1","Land_House_K_7_EP1","Land_Army_hut_int","Land_Market_stalls_01_EP1","Land_Budova4_in","Land_Ind_Workshop01_L","Land_CncBlock","Land_GuardShed","Land_Tovarna1","Land_water_tank","Land_Shed_Ind02","Land_ibrPanelak2","Land_HouseV2_02_Interier","Land_Shed_W4","land_nav_pier_m_end","Land_Bouda_plech","Land_Fuelstation","land_nav_pier_m_1","Land_ibrPanelak3","Land_Sara_Domek_sedy","land_nav_pier_c_t15","Land_PowLines_ConcL","Land_Shed_W03","land_nav_pier_F_17","land_nav_pier_C_R","Land_Dum_mesto_in","Land_HouseV_2I","land_nav_pier_c","Land_Ind_Shed_02_EP1","Land_A_BuildingWIP","Land_House_K_5_EP1","Land_Church_05R","Land_Hut02","Land_Army_hut_storrage","Land_Kostelik","Land_Hut01","Land_Hut03","Land_Hut04","Land_House_L_1_EP1","Land_House_L_9_EP1","Land_Misc_PowerStation","Land_Ind_Oil_Tower_EP1","Land_Misc_WaterStation","Land_Ind_SawMillPen","Land_Posed","Land_Misc_Well_C_EP1","Land_A_Castle_Bastion","Land_Ind_Workshop01_02","Land_Barn_Metal","Land_Ind_TankBig","Land_Misc_Cargo2C","Land_Ind_Workshop01_03","Land_Fuelstation_army","Land_A_Hospital","Land_HouseV2_03","Land_Farm_Cowshed_c","Land_Farm_Cowshed_b","land_nav_pier_c_90","Land_Farm_Cowshed_a","Land_Majak2","Land_Dum_istan3_pumpa","Land_A_Crane_02b","Land_A_Crane_02a","Land_Mil_Barracks_i","Land_Ind_Vysypka","Land_Trafostanica_mala","Land_Trafostanica_velka","Land_Budova2","Land_Misc_deerstand","Land_Stodola_old_open","Land_Ss_hangar","Land_Molo_drevo_bs","Land_A_Office01_EP1","Land_Nav_Boathouse","Land_Mil_ControlTower","Land_Nav_Boathouse_PierT","Land_Garaz_mala","Land_HouseV_3I2","Land_Dum_istan3_hromada2","Land_MBG_FlatOne_W","Land_MBG_Stands","Land_TentHangar_V1_F","Land_Runway_PAPI","Land_A_Castle_Wall1_20","Land_A_Castle_Bergfrit_dam","land_bouda_garaz","Land_Church_02","Land_houseV_2T1","Land_ruin_01","Land_Market_stalls_02_EP1","Land_Shed_W02_EP1","Land_Kostel_trosky"]
  • Like 1

Share this post


Link to post
Share on other sites
21:03:53 "Building Classname: Land_Lampa_ind"
21:03:53 Error in expression <1", _houseClass]; buildings = buildings + _houseClass};
} forEach Houselist;

hi>
21:03:53   Error position: <+ _houseClass};
} forEach Houselist;

hi>
21:03:53   Error Generic error in expression
21:03:53 File missions\testcrash.lingor3\search.sqf, line 12

 

Try this:

//init.sqf or unit's init
player addAction ["Populate RPT", "search.sqf"];

//search.sqf
buildings = [];
Houselist = nearestObjects [player, ["House_F"], (worldSize / 2)];
{
	_houseClass = typeOf _x;
	HouseExists = false;
	//Check
	for "_i" from 0 To (count buildings) - 1 do {
		_index = (buildings select _i);
		_selHouse = str _houseClass;
		if (_houseClass isEqualTo _index) exitWith {HouseExists = true};
	};
	if (!HouseExists) then {diag_log format ["Building Classname: %1", _houseClass]; buildings = buildings + str _houseClass};
} forEach Houselist;

hint "Search Complete!";

EDIT: Made some changes.

Share this post


Link to post
Share on other sites

Here is a small update to it, to check for any that return "", and it will place a marker on that position, so you can visually see where and what it is so possibly you can find the classname elsewhere:

_buildingClasses = [];
_trackerVar = 0;//just so you can see progression of the script, as well as how many classnames there are in the end
_unknown = 0;
_buildings = nearestObjects [[0,0,0],["Building"],(worldSize/2)];

{
	if !(typeOf _x in _buildingClasses) then
	{
		_buildingClasses pushBack (typeOf _x);
		_trackerVar = _trackerVar + 1;
	};
	if (typeOf _x == "") then
	{
		_unknown = _unknown + 1;
		_mrk = createMarker [format["building%1",_forEachIndex],(getPos _x)];
		_mrk setMarkerShape "ICON";
		_mrk setMarkerColor "ColorBlack";
		_mrk setMarkerType "hd_dot";
	};
	hintSilent str(_trackerVar);
} forEach _buildings;

diag_log str(_buildingClasses);//rpt
copyToClipboard str(_buildingClasses);//clipboard

hintC format ["Building Search Complete. Buildings Found: %1\nUnknown Found: %2",_trackerVar,_unknown];
  • Like 2

Share this post


Link to post
Share on other sites

now I just have to sort through these classnames and figure out what category each falls into: Civilian, Military, Industrial, or Research.

 

Im currently using the Na Palm Lootspawn script. I wish I had a better one though.

Share this post


Link to post
Share on other sites

h = [] spawn {

_buildingsInfo = [];

_mapRadius = worldSize / 2;

_mapCenter = [ _mapRadius, _mapRadius ];

_found = nearestObjects [ _mapCenter, ["Building"], _mapRadius * 1.4142 ];

{

if( isClass( configFile >> "CfgVehicles" >> typeOf _x ) && ( _x call BIS_fnc_isBuildingEnterable ) ) then {

_buildingCat = getText( configFile >> "CfgVehicles" >> typeOf _x >> "vehicleClass" );

_data = _buildingsInfo;

{

systemChat format[ "Finding - %1", _x ];

_index = _data find _x;

if( _index isEqualTo -1 ) then {

_index = _data pushBack _x;

_nul = _data pushBack []

};

_data = _data select ( _index + 1 );

}forEach [ _buildingCat, typeOf _x ];

_buildingPos = if( productVersion select 2 > 154 && productVersion select 3 >= 133934 ) then {

count ( _x buildingPos -1 )

}else{

_pos = 0;

while { true } do {

if ( _x buildingPos _pos isEqualTo [0,0,0] ) exitWith { _pos };

_pos = _pos + 1;

};

};

_data pushBack [

getPosATL _x,

_buildingPos,

getNumber( configFile >> "CfgVehicles" >> typeOf _x >> "numberOfWindows" ),

getNumber( configFile >> "CfgVehicles" >> typeOf _x >> "numberOfDoors" )

];

_mrk = createMarker [ str getPosATL _x, getPosATL _x ];

_mrk setMarkerShape "RECTANGLE";

_mrk setMarkerSize [ 2, 2 ];

_mrk setMarkerColor "ColorRed";

};

_red = linearConversion[ 0, count _found, _forEachIndex, 255, 0, true ];

_green = linearConversion[ 0, count _found, _forEachIndex, 0, 255, true ];

_hex = [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F" ];

_red = format[ "%1%2", ( _hex select floor ( _red / 16 ) ) , ( _hex select ( _red % 16 ) ) ];

_green = format[ "%1%2", ( _hex select floor ( _green / 16 ) ) , ( _hex select ( _green % 16 ) ) ];

hintSilent parseText format[ "Working<br /><t color='#%2%3%4'>.%1</t>", ( "........................." select [ 0, _forEachIndex % 25 ] ), _red, _green, "00" ];

} forEach _found;

comment "copyToClipboard str _buildingsInfo;";

hintSilent "Please wait formatting to clipboard";

_info = format[ '/*"Editor Class"%1"Building Class"%2[ postion, num building positions, num windows, num doors ]*/', toString[ 13, 09 ], toString[ 13, 09, 09 ] ];

_info = format[ "%1%2[", _info, toString[ 13 ] ];

for "_c" from 0 to ( count _buildingsInfo ) -1 step 2 do {

_info = formatText[ "%1%2%3,%4[", _info, toString [ 13, 09 ], str ( _buildingsInfo select _c ), toString [ 13, 09 ] ];

for "_t" from 0 to ( count ( _buildingsInfo select ( _c + 1 ))) -1 step 2 do {

_info = formatText[ "%1%2%3,%4[", _info, toString [ 13, 09, 09 ], str ( _buildingsInfo select ( _c + 1 ) select _t ), toString [ 13, 09, 09 ] ];

{

_info = formatText[ "%1%2%3", _info, toString [ 13, 09, 09, 09 ], _x ];

if ( _forEachIndex < ( count( ( _buildingsInfo select (_c+1 ) ) select ( _t+1 ) ) -1 ) ) then {

_info = formatText[ "%1,", _info ];

};

}forEach ( ( _buildingsInfo select ( _c + 1 )) select ( _t + 1 ) );

_info = formatText[ "%1%2]", _info, toString[ 13, 09, 09 ] ];

if ( _t < ( count( _buildingsInfo select (_c+1 ) ) -2 ) ) then {

_info = formatText[ "%1,", _info ];

};

};

_info = formatText[ "%1%2]", _info, toString[ 13, 09 ] ];

if ( _c < (( count _buildingsInfo ) -2 ) ) then {

_info = formatText[ "%1,", _info ];

};

};

_info = formatText[ "%1%2];", _info, toString[ 13 ] ];

hint "Done";

copyToClipboard str _info;

};

Just run it from the debug console when previewing the map you want building info from.
  • Like 2

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

×