2015-01-11 16:42:31 +00:00
|
|
|
/*
|
|
|
|
Name: AGM_SwitchUnits_fnc_markAiOnMap
|
|
|
|
|
|
|
|
Author(s):
|
|
|
|
bux578
|
|
|
|
|
|
|
|
Description:
|
|
|
|
Creates markers for AI units for given sides
|
|
|
|
Marks players in a different color
|
|
|
|
|
|
|
|
Parameters:
|
|
|
|
0: OBJECT - side
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
VOID
|
|
|
|
*/
|
|
|
|
|
2015-01-12 14:47:22 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-01-11 16:42:31 +00:00
|
|
|
private ["_sidesToShow"];
|
|
|
|
_sidesToShow = _this select 0;
|
|
|
|
|
|
|
|
_sidesToShow spawn {
|
|
|
|
|
|
|
|
private ["_sides", "_allMarkerNames"];
|
|
|
|
_sides = _this;
|
|
|
|
_allMarkerNames = [];
|
|
|
|
|
|
|
|
while { true } do {
|
|
|
|
sleep 1.5;
|
|
|
|
|
|
|
|
// delete markers
|
|
|
|
{
|
|
|
|
deleteMarkerLocal _x;
|
|
|
|
} forEach _allMarkerNames;
|
|
|
|
|
|
|
|
// create markers
|
|
|
|
{
|
2015-01-12 14:47:22 +00:00
|
|
|
if (([_x] call FUNC(isValidAi) && (side group _x in _sides)) || (_x getVariable [QGVAR(IsPlayerControlled), false])) then {
|
2015-01-11 16:42:31 +00:00
|
|
|
private ["_markerName", "_marker", "_markerColor"];
|
|
|
|
|
2015-01-12 14:47:22 +00:00
|
|
|
//_markerName = format ["%1", [_x] call EFUNC(Core, getName)];
|
2015-01-11 16:42:31 +00:00
|
|
|
_markerName = str _x;
|
|
|
|
|
|
|
|
_marker = createMarkerLocal [_markerName, position _x];
|
|
|
|
_markerName setMarkerTypeLocal "mil_triangle";
|
|
|
|
_markerName setMarkerShapeLocal "ICON";
|
|
|
|
_markerName setMarkerSizeLocal [0.5,0.7];
|
|
|
|
_markerName setMarkerDirLocal getDir _x;
|
|
|
|
|
|
|
|
// commy's one liner magic
|
|
|
|
_markerColor = format ["Color%1", side group _x];
|
|
|
|
|
2015-01-12 14:47:22 +00:00
|
|
|
if ((_x getVariable [QGVAR(IsPlayerControlled), false])) then {
|
2015-01-11 16:42:31 +00:00
|
|
|
_markerName setMarkerColorLocal "ColorOrange";
|
2015-01-12 14:47:22 +00:00
|
|
|
_markerName setMarkerTextLocal (_x getVariable [QGVAR(PlayerControlledName),""]);
|
2015-01-11 16:42:31 +00:00
|
|
|
} else {
|
|
|
|
_markerName setMarkerColorLocal _markerColor;
|
|
|
|
_markerName setMarkerTextLocal (getText (configFile >> "CfgVehicles" >> typeOf _x >> "displayName"));
|
|
|
|
};
|
|
|
|
|
|
|
|
_allMarkerNames pushBack _markerName;
|
|
|
|
};
|
|
|
|
} forEach allUnits;
|
|
|
|
};
|
|
|
|
};
|