Jump to content
Sign in to follow this  
Zombitch

Managing tasks and trigger in multiplayer ? (who owns what ?)

Recommended Posts

Hi Gentlemen and Ladies,

A noobish question about tasks and triggers. I would like to know who (server or client ?) owns tasks and triggers ? Should I manage them only on server side and they will be "dispatched" to client or should I do it another way ?

Thanks for your help.

Best regards ;)

Share this post


Link to post
Share on other sites

Tasks are local to the clients, so you would need to execute that on all clients. Triggers are arguement global, effects local, so when a trigger is activated, it executes on that particular client only, but the trigger itself and conditions are seen by all clients.

Share this post


Link to post
Share on other sites
Pretty sure they're local (?)

Like, what are you trying to do with them

I just want to create a simple Task that is visible for all players.

Tasks are local to the clients, so you would need to execute that on all clients. Triggers are arguement global, effects local, so when a trigger is activated, it executes on that particular client only, but the trigger itself and conditions are seen by all clients.

Thanks for this helpful answer. "Tasks are local" means that when I create them I should avoid create them on dedicated ? With something like that :

if(!isDedicated) then
{
   //Create the task if no exists
   ["FindStuff_task", true, ["Find the box containing your stuff. It should be near a rock", "Find stuff", "Find stuff"], [3258, 1731, 0], "ASSIGNED", 1, true, false] call BIS_fnc_setTask;
}

And last question what if I want my task completed by player1 to be also completed on player2 client ? (I mean, player1 complete the task so it completes the task for all player)

Thanks.

Share this post


Link to post
Share on other sites

Look up BIS_fnc_setTask and BIS_fnc_taskSetState as they will do what your needing with the global parameter set to true, as well as setting up just about the entire tasking system with just a couple lines of code.

Share this post


Link to post
Share on other sites
Look up BIS_fnc_setTask and BIS_fnc_taskSetState as they will do what your needing with the global parameter set to true, as well as setting up just about the entire tasking system with just a couple lines of code.

Indeed I missed the last parameter of BIS_fnc_setTask that allow to set the task at a global level.

However about BIS_fnc_taskSetState and according to this post, the function does not work in MP but this topic is old and the information given by sxp2high is maybe deprecated ? do you have any information about that ?

Thanks again ;)

Share this post


Link to post
Share on other sites

From my experience with the task itself global the effects of setting its state is broadcasted, if not however, it's a simple fix with BIS_fnc_MP. But yes the thread you linked is depreciated by BIS_fnc_MP.

Edited by JShock

Share this post


Link to post
Share on other sites

Ok, it's clear now. Thank you JShock. I'll test it soon.

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  

×