Jump to content

Recommended Posts

Hello lads!

 

I'm currently making / modifying a coop mission in ArmA 3, most stuff works so far, managed to find most stuff i needed in the Forums already.

 

Now i have a little problem, it has been explained a few times already, but i just can't seem to understand it somehow :P

 

How can i manage to make stuff sync between all connected users ? 

 

e.g. i have some "addaction" stuff used in my mission, but some of these actions are only executed on the local client side, and not globally for all of the players.

As far as i know, i will have to somehow send information (for ex. briefcase collected, which would be a addaction) to the server in which i set a server variable (for ex. briefcase_collected) to a specific value, in this case 1 / true.

Then the server would share this information with all collected clients, and by changing the value of the variable, the clients would know that this task has been completed, and it would show the next.

 

I just have no idea how i do this in arma, i am trying for quite some hours now but just can seem to get it right.

 

I thank all of those that give me some hints in advance!  B)

 

- PsychOrange

Share this post


Link to post
Share on other sites

What u R writing bout is publicVariable, publicVariableServer, publicVariableClient. But I think remoteExec could be better.

Share this post


Link to post
Share on other sites

Here's a post showing how to do it with remoteExec and a direct engine command.

 

So, I was trying to do this with using the task modules, but how are you supposed to reference a taskID set in a module within a script?  I can't seem to figure out how to make it a Task type and while I can get it to use currentTask to succeed, there's no guarenteeing that's the right task.

 

This is probably why I never use tasks or use Shuko's taskmaster instead. :)

Share this post


Link to post
Share on other sites

Found it!  It's BIS_fnc_TaskReal, but using the function for BIS_fnc_setTaskState works better then the engine command (lil popup and all of that.)

 

Here's the script:

// this addAction ["Gather Data", "data.sqf", ["getDataTask"]]; 
// ["getDataTask", true] to optionally delete object.

// Grab input.
params ["_object", "_caller", "_id", "_args"];

// Grab arguments, task name String and optional Boolean to delete object.
_taskID = _args param [0];
_deleteObject = _args param[1, false];

// Remove addAction from object.
[_object, _id] remoteExec ["removeAction", 0, true];

// Have Base call out who found the intel.
[[side _caller, "base"], format["%1 gathered the data!", name _caller]] remoteExec ["sideChat", 0, true];

// Succeed the task.
[_taskID, "Succeeded", true] remoteExec ["BIS_fnc_taskSetState", 0, true];

// If optional delete flag set, remove the object where it's local.
if (_deleteObject) then {
	_object remoteExec ["deleteVehicle", _object];
};
  • Like 1

Share this post


Link to post
Share on other sites

It seems to work! :D

 

Thank you both, didn't expect help this fast. :)

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  

×