Skip to content

Instantly share code, notes, and snippets.

@skonemesis
Forked from vbawol/MapSurfaceIndexer.sqf
Created September 6, 2017 19:53
Show Gist options
  • Save skonemesis/474cadbd5b960107a0ed484b7fd23132 to your computer and use it in GitHub Desktop.
Save skonemesis/474cadbd5b960107a0ed484b7fd23132 to your computer and use it in GitHub Desktop.
Arma 3 Map Surface Indexer Script
/*
by Aaron Clark - [VB]AWOL
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
http://creativecommons.org/licenses/by-sa/4.0/
*/
ALL_SURFACES = [];
EP_addToArray = {
_getSurfaceArray = missionNamespace getVariable [_this select 0, []];
_getSurfaceArray pushBack (_this select 1);
missionNamespace setVariable [_this select 0, _getSurfaceArray];
ALL_SURFACES pushBackUnique (_this select 0);
};
0 spawn {
EP_offset = 1000;
EP_max = 21000;
EP_x = 980;
EP_y = EP_offset;
EP_accuracy = 1;
_surfaceCount = 0;
_prevSurface = "";
_surface = "";
_surfaceTypes = [
["concrete","ColorGrey"],
[["dry","grass"],"ColorKhaki"],
[["green","grass"],"ColorGreen"],
[["grass","tall"],"ColorIndependent"],
["rock","Color2_FD_F"],
["forest","ColorPink"],
["beach","ColorYellow"],
["desert","ColorUNKNOWN"],
["dirt","ColorBrown"],
["soil","Color3_FD_F"],
["mud","ColorOPFOR"],
["snow","ColorCivilian"],
["thorn","Color1_FD_F"],
["stony","ColorOrange"],
["marsh","Color4_FD_F"],
["seabed","Color3_FD_F"],
["dead","ColorRed"],
["vrsurface01","ColorGrey"]
];
while {true} do {
if (EP_x > EP_max) exitWith {};
_markerColor = "";
_markerTXT = "";
_shape = "mil_dot";
_position = [EP_x,EP_y,0];
_isWater = surfaceIsWater _position;
_prevSurface = _surface;
_surface = surfaceType _position;
_normal = surfaceNormal _position;
_posOnRoad = isOnRoad _position;
if (_isWater) then {
["water",_position] call EP_addToArray;
_markerColor = "";
_shape = "mil_box";
_position = ATLToASL _position;
} else {
{
_type = _x select 0;
if (typeName _type == "ARRAY") then {
if (_surface find toLower(_type select 0) > 0 && _surface find toLower(_type select 1) > 0) then {
[(_type select 0) + (_type select 1),_position] call EP_addToArray;
_markerColor = _x select 1;
};
} else {
if (_surface find toLower(_type) > 0) then {
[_x select 0,_position] call EP_addToArray;
_markerColor = _x select 1;
};
};
if (_markerColor != "") exitWith {};
} forEach _surfaceTypes;
};
if (_posOnRoad) then {
["road",_position] call EP_addToArray;
_markerColor = "ColorWhite";
};
if (!_isWater) then {
if (_markerColor == "") then {
_markerColor = "ColorBlack";
_markerTXT = _surface;
};
};
_surfaceCount = _surfaceCount + 1;
if !(_surface isEqualTo _prevSurface) then {
_surfaceCount = 0;
};
if (false && _markerColor != "") then {
_marker = createMarker[str(_position), _position];
_marker setMarkerShape "ICON";
_marker setMarkerType _shape;
if !(_markerTXT isEqualTo "") then {
_marker setMarkerText _markerTXT;
};
_marker setMarkerColor _markerColor;
};
if (EP_y > EP_max) then {
EP_y = EP_offset;
EP_x = EP_x + EP_accuracy;
};
EP_y = EP_y + EP_accuracy;
};
};
_getBeach = missionNamespace getVariable ["#GdtBeach",[]];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment