ACE3/addons/switchunits/functions/fnc_markAiOnMap.sqf

67 lines
1.7 KiB
Plaintext
Raw Normal View History

/*
2015-01-14 01:57:15 +00:00
Name: ACE_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"
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 {
private ["_markerName", "_marker", "_markerColor"];
2015-01-13 05:14:27 +00:00
//_markerName = format ["%1", [_x] call EFUNC(common,getName)];
_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 {
_markerName setMarkerColorLocal "ColorOrange";
2015-01-12 14:47:22 +00:00
_markerName setMarkerTextLocal (_x getVariable [QGVAR(PlayerControlledName),""]);
} else {
_markerName setMarkerColorLocal _markerColor;
_markerName setMarkerTextLocal (getText (configFile >> "CfgVehicles" >> typeOf _x >> "displayName"));
};
_allMarkerNames pushBack _markerName;
};
} forEach allUnits;
};
};