m4rt14l 13 Posted May 11, 2014 I have a problem with a script to generate random tasks, Running through this radio trigger / 0 = [] execVM "scripts\missionSupport.sqf"; missionSupport.sqf //Mission Select if(!isServer) exitWith {}; //waituntil {!isnil "bis_fnc_init"}; //waiting _missions = ["ied","roadrepair","hqbuild","towrepair","vehrepair"]; //mission array _choose = _missions call BIS_fnc_selectRandom; // random mission //_choose = "roadrepair"; [_choose] execVM "scripts\makeSupportOps.sqf"; //call mission makeSupportOps.sqf // Mission _missionType = [_this, 0, ""] call BIS_fnc_param; //sleep 120; _markerArray = ["road","road_1","road_2","road_3","road_4","road_5","road_6","road_7","road_8","road_9","road_10","road_11","road_12","road_13","road_14"]; _rnd = floor (random (count(_markerArray))); _mrkSpawnPos = getMarkerPos (_markerArray select _rnd); sleep 60; fn_spawnIedMission = { hint "OPERACIONES DE APOYO ACTUALIZADAS"; //creating the marker _markerSO = createMarker ["mob_ied", _mrkSpawnPos]; _markerSO setMarkerType "mil_objective"; _markerSO setMarkerColor "ColorBlue"; _markerSO setMarkerText "SUPPORT OP"; _markerSO setMarkerSize [1,1]; _null = [west, "mob_ied", ["Deben destruir el dispositivo IED.", "Destruir IED", "Destruir IED"], getMarkerPos "mob_ied", false] spawn BIS_fnc_taskCreate; //creating the vehicle if (!(isNull player)) then { fnc_MPaddAction2 = { _this addAction ["Detonar IED","scripts\iedblow.sqf"]; }; }; _sign = ["Pole_F"] call BIS_fnc_selectRandom; _ied = ["ModuleExplosive_IEDLandSmall_F","ModuleExplosive_IEDLandBig_F"] call BIS_fnc_selectRandom; _explo = createVehicle [_ied,[(getMarkerpos _markerSO select 0) + 3, getMarkerpos _markerSO select 1,0],[], 0, "NONE"]; pole = createVehicle [_sign, getPos _explo, [], 0, "NONE"]; null = [pole,"fnc_MPaddAction2",nil,true] spawn BIS_fnc_MP; grp1S = [getMarkerPos _markerSO, WEST, (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfTeam")] call BIS_fnc_spawnGroup; nul = [grp1S,getMarkerpos _markerSO, 100] call BIS_fnc_taskPatrol; grp2S = [getMarkerPos _markerSO, WEST, (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfTeam_AT")] call BIS_fnc_spawnGroup; nul = [grp2S,getMarkerpos _markerSO, 100] call BIS_fnc_taskPatrol; waitUntil { !alive _explo }; _null = ["mob_ied", "SUCCEEDED"] spawn BIS_fnc_taskSetState; sleep 20; deleteMarker _markerSO; {deleteVehicle _x} forEach units grp1S; {deleteVehicle _x} forEach units grp2S; deleteGroup grp1S; deleteGroup grp2S; _myHint ="Objetivo Completado!"; GlobalHint = _myHint; publicVariable "GlobalHint"; hintsilent parseText _myHint; _mySChat ="zona despejada"; GlobalSCHat = _mySChat; publicVariable "GlobalSCHat"; player sideChat _mySChat; [west, "mob_ied"] call LARs_fnc_removeTask; //sleep 300; }; fn_spawnRrepairMission = { hint "OPERACIONES DE APOYO ACTUALIZADAS"; //creating the marker _markerSO = createMarker ["mob_rrep", _mrkSpawnPos]; _markerSO setMarkerType "mil_objective"; _markerSO setMarkerColor "ColorBlue"; _markerSO setMarkerText "SUPPORT OP"; _markerSO setMarkerSize [1,1]; _null = [west, "mob_rrep", ["Deben reparar la carretera.", "Reparar Carretera", "Reparar Carretera"], getMarkerPos "mob_rrep", false] spawn BIS_fnc_taskCreate; //creating the vehicle _newPos = [getMarkerPos _markerSO, 0, 200, 10, 0, 20, 0] call BIS_fnc_findSafePos; _crv = ["B_APC_Tracked_01_CRV_F"] call BIS_fnc_selectRandom; _cra = ["CraterLong","CraterLong_small","Dirthump_3_F","Dirthump_2_F","Dirthump_1_F"] call BIS_fnc_selectRandom; eng = createVehicle [_crv,[(getMarkerpos "respawn_west" select 0) + 10, getMarkerpos "respawn_west" select 1,0],[], 0, "NONE"]; eng setFuel 1; eng allowDammage false; cra = createVehicle [_cra,[(getMarkerpos _markerSO select 0), getMarkerpos _markerSO select 1,0],[], 0, "NONE"]; grp1S = [_newPos, WEST, (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfTeam")] call BIS_fnc_spawnGroup; nul = [grp1S,getMarkerpos _markerSO] call BIS_fnc_taskDefend; grp2S = [_newPos, WEST, (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfTeam_AT")] call BIS_fnc_spawnGroup; nul = [grp2S,getMarkerpos _markerSO] call BIS_fnc_taskDefend; _cars1 = createGroup WEST; [_newPos, 10, "B_MRAP_01_gmg_F", _cars1] call BIS_fnc_spawnvehicle; nul = [_cars1,getMarkerPos _markerSO, 150] call BIS_fnc_taskPatrol; sleep 10; [_newPos, 10, "B_MRAP_01_hmg_F", _cars1] call BIS_fnc_spawnvehicle; waitUntil {eng distance getMarkerpos _markerSO < 10}; hint "REPARANDO CARRETERA"; sleep 60; deleteVehicle cra; _null = ["mob_rrep", "SUCCEEDED"] spawn BIS_fnc_taskSetState; sleep 20; deleteMarker _markerSO; deletevehicle eng; {deleteVehicle _x} forEach units grp1S; {deleteVehicle _x} forEach units grp2S; {deleteVehicle _x} forEach units _cars1; deleteGroup grp1S; deleteGroup grp2S; deleteGroup _cars1; _myHint ="Objetivo Completado!"; GlobalHint = _myHint; publicVariable "GlobalHint"; hintsilent parseText _myHint; _mySChat ="Objetivo Completado!"; GlobalSCHat = _mySChat; publicVariable "GlobalSCHat"; player sideChat _mySChat; [west, "mob_rrep"] call LARs_fnc_removeTask; //sleep 300; }; fn_spawnBuildMission = { hint "OPERACIONES DE APOYO ACTUALIZADAS"; //creating the marker _markerSO = createMarker ["mob_build", _mrkSpawnPos]; _markerSO setMarkerType "mil_objective"; _markerSO setMarkerColor "ColorBlue"; _markerSO setMarkerText "SUPPORT OP"; _markerSO setMarkerSize [1,1]; _null = [west, "mob_build", ["Levantar Puesto avanzado", "Construir HQ", "Construir HQ"], getMarkerPos "mob_build", false] spawn BIS_fnc_taskCreate; //creating the vehicle _newPos = [getMarkerPos _markerSO, 0, 50, 10, 0, 20, 0] call BIS_fnc_findSafePos; _engtruck = ["B_Truck_01_box_F"] call BIS_fnc_selectRandom; _hq = ["Land_Cargo_HQ_V3_F"] call BIS_fnc_selectRandom; eng = createVehicle [_engtruck,[(getMarkerpos "respawn_west" select 0) + 10, getMarkerpos "respawn_west" select 1,0],[], 0, "NONE"]; eng setFuel 1; eng allowDammage false; grp1S = [_newPos, WEST, (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfTeam")] call BIS_fnc_spawnGroup; nul = [grp1S,getMarkerpos _markerSO] call BIS_fnc_taskDefend; grp2S = [_newPos, WEST, (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfTeam_AT")] call BIS_fnc_spawnGroup; nul = [grp2S,getMarkerpos _markerSO] call BIS_fnc_taskDefend; _cars1 = createGroup WEST; [_newPos, 10, "B_MRAP_01_gmg_F", _cars1] call BIS_fnc_spawnvehicle; nul = [_cars1,getMarkerPos _markerSO, 150] call BIS_fnc_taskPatrol; sleep 10; [_newPos, 10, "B_MRAP_01_hmg_F", _cars1] call BIS_fnc_spawnvehicle; waitUntil {eng distance getMarkerpos _markerSO < 10}; hint "EN CONSTRUCCION"; sleep 120; _post = createVehicle [_hq, _newPos,[], 0, "NONE"]; _null = ["mob_build", "SUCCEEDED"] spawn BIS_fnc_taskSetState; sleep 20; deleteMarker _markerSO; deletevehicle eng; {deleteVehicle _x} forEach units grp1S; {deleteVehicle _x} forEach units grp2S; {deleteVehicle _x} forEach units _cars1; deleteGroup grp1S; deleteGroup grp2S; deleteGroup _cars1; _myHint ="Objetivo Completado!"; GlobalHint = _myHint; publicVariable "GlobalHint"; hintsilent parseText _myHint; _mySChat ="Objetivo Completado!"; GlobalSCHat = _mySChat; publicVariable "GlobalSCHat"; player sideChat _mySChat; [west, "mob_build"] call LARs_fnc_removeTask; //sleep 290; deleteVehicle _post; sleep 10; }; fn_spawnTwrepairMission = { hint "OPERACIONES DE APOYO ACTUALIZADAS"; //creating the marker _markerSO = createMarker ["mob_trepair", _mrkSpawnPos]; _markerSO setMarkerType "mil_objective"; _markerSO setMarkerColor "ColorBlue"; _markerSO setMarkerText "SUPPORT OP"; _markerSO setMarkerSize [1,1]; _null = [west, "mob_trepair", ["Deben escoltar un camion de suministros hasta el C.O.P.", "Entregar Suministros", "Entregar Suministros"], getMarkerPos "mob_trepair", false] spawn BIS_fnc_taskCreate; //creating the vehicle _newPos = [getMarkerPos _markerSO, 0, 50, 10, 0, 20, 0] call BIS_fnc_findSafePos; _engtruck = ["B_Truck_01_box_F"] call BIS_fnc_selectRandom; _twr = ["Land_Cargo_HQ_V3_F"] call BIS_fnc_selectRandom; eng = createVehicle [_engtruck,[(getMarkerpos "respawn_west" select 0) + 10, getMarkerpos "respawn_west" select 1,0],[], 0, "NONE"]; eng setFuel 1; eng allowDammage false; towr = createVehicle [_twr,[(getMarkerpos _markerSO select 0) + 10, getMarkerpos _markerSO select 1,0],[], 0, "NONE"]; grp1S = [_newPos, WEST, (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfTeam")] call BIS_fnc_spawnGroup; nul = [grp1S,getMarkerpos _markerSO, 150] call BIS_fnc_taskPatrol; grp2S = [_newPos, WEST, (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfTeam_AT")] call BIS_fnc_spawnGroup; nul = [grp2S,getMarkerpos _markerSO, 100] call BIS_fnc_taskPatrol; _cars1 = createGroup WEST; [_newPos, 10, "B_MRAP_01_gmg_F", _cars1] call BIS_fnc_spawnvehicle; nul = [_cars1,getMarkerPos _markerSO, 200] call BIS_fnc_taskPatrol; sleep 10; [_newPos, 10, "B_MRAP_01_hmg_F", _cars1] call BIS_fnc_spawnvehicle; waitUntil {eng distance getMarkerpos _markerSO < 20}; hint "LLEGADA AL C.O.P."; sleep 5; hint "ENTREGANDO SUMINISTROS"; sleep 60; _null = ["mob_trepair", "SUCCEEDED"] spawn BIS_fnc_taskSetState; sleep 20; deleteMarker _markerSO; deletevehicle eng; {deleteVehicle _x} forEach units grp1S; {deleteVehicle _x} forEach units grp2S; {deleteVehicle _x} forEach units _cars1; deleteGroup grp1S; deleteGroup grp2S; deleteGroup _cars1; deleteVehicle towr; _myHint ="Objetivo Completado!"; GlobalHint = _myHint; publicVariable "GlobalHint"; hintsilent parseText _myHint; _mySChat ="Objetivo Completado!"; GlobalSCHat = _mySChat; publicVariable "GlobalSCHat"; player sideChat _mySChat; [west, "mob_trepair"] call LARs_fnc_removeTask; //sleep 300; }; fn_spawnVerepairMission = { hint "OPERACIONES DE APOYO ACTUALIZADAS"; //creating the marker _markerSO = createMarker ["mob_vrepair", _mrkSpawnPos]; _markerSO setMarkerType "mil_objective"; _markerSO setMarkerColor "ColorBlue"; _markerSO setMarkerText "SUPPORT OP"; _markerSO setMarkerSize [1,1]; _null = [west, "mob_vrepair", ["Deben acudir con el vehiculo de reparacion y remolcarlo hasta el area de servicio en Loy Manara AB", "Reparar Vehiculo", "Reparar Vehiculo"], getMarkerPos "mob_vrepair", false] spawn BIS_fnc_taskCreate; //creating the vehicle if (!(isNull player)) then { fnc_MPaddAction3 = { _this addAction ["REMOLCAR","scripts\vehtow.sqf"]; }; }; _newPos = [getMarkerPos _markerSO, 0, 50, 10, 0, 20, 0] call BIS_fnc_findSafePos; _crv = ["B_APC_Tracked_01_CRV_F"] call BIS_fnc_selectRandom; _dveh = ["B_APC_Tracked_01_rcws_F","B_APC_Tracked_01_AA_F","B_MBT_01_cannon_F"] call BIS_fnc_selectRandom; eng = createVehicle [_crv,[(getMarkerpos "respawn_west" select 0) + 10, getMarkerpos "respawn_west" select 1,0],[], 0, "NONE"]; eng setFuel 1; eng allowDammage false; damve = createVehicle [_dveh,[(getMarkerpos _markerSO select 0) + 10, getMarkerpos _markerSO select 1,0],[], 0, "NONE"]; [damve,"fnc_MPaddAction3",nil,true] spawn BIS_fnc_MP; damve setDammage 0.8; damve setFuel 0; damve allowDammage false; grp1S = [_newPos, WEST, (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfTeam")] call BIS_fnc_spawnGroup; nul = [grp1S,getMarkerpos _markerSO, 150] call BIS_fnc_taskPatrol; grp2S = [_newPos, WEST, (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfTeam_AT")] call BIS_fnc_spawnGroup; nul = [grp2S,getMarkerpos _markerSO, 100] call BIS_fnc_taskPatrol; _armor1 = createGroup WEST; [_newPos, 10, "B_APC_Tracked_01_rcws_F", _armor1] call BIS_fnc_spawnvehicle; nul = [_armor1,getMarkerPos _markerSO, 100] call BIS_fnc_taskPatrol; sleep 10; [_newPos, 10, "B_APC_Tracked_01_rcws_F", _armor1] call BIS_fnc_spawnvehicle; waitUntil { damve distance getMarkerPos "reparea" < 20}; detach damve; hint "EN REPARACION"; sleep 5; hint "REPARANDO"; sleep 60; damve setDammage 0; _null = ["mob_vrepair", "SUCCEEDED"] spawn BIS_fnc_taskSetState; sleep 20; deleteMarker _markerSO; {deleteVehicle _x} forEach units grp1S; {deleteVehicle _x} forEach units grp2S; {deleteVehicle _x} forEach units _armor1; deleteGroup grp1S; deleteGroup grp2S; deleteGroup _armor1; deletevehicle eng; deleteVehicle damve; _myHint ="Objetivo Completado!"; GlobalHint = _myHint; publicVariable "GlobalHint"; hintsilent parseText _myHint; _mySChat ="Objetivo Completado!"; GlobalSCHat = _mySChat; publicVariable "GlobalSCHat"; player sideChat _mySChat; [west, "mob_vrepair"] call LARs_fnc_removeTask; //sleep 300; }; // MAIN LOGIC _missionDetails = switch (_missionType) do { case "ied": {call fn_spawnIedMission;}; case "roadrepair": {call fn_spawnRrepairMission;}; case "hqbuild": {call fn_spawnBuildMission;}; case "towrepair": {call fn_spawnTwrepairMission;}; case "vehrepair": {call fn_spawnVerepairMission;}; }; //nul = [] execVM "scripts\missionSupport.sqf"; And the problem is this, when run on dedicated server once it has completed a task class the following are listed as completed, Please would greatly appreciate your help with this script, greetings and thanks. Share this post Link to post Share on other sites