Skip to content

Instantly share code, notes, and snippets.

@raws
Last active August 31, 2016 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save raws/6458605 to your computer and use it in GitHub Desktop.
Save raws/6458605 to your computer and use it in GitHub Desktop.
Useful ArmA 3 debug console snippets
// Mark locations of nearby helipads
{
_marker = createMarkerLocal [(format ["helipad_%1", ([0, 1000] call BIS_fnc_randomInt)]), (position _x)];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerTypeLocal "hd_dot";
_marker setMarkerColor "ColorRed";
} forEach (nearestObjects [player, {"Land_helipadEmpty_F"}, 250]);
// Find, log and mark nearby locations
_locations = nearestLocations [(position player), ["NameLocal", "NameVillage", "NameCity", "NameCityCapital"], 1000];
diag_log format ["Locations: %1", _locations];
{
_marker = createMarkerLocal [(format ["loc_%1", ([0, 1000] call BIS_fnc_randomInt)]), (position _x)];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerTypeLocal "hd_dot";
_marker setMarkerColor "ColorRed";
} forEach _locations;
// Find nearby military sites and mark valid building positions in observation towers, HQs, and
// other military structures
private ["_radius", "_types"];
_radius = 1500;
_types = ["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_V2_F", "Land_Cargo_Tower_V3_F", "Land_Medevac_HQ_V1_F",
"Land_MilOffices_V1_F", "Land_Radar_F", "Land_Research_HQ_F", "Land_TTowerBig_1_F",
"Land_TTowerBig_2_F"];
{
if ((text _x) == "military") then {
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]);
// Copy the player's position and heading to the clipboard
_pos = getPosATL player;
_dir = getDir player;
_str = format ["{ { %1, %2, %3 }, %4 }", (_pos select 0), (_pos select 1), (_pos select 2), _dir];
copyToClipboard _str;
hint _str;
// Mark 100 "safe positions" around the player on the map as found by BIS_fnc_findSafePos
for "_i" from 1 to 100 do {
_pos = [(position player), 50, 150, 10, 0, 3, 0, [], [(position player)]] call BIS_fnc_findSafePos;
_marker = createMarkerLocal [(format ["safe_pos_%1", ([0, 1000] call BIS_fnc_randomInt)]), _pos];
_marker setMarkerShapeLocal "ICON";
_marker setMarkerTypeLocal "hd_dot";
_marker setMarkerColor "ColorRed";
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment