Arma 3
CREATE TASKS SCRIPT - SP OR MP?
Hello, guys. I have found this in the forums:

Create Tasks and Subtasks:

Save this as init.sqf in your mission folder:

0 = [] spawn {
sleep 1;

0 = [] spawn {
[player,["task1"],["Go to the area and destroy enemy artillery","Go to the area and destroy enemy artillery",""], getPosATL arty_1 ,1,2,true,"destroy"] call BIS_fnc_taskCreate;
waitUntil{!(alive arty_1)};
["task1", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;
};

waitUntil{!(alive arty_1)};
[player,["task2"],[format[" Go to the area and kill two officers %1",name unit_1],format[" Go to the area and kill two officers %1",name unit_1],""], getPosATL unit_1,1,2,true,"kill"] call BIS_fnc_taskCreate;
waitUntil{!(alive unit_1)};
["task2", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;

[player,["task3"],[format[" Go to the area and kill two officers %1",name unit_2],format[" Go to the area and kill two officers %1",name unit_2],""], getPosATL unit_2,1,2,true,"kill"] call BIS_fnc_taskCreate;
waitUntil{!(alive unit_2)};
["task3", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;


[player,["task4"],["Grab intel","Grab intel",""], getMarkerPos "marker_0" ,1,2,true,"move"] call BIS_fnc_taskCreate;
waitUntil{player distance (getMarkerPos "marker_0") < 2};
["task4", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;

[player,["task5"],["Exfill at the base ","Exfill at the base ",""], getMarkerPos "marker_1" ,1,2,true,"move"] call BIS_fnc_taskCreate;
waitUntil{player distance (getMarkerPos "marker_1") < 10};
["task5", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;


};

----------------------------

It is a script I can use in my init.sqf file. BUT... can I use it in MULTIPLAYER? If not, please, share another script that works in MP and where shall I put it?
< >
Showing 1-5 of 5 comments
Fenris 89 Nov 7, 2018 @ 3:41am 
I did´nt know if its work in multiplayer, but you can try it! Save your mission as MP scenario, than go to:

documents\ Arma3\ mpmissions\ your mission folder

if you want it as SP mission save them in the "mission" folder

Put the init file next to the mission.sqm file, when you start your mission, the script start automaticly!
oh god waitUntil in an init file. Don't do that.
I would try because I haven't found a way to create tasks for MP. I think this should work with a script as well, but what exactly... No idea.
Lol, mate, thanks a lot, that's a good description! :) I appreciate your help. I am going to test these scripts as soon as I can or when I have time. But it's going to take a while to figure out how it works. I mean, I have some experience in scripting and such files, but I am still learning and I need to keep it up. That's the best way to achieve success. ;)
Lobito Jul 19, 2021 @ 1:51am 
Hi guys, I was looking for a code for the tasks and I found the one posted in this thread, it works like SP but not MP. I have modified and tested it on the dedicated server, it works fine in MP.

I publish it in case it may interest someone. I have added task number 6 that works by position on the map (11412.20620.8), so that invisible markers can be avoided. This code includes four different options: Task 1 by object position on the map, task 2 and 3 by position of enemy unit with name on the map (unit_1 - unit_2), tasks 4 and 5 by invisible marker and task 6 by positioning in the map.

VERFIFIED CODE ON DEDICATED SERVER FOR MULTIPLAYER

if (!isServer) exitWith {};

0 = [] spawn {
sleep 1;

0 = [] spawn {
[west,["task1"],["Go to the area and destroy enemy artillery","Go to the area and destroy enemy artillery",""], getPosATL arty_1 ,1,2,true,"destroy"] call BIS_fnc_taskCreate;
waitUntil{!(alive arty_1)};
["task1", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;
};

waitUntil{!(alive arty_1)};
[west,["task2"],[format[" Go to the area and kill two officers %1",name unit_1],format[" Go to the area and kill two officers %1",name unit_1],""], getPosATL unit_1,1,2,true,"kill"] call BIS_fnc_taskCreate;
waitUntil{!(alive unit_1)};
["task2", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;

[west,["task3"],[format[" Go to the area and kill two officers %1",name unit_2],format[" Go to the area and kill two officers %1",name unit_2],""], getPosATL unit_2,1,2,true,"kill"] call BIS_fnc_taskCreate;
waitUntil{!(alive unit_2)};
["task3", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;

[west,["task4"],["Grab intel","Grab intel",""], getMarkerPos "marker_0" ,1,2,true,"move"] call BIS_fnc_taskCreate;
waitUntil{sleep 1;(({isPlayer _x && _x distance (getMarkerPos "marker_0") < 5} count playableUnits > 0));};
["task4", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;

[west,["task5"],["Exfill at the base ","Exfill at the base ",""], getMarkerPos "marker_1" ,1,2,true,"move"] call BIS_fnc_taskCreate;
waitUntil{sleep 1;(({isPlayer _x && _x distance (getMarkerPos "marker_1") < 5} count playableUnits > 0));};
["task5", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;

_markerstr = createMarker ["marker_2",[11412,20620.8]];
_markerstr setMarkerShape "ICON";
[west,["task6"],["Exfill at the base ","Exfill at the base ",""], getMarkerPos "marker_2" ,1,2,true,"move"] call BIS_fnc_taskCreate;
waitUntil{sleep 1;(({isPlayer _x && _x distance (getMarkerPos "marker_2") < 5} count playableUnits > 0));};
["task6", "SUCCEEDED",true] spawn BIS_fnc_taskSetState;

};
< >
Showing 1-5 of 5 comments
Per page: 1530 50

Date Posted: Nov 6, 2018 @ 9:14am
Posts: 5