Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ArmA3 - mark nearby buildingPos on map
// Find nearby buildings with buildingPositions in them, and mark valid building positions on the map
private ["_radius", "_types"];
_radius = 2500;
_types = ["Land_Airport_left_F",
"Land_Airport_right_F",
"Land_Airport_Tower_dam_F",
"Land_Airport_Tower_F",
"Land_cargo_house_slum_F",
"Land_Cargo_House_V1_F",
"Land_Cargo_House_V2_F",
"Land_Cargo_House_V3_F",
"Land_Cargo_HQ_V1_F",
"Land_Cargo_HQ_V2_F",
"Land_Cargo_HQ_V3_F",
"Land_Cargo_Patrol_V1_F",
"Land_Cargo_Patrol_V2_F",
"Land_Cargo_Patrol_V3_F",
"Land_Cargo_Tower_V1_F",
"Land_Cargo_Tower_V3_F",
"Land_CarService_F",
"Land_Chapel_Small_V1_F",
"Land_Chapel_Small_V2_F",
"Land_Chapel_V1_F",
"Land_Chapel_V2_F",
"Land_Crane_F",
"Land_dp_bigTank_F",
"Land_dp_mainFactory_F",
"Land_d_Stone_Shed_V1_F",
"Land_d_Windmill01_F",
"Land_FuelStation_Build_F",
"Land_FuelStation_Shed_F",
"Land_Hangar_F",
"Land_Hospital_main_F",
"Land_Hospital_side1_F",
"Land_Hospital_side2_F",
"Land_i_Addon_02_V1_F",
"Land_i_Addon_03mid_V1_F",
"Land_i_Addon_03_V1_F",
"Land_i_Addon_04_V1_F",
"Land_i_Barracks_V1_F",
"Land_i_Barracks_V2_F",
"Land_i_Garage_V1_F",
"Land_i_Garage_V2_F",
"Land_i_House_Big_01_V1_dam_F",
"Land_i_House_Big_01_V1_F",
"Land_i_House_Big_01_V2_F",
"Land_i_House_Big_01_V3_F",
"Land_i_House_Big_02_V1_dam_F",
"Land_i_House_Big_02_V1_F",
"Land_i_House_Big_02_V2_F",
"Land_i_House_Big_02_V3_F",
"Land_i_House_Small_01_V1_dam_F",
"Land_i_House_Small_01_V1_F",
"Land_i_House_Small_01_V2_dam_F",
"Land_i_House_Small_01_V2_F",
"Land_i_House_Small_01_V3_F",
"Land_i_House_Small_02_V1_dam_F",
"Land_i_House_Small_02_V1_F",
"Land_i_House_Small_02_V2_F",
"Land_i_House_Small_02_V3_F",
"Land_i_House_Small_03_V1_dam_F",
"Land_i_House_Small_03_V1_F",
"Land_i_Shed_Ind_F",
"Land_i_Shop_01_V1_dam_F",
"Land_i_Shop_01_V1_F",
"Land_i_Shop_01_V2_F",
"Land_i_Shop_01_V3_F",
"Land_i_Shop_02_V1_dam_F",
"Land_i_Shop_02_V1_F",
"Land_i_Shop_02_V2_F",
"Land_i_Shop_02_V3_F",
"Land_i_Stone_HouseBig_V1_dam_F",
"Land_i_Stone_HouseBig_V1_F",
"Land_i_Stone_HouseBig_V2_F",
"Land_i_Stone_HouseBig_V3_F",
"Land_i_Stone_HouseSmall_V1_dam_F",
"Land_i_Stone_HouseSmall_V1_F",
"Land_i_Stone_HouseSmall_V2_F",
"Land_i_Stone_HouseSmall_V3_F",
"Land_i_Stone_Shed_V1_dam_F",
"Land_i_Stone_Shed_V1_F",
"Land_i_Stone_Shed_V2_F",
"Land_i_Stone_Shed_V3_F",
"Land_i_Windmill01_F",
"Land_LightHouse_F",
"Land_Lighthouse_small_F",
"Land_Metal_Shed_F",
"Land_MilOffices_V1_F",
"Land_Offices_01_V1_F",
"Land_Radar_F",
"Land_Research_house_V1_F",
"Land_Research_HQ_F",
"Land_Slum_House01_F",
"Land_Slum_House02_F",
"Land_Slum_House03_F",
"Land_spp_Tower_F",
"Land_Unfinished_Building_01_F",
"Land_Unfinished_Building_02_F",
"Land_u_Addon_01_V1_F",
"Land_u_Addon_02_V1_F",
"Land_u_Barracks_V2_F",
"Land_u_House_Big_01_V1_F",
"Land_u_House_Big_02_V1_F",
"Land_u_House_Small_01_V1_dam_F",
"Land_u_House_Small_01_V1_F",
"Land_u_House_Small_02_V1_dam_F",
"Land_u_House_Small_02_V1_F",
"Land_u_Shed_Ind_F",
"Land_u_Shop_01_V1_F",
"Land_u_Shop_02_V1_F",
"Land_WIP_F"];
{
private ["_diameter", "_marker", "_name", "_radius"];
_radius = ((size _x) call BIS_fnc_arithmeticMean) * 1.25;
_name = format ["l_%1_%2", _forEachIndex, (floor (random 1000))];
_marker = createMarkerLocal [_name, (position _x)];
_marker setMarkerShapeLocal "ELLIPSE";
_marker setMarkerBrushLocal "SolidBorder";
_marker setMarkerColorLocal "ColorRed";
_marker setMarkerAlphaLocal 0.33;
_marker setMarkerSizeLocal [_radius, _radius];
diag_log format ["Location of size %1 (%2 m radius)", (size _x), _radius];
{
if (str(_x buildingPos 0) != "[0,0,0]") then {
private ["_i", "_pos"];
_i = 0;
_pos = _x buildingPos _i;
_name = format ["b_%1_%2", _i, (floor (random 1000))];
_marker = createMarkerLocal [_name, (position _x)];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerTypeLocal "hd_dot";
_marker setMarkerColorLocal "ColorGreen";
diag_log format ["Building %1 at %2", _x, (position _x)];
while { (_pos select 0) != 0 } do {
_name = format ["p_%1_%2", _i, (floor (random 1000))];
_marker = createMarkerLocal [_name, _pos];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerTypeLocal "hd_dot";
_marker setMarkerColorLocal "ColorRed";
diag_log format ["Building position #%1 at %2", _i, _pos];
_i = _i + 1;
_pos = _x buildingPos _i;
};
};
} forEach (nearestObjects [(position _x), _types, _radius]);
} forEach (nearestLocations [(position player), ["NameLocal"], 1500]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.