This is not a simple script I'm afraid. I think you should try to open up an Evolution mission or somesuch and see how their scripts work, rather than doing one from zero. Especially if it's to be MP-compatible (which I know very little about).
Anyway, attached is a script I've used to track units, called:
groupName execvm "trackUnits.sqf"
With a bit of editing it could work with something like what you suggested, i.e. a "whole world" trigger. Original script also has stuff you don't want, so if we remove that...for instance like this:
(called (list WholeWorld) execvm "trackUnits.sqf")
// Simple script that tracks all units of a group on the map, showing their locations with a little marker. Also allows for several different modes: i.e., green for healthy, yellow for wounded, red for incapacitated, black for dead. By Wolfrug @ OFPEC for HWM mission pack.
_grp = _this;
//How often does the script update?
_waitTime = 0.5;
//What markers are used for the soldiers?
_sMarkerType = "Select";
//What size are the markers?
_sMarkerSize = [0.4, 0.4];
//Marker color array - 0 = healthy, 1 = wounded, 2 = incapacitated, 3 = dead
_sMarkerColors = ["ColorGreen", "ColorYellow", "ColorRed", "ColorBlack"];
//Show unit numbers next to their markers?
_sShowNumbers = false;
//Create markers for each group member and put them into an array
_AllMarkersAndUnits = [];
{
_mrk = createMarkerLocal [(str(_grp find _x) + "RUG_TrackUnits"), getpos _x];
_mrk setMarkerTypeLocal _sMarkerType;
_mrk setMarkerSizeLocal _sMarkerSize;
_mrk setMarkerColorLocal (_sMarkerColors select 0);
if (_sShowNumbers) then {_mrk setMarkerTextLocal (str(units _grp find _x))};
_AllMarkersAndUnits = _AllMarkersAndUnits + [_mrk, _x];
} forEach _grp;
//hint format ["%1", _AllMarkersAndUnits];
// Start looping script
while {{alive _x} count _grp > 0} do
{
_i = 0;
// Actual updating of markers
while {count _AllMarkersAndUnits > _i} do
{
_curMrk = _AllMarkersAndUnits select _i;
_curUnit = _AllMarkersAndUnits select (_i + 1);
_curMrk setMarkerPosLocal [getpos _curUnit select 0, getpos _curunit select 1];
if (!alive _curUnit) then {_curMrk setMarkerColorLocal (_sMarkerColors select 3)};
//hint format ["%1, %2, %3", _curMrk, _curUnit, getMarkerColor _curMrk];
_i = _i + 2;
};
sleep _waitTime;
};
Original code attached (although I only changed a few things).
Not MP compatible, and not CPU-friendly.
Wolfrug out.