Jump to content
Sign in to follow this  
Cryptdik

Multiplayer Locality

Recommended Posts

I've been reading into how to make my tasks COOP/MP functional. So far I've done reading on multiplayer locality but haven't found any real answers as to how to make my tasks work globally. In this case I'm using triggers to activate bis_fnc_taskcreate and bis_fnc_tasksetstate but they only work for the Host. How would I go about making the tasks in my missions work for all players in a COOP mission?

 

https://community.bistudio.com/wiki/Locality_in_Multiplayer

https://community.bistudio.com/wiki/Arma_3_Task_Framework#Task_locality

Share this post


Link to post
Share on other sites

Not sure how to do it when not starting with task modules. For example using https://community.bistudio.com/wiki/BIS_fnc_taskCreate to create the tasks instead of using modules.

 

As for their example below, would the first parameter (in this case side west) be the way to link all players? Or something like (group player1) when all playable characters are in the same group? It hasn't seemed to work when I did this using task modules.

[west,["task2"],["Do this and you get a cookie","Earn Cookie","cookiemarker2"][0,0,0],1,2,true] call BIS_fnc_taskCreate

 

 

Edit: If I make a Task module and connect it to a trigger to make it activate when the trigger is fired, then set its owners to Synchronized Objects Only and sync players 1-4 with it, will that take care of everything?

Share this post


Link to post
Share on other sites

Don't mix modules and script methods. The tasks Id are too much hard to make them work in this condition.

If you place a task module then add settaskstate module also. The triggers are not a real problem edited or scripted (triggerActivated myTrigger...).

 

 

What I'm using for tasks scripts in MP:

_tsk1 = ["task1", true, ["description here","title here",""], getMarkerPos myMarker, "ASSIGNED", 1, true, true,"attack",true] call BIS_fnc_setTask;

 

"tsk1" execVM "someMission.sqf";

......................... Passing "tsk1" in someMission.sqf script  // NOT _tsk1!...............................

_tsk = _this;

bla bla condition

[_tsk,"Succeeded",true] call BIS_fnc_taskSetState;

..................................................................................................................................

//1st script to be continued:
waitUntil {sleep 0.5; ([_tsk1] call BIS_fnc_taskState) == "Succeeded"}; // _tsk1 here!

..................

 

Anyway, I do prefer bis_fnc_setTask rather than bis_fnc_taskCreate.

Share this post


Link to post
Share on other sites

So to clarify, I'd put these in on OnAct of a trigger or something:

 

_tsk1 = ["task1", true, ["description here","kill enemy",""], getMarkerPos myMarker, "ASSIGNED", 1, true, true,"attack",true] call BIS_fnc_setTask;

"tsk1" execVM "someMission.sqf";

 

And this would go in "someMission.sqf"? This is confusing.

 

_tsk = _this;

!alive enemy1

[_tsk,"Succeeded",true] call BIS_fnc_taskSetState;

waitUntil {sleep 0.5; ([_tsk1] call BIS_fnc_taskState) == "Succeeded"}; // _tsk1 here!

Share this post


Link to post
Share on other sites

You can run the code where you want. if you use local variable such as _tsk1, don't forget to spawn it : 0 = [] spawn {...} , like in a trigger for example.

And yes, Here is a main script, creating a task (assigned or created), then waiting for its status changed (succeeded), from another script, to be continued.

The fact is I did another script to trigger some conditions of success (someMission.sqf). it was just an example that you can run in 2 different scripts what concern the task state.

 

First script:

- create task1;

- spawn someMission.sqf; // or any name you want

- do what you want;

- waituntil success of task1;

- create another task (for example);

....

 

second script (someMission)

- do what you want;

- waitUntil some condition are met (triggerActivated or else);

- set task1 successful

 

PS: I'm passing "Task1" as argument for execVM the script someMission.sqf. In fact, I didn't test that, you could run the script without argument as far as the task ID "task1" seems to be global (defined for any script on your PC). One sure thing: the "return value or handle" _tsk1 doesn't do the job for setTaskState, even if passed as argument.

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×