_type = _this select 0; _location = [1] call fox_alive_fnc_getLocations select 0; _name = [_location,"locationName"] call fox_alive_fnc_getLocationData; _position = [_location,"position"] call fox_alive_fnc_getLocationData; _radius = [_location,"radius"] call fox_alive_fnc_getLocationData; _missionDescription = getText(missionconfigfile >> fox_taskSet >> _type >> "text"); _missionTitle = getText(missionconfigfile >> fox_taskSet >> _type >> "title"); _missionType = getText(missionconfigfile >> fox_taskSet >> _type >> "type"); _faction = selectRandom fox_alive_faction_eastArray; _factionName = getText(configfile >> "CfgFactionClasses" >> _faction >> "displayName"); // need rework; _taskID = format["%1_%2",_type, [_name] call fox_alive_fnc_removeWhiteSpacer ]; _missionGroups = []; _taskMarker = [_taskID,_position,_radius] call fox_alive_fnc_createMissionMarker; _unitArray = getArray(missionconfigfile >> "fox_factions" >> "EAST" >> _faction >> "units"); _dummyUnits = []; for [{_i=0}, {_i<5}, {_i=_i+1}] do { _dummyUnits pushBack selectRandom _unitArray; }; _max = (count (allPlayers - entities "HeadlessClient_F")) * 2; for [{_i=0}, {_i<_max}, {_i=_i+1}] do { _pos = _taskMarker call BIS_fnc_randomPosTrigger; _grp = [ _pos, EAST, _dummyUnits,[],[],[],[],[],180] call BIS_fnc_spawnGroup; _missionGroups pushBack _grp; [_grp,_position,(_radius select 0) ,5 ,"MOVE","SAFE"] call CBA_fnc_taskPatrol; }; for [{_i=0}, {_i<_max - 1}, {_i=_i+1}] do { _pos = _taskMarker call BIS_fnc_randomPosTrigger; _grp = [ _pos, EAST, _dummyUnits,[],[],[],[],[],180] call BIS_fnc_spawnGroup; _missionGroups pushBack _grp; [[_position select 0,_position select 1 ,0], [],units _grp, (_radius select 0),0, false, false] call ace_ai_fnc_garrison; }; _objects = getArray(missionconfigfile >> "fox_factions" >> "EAST" >> _faction >> "carsS") + getArray(missionconfigfile >> "fox_factions" >> "EAST" >> _faction >> "carsA")+ getArray(missionconfigfile >> "fox_factions" >> "EAST" >> _faction >> "turrets"); _targets = []; _n = (ceil random 3) + 1; _condition = ""; _vehicleStrings = "a "; for [{_i=0}, {_i < _n}, {_i=_i+1}] do { _pos = _taskMarker call BIS_fnc_randomPosTrigger; _class = selectRandom _objects; _t = createVehicle [_class, _pos, [], 0, "NONE"]; createVehicleCrew _t; _targets pushBack _t; [_t,_position,(_radius select 0) ,5 ,"MOVE","SAFE"] call CBA_fnc_taskPatrol; _vehicleName = getText(configfile >> "CfgVehicles" >> _class >> "displayName"); if(_i < (_n - 1))then{ _condition = _condition + format["!alive (%1 call BIS_fnc_objectFromNetId) AND ",str (_t call BIS_fnc_netId)]; _vehicleStrings = _vehicleStrings + format["%1, ",_vehicleName]; }else{ _condition = _condition + format["!alive (%1 call BIS_fnc_objectFromNetId)",str (_t call BIS_fnc_netId)]; _vehicleStrings = _vehicleStrings + format["and %1 ",_vehicleName]; }; }; _taskTrigger = createTrigger ["EmptyDetector", _position]; _taskTrigger setTriggerArea [1 ,0, 0, false]; _taskTrigger setTriggerActivation ["NONE", "PRESENT", true]; _taskTrigger setTriggerStatements [ format["call %1", compile _condition ], format["[%1,%2]call fox_alive_fnc_updateTask;",str _taskID,str "SUCCEEDED"], ""]; [west,_taskID,[format[_missionDescription,_vehicleStrings,_name],_missionTitle],_position,true,0,true,_missionType] call BIS_fnc_taskCreate; fox_tasks pushBack [_taskID,[ [_taskMarker],[_taskTrigger],_missionGroups ]];