Code:
///////////////////////////////Set Up RANDOM tasks////////////////////////////
call compile preprocessfile "shk_taskmaster.sqf";
SHK_addTask = {
if isserver then {
if (count SHK_Tasks == 0) then {
TheEnd = true;
publicvariable "TheEnd";
} else {
_this spawn {
private "_t";
if (count _this > 0) then {
_t = _this select 0;
} else {
_t = SHK_Tasks select (floor random count SHK_Tasks);
};
SHK_Tasks = SHK_Tasks - [_t];
switch _t do {
case 0: {
["Task1","Capture VIP","You must locate and capture the VIP that is in the town of Stremidad and return him to your Base",true,["markertask1",getmarkerpos "task1","flag","ColorGreen"]] call SHK_Taskmaster_add;
nul = [] execVM "missions\task1.sqf";
_vehicleambush=task1;
_spawnopfor = createmarker ["MissionAO",getpos _vehicleambush];
};
case 1: {
["Task2","Escort Doctor","Your Mission is to safely transport the local Doctor and his vehicles to San Miguel- Your mission will be a failure if he dies. ",true,[["markertask2a",getmarkerpos "task2","start","ColorGreen"],["markertask2b",getpos task2end,"end","ColorGreen"]]] call SHK_Taskmaster_add;
nul = [] execVM "missions\task2.sqf";
_vehicleambush=task2;
_spawnopfor = createmarker ["MissionAO",getpos _vehicleambush];
};
case 2: {
["Task3","Assassination","We have just received Intel that the Head Warlord is located somewhere in the North West Region we have possible location as marked on the map the he you are to assassinate him when you locate him and clear the area of any of his troops",true,["markertask3",getmarkerpos "task3","flag","ColorYellow"]] call SHK_Taskmaster_add;
nul = [] execVM "missions\task3.sqf";
_vehicleambush=task3;
_spawnopfor = createmarker ["MissionAO",getpos _vehicleambush];
};
case 3: {
["Task4","Roadblock and Airfield","You are to Clear all 4 Roadblock that are heading up towards the Airfield then you are tasked to locate and Destroy the 3 helicopter ",true,["markertask4",getmarkerpos "task4","flag","ColorYellow"]] call SHK_Taskmaster_add;
nul = [] execVM "missions\task4.sqf";
_vehicleambush=task4;
_spawnopfor = createmarker ["MissionAO",getpos _vehicleambush];
};
case 4: {
["Task5","Antenna","A antenna has been sighted you are to destroy the it and sweep the area",true,["markertask5",getmarkerpos "task5","flag","ColorYellow"]] call SHK_Taskmaster_add;
nul = [] execVM "missions\task5.sqf";
_vehicleambush=radarsite2;
_spawnopfor = createmarker ["MissionAO",getpos _vehicleambush];
};
case 5: {
["Task6","Docks and Helicopter","Your first part of the mission is to recapture 4 stolen Boats they are located at the Docks where marked, once you have secured these transport them to the coastline and use them to get to the main AO where you are to destroy the ammo cash and also recover the stolen helicopter that is at the airfield and return it to your Base, DO NOT fly direct to the Island due to AA sites on the island. clera them out before you bring any Air asset near",true,[["markertask2a",getmarkerpos "task6","flag","ColorGreen"],["markertask2b",getpos boat1,"mil_pickup","ColorGreen"]]] call SHK_Taskmaster_add;
nul = [] execVM "missions\task6.sqf";
_vehicleambush=task6;
_spawnopfor = createmarker ["MissionAO",getpos _vehicleambush];
};
case 6: {
["Task7","Ammo Crates","We have Intel that there is 5 Ammo crates located in the village of Tigeria that we believe we have the location of two of them but the rest must be hidden in the main town you are tasked to destroy all 5 crates",true,["markertask7",getmarkerpos "task7","flag","ColorYellow"]] call SHK_Taskmaster_add;
nul = [] execVM "missions\task7.sqf";
_vehicleambush=task7;
_spawnopfor = createmarker ["MissionAO",getpos _vehicleambush];
};
case 7: {
["Task8","Locate HQ","Locate there HQ site and destroy it, +remember to take some satchel charges with you",true,["markertask8",getmarkerpos "task8","flag","ColorYellow"]] call SHK_Taskmaster_add;
nul = [] execVM "missions\task8.sqf";
_vehicleambush=task8can;
_spawnopfor = createmarker ["MissionAO",getpos _vehicleambush];
};
case 8: {
["Task9","UAV Terminal","Locate the UAV Terminal and destroy it, remember to take some satchel charges with you",true,["markertask9",getmarkerpos "task9","flag","ColorYellow"]] call SHK_Taskmaster_add;
nul = [] execVM "missions\task9.sqf";
_vehicleambush=task9;
_spawnopfor = createmarker ["MissionAO",getpos _vehicleambush];
};
case 9: {
["Task10","Ammo Drop","We have a C130 that is short on fuel and has to eject some cargo, you are to get there ASAP and collect the cargo and return it to your base",true,[]] call SHK_Taskmaster_add;
nul = [] execVM "missions\task10.sqf";
_vehicleambush=testtimer;
_spawnopfor = createmarker ["MissionAO",getpos _vehicleambush];
};
case 10: {
["Task11","Ammo","We have Intel on 2 ammo crates one is located in Casa de la Muerte and the other in Chez Leon, once you have found theses and destroyed them you are to proceed to the Barracks in Campo and take down the Antenna. ",true,[]] call SHK_Taskmaster_add;
nul = [] execVM "missions\task11.sqf";
_vehicleambush=task11;
_spawnopfor = createmarker ["MissionAO",getpos _vehicleambush];
};
case 11: {
["Task12","OPFOR Convoy","OPFOR has a ammo truck and a HQ BMP they need to get will be leaving there base and heading towards Pista your job it to destroy them before they get there ",true,[["markertask12a",getmarkerpos "task12","start","ColorRed"],["markertask12b",getpos task12end,"end","ColorRed"]]] call SHK_Taskmaster_add;
nul = [] execVM "missions\task12.sqf";
_spawnplace=task12;
_spawnopfor = createmarker ["MissionAO",[11935,4303.87,0.00143814]];
};
};
};
};
};
};
private "_selectedTask";
taskCount = paramsarray select 4;
_selectedTask = paramsarray select 5;
if isserver then {
private ["_tmp","_t"];
_tmp = [0,1,2,3,4,5,6,7,8,9,10,11];
SHK_Tasks = [];
for "_i" from 0 to (taskCount - 1) do {
_t = _tmp select (floor random count _tmp);
SHK_Tasks set [_i,_t];
_tmp = _tmp - [_t];
};
// first task
if (_selectedTask < 99) then {
[_selectedTask] call SHK_addTask;
} else {
[] call SHK_addTask;
};
};