This setup would execute a file every 5 minutes that checks for nearby enemies around each friendly profile and if one is detected, it creates a marker which deletes itself after 3 minutes.
init.sqf:
if (isServer) then {
[{
["BLU_F"] execVM "filename.sqf";
}, 300, []] call CBA_fnc_addPerFrameHandler;
}
filename.sqf
private ["_factions"];
_factions = _this;
//-- Get profile id's
_profileIDs = [];
{
_profileIDs = _profileIDs + ([ALIVE_profileHandler, "getProfilesByFaction",_x] call ALIVE_fnc_profileHandler);
} foreach _factions;
//-- Define delete function
_fnc_deleteMarkerTimer = {
_marker = _this;
_startTime = serverTime;
waitUntil {sleep 15; (Servertime - _startTime >= 180) or (({_x distance (getMarkerPos _marker) < 300} count ([] call BIS_fnc_listPlayers)) > 0)};
deleteMarker _marker;
};
//-- Get profile position and execute check
{
//-- Get profile and it's position
_profile = [ALIVE_profileHandler, 'getProfile', _x] call ALIVE_fnc_profileHandler;
_position = [_profile, 'position', []] call CBA_fnc_HashGet;
//-- Check for enemies
if (((count ([_position, 300, ["EAST","entity"]] call ALIVE_fnc_getNearProfiles)) > 0)) then {
_marker = createMarker [(format ["%1", random 200]), _position];
_marker setMarkerType "mil_dot";
_marker setMarkerText "Enemy contact";
_marker spawn _fnc_deleteMarkerTimer;
};
} forEach _profileIDs;
So basically, all you need to do is input the faction of any forces that you consider friendlies and insert them into this line
["BLU_F"] execVM "filename.sqf";
that is listed above.. for example, if you are using US RHS as your friendly forces, then you would change it to this
["rhs_faction_usarmy_wd","rhs_faction_usarmy_d"," rhs_faction_usmc_wd","rhs_faction_usmc_d"] execVM "filename.sqf";
--
Every 5 min it will do a check for every unit that belongs to any of the above factions to see if there is an enemy within 300m. If an enemy is detected, it will create a marker that self deletes after 3 minutes.