//called from mission sensor on each local player
PRIVATE ["_pmarkerlist","_pnmarker","_obj","_name","_typename"];
	
waitUntil {sleep 0.4;(Alive player)};

_pmarkerlist = [];
for "_i" from 1 to 23 do
{
	_pnmarker = createMarkerLocal [format["W%1Unit",_i],[0,0]];
	_pmarkerlist = _pmarkerlist + [_pnmarker];
	_pnmarker setMarkerTypeLocal "mil_Arrow";
	_pnmarker setMarkerColorLocal "ColorGreen";
	_pnmarker setMarkerSizeLocal [0.4, 0.4];
};

//retuns array of _pmarkerlist =["W1Unit","W2Unit",etc] for all 32 players

while {(true)} do
{
	for "_i" from 1 to 32 do
	{
		//_obj = eng1;
		debuglog format ["marker.sqf _i = %1", _i];
	
		if ((!isNil format ["eng%1", _i])) then
		{
			debuglog "marker.sqf not nil";
			
			_obj = [] call compile format ["eng%1", _i];
		
			debuglog format ["marker.sqf  _obj = %1", _obj];
					
			if ((!isNull _obj)) then
			{
				debuglog "marker.sqf not null";
				
				_pnmarker =_pmarkerlist select (_i - 1);
				
				//for each player eng1 to eng32 allocate a _markerw
				if (alive _obj) then
				{
					_name = (name _obj);
					_pnmarker setmarkerposLocal (getpos (vehicle _obj));
					_pnmarker setmarkerdirLocal (getdir (vehicle _obj));
					//player globalchat format ["Marker: %1:%2:%3:%4:%5",_name,_marker,_obj,(alive _obj),((vehicle _obj) != _obj)];

					if ((vehicle _obj) != _obj) then
					{
						_typename = gettext(configFile >> "CfgVehicles" >> (typeof (vehicle _obj)) >> "displayName");
						_pnmarker setmarkertextLocal format ["%1 (%2)",_name,_typename];

					}
					else 
					{
						_pnmarker setmarkertextLocal format ["%1",_name];

					};
				}
				else 
				{
					_pnmarker setmarkerposLocal [0,0];

				};
			};
		};
	};
	
	sleep 1;
};