Jump to content
WurschtBanane

Create tasks globally

Recommended Posts

Hi. I have created 6 tasks and 6 players. I synched them to the player. The problem was that that did not work when people joined in progress, they did simply not see the task. So i put into the init of every unit: this synchronizeObjectsAdd [task1].

Still, when switching team or players join, they dont get the task, the ones that come in at the start of the mission do.

 

Is there a way to create a global task at the beginning that affects EVERYONE, even JIP (Joined in Progress)?

Share this post


Link to post
Share on other sites

I havent used tasks a lot but there are several ways to do that.

 

Probably the easiest would be to use a file named "initPlayerLocal.sqf" as that will also be called for JIP players.
 

 

Put the following in it:

task1 synchronizeObjectsAdd [player];

Share this post


Link to post
Share on other sites

 

I havent used tasks a lot but there are several ways to do that.

 

Probably the easiest would be to use a file named "initPlayerLocal.sqf" as that will also be called for JIP players.

 

 

Put the following in it:

task1 synchronizeObjectsAdd [player];

I added it, started the mission aaand... nothing happened. Giving the players individual unit names and replacing player with those didnt help either.

By the way, i need to add 2 tasks per player, one assigned, one optional and i have 6 players.

I tried this:

task1 synchronizeObjectsAdd [player];
task7 synchronizeObjectsAdd [player];
and this:
task1 synchronizeObjectsAdd [unit1]; task7 synchronizeObjectsAdd [unit1];
task2 synchronizeObjectsAdd [unit2]; task8 synchronizeObjectsAdd [unit2];
task3 synchronizeObjectsAdd [unit3]; task9 synchronizeObjectsAdd [unit3];
task4 synchronizeObjectsAdd [unit4]; task10 synchronizeObjectsAdd [unit4];
task5 synchronizeObjectsAdd [unit5]; task11 synchronizeObjectsAdd [unit5];
task6 synchronizeObjectsAdd [unit6]; task12 synchronizeObjectsAdd [unit6];
 
Did not work

Share this post


Link to post
Share on other sites

I don't know if this will help, but here is something we use on our dedicated server to sync the support request module to players. Change it around to suit your needs. Good Luck!

///////////////////////////////////////////////////////////////////////////////////////////////
// The following code is join in progress compatible init.sqf scripting.
// Client side scripts should be run in the first two sections
// The first two sections are identical and may appear redundant, but are required for Join in progress compatibility in multiplayer.
// The final section is for server side scripts.
///////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
//non-JIP player, someone who's went through role selection and briefing
////////////////////////////////////////////////////////////////////////////////////////////////////

if (!(isNull player)) then
	{
		player addEventHandler ["Respawn", {supreq1 synchronizeObjectsAdd [player];}];
	};

///////////////////////////////////////////////////////////////////
//JIP player, role selection then right into mission.
///////////////////////////////////////////////////////////////////

if (!isServer && isNull player) then
	{waitUntil {!isNull player};

		player addEventHandler ["Respawn", {supreq1 synchronizeObjectsAdd [player];}];
	};
	

Share this post


Link to post
Share on other sites

@csk222

i put this in:

 

 
///////////////////////////////////////////////////////////////////////////////////////////////
// The following code is join in progress compatible init.sqf scripting.
// Client side scripts should be run in the first two sections
// The first two sections are identical and may appear redundant, but are required for Join in progress compatibility in multiplayer.
// The final section is for server side scripts.
///////////////////////////////////////////////////////////
 
////////////////////////////////////////////////////////////////////////////////////////////////////
//non-JIP player, someone who's went through role selection and briefing
////////////////////////////////////////////////////////////////////////////////////////////////////
 
if (!(isNull player)) then
{
player addEventHandler ["Respawn", {task1 synchronizeObjectsAdd [player];}];
};
if (!(isNull player)) then
{
player addEventHandler ["Respawn", {task2 synchronizeObjectsAdd [player];}];
};
 
 
///////////////////////////////////////////////////////////////////
//JIP player, role selection then right into mission.
///////////////////////////////////////////////////////////////////
 
if (!isServer && isNull player) then
{waitUntil {!isNull player};
 
player addEventHandler ["Respawn", {task1 synchronizeObjectsAdd [player];}];
};
 
 
if (!isServer && isNull player) then
{waitUntil {!isNull player};
 
player addEventHandler ["Respawn", {task2 synchronizeObjectsAdd [player];}];
};
 
(because there were 2 triggers to sync).
Did not work.

Share this post


Link to post
Share on other sites

I'm afraid that after respawn the player remains synced.

 

The main problem exist because at moment of mission start in MP,

the editor objects synced to the module can be non existing,

connect later as JIP and thats why they become un-synced.

 

There are 2 files in mission root which will be executed by every players joining in.

 

1. init.sqf

2. initPlayerLocal.sqf

 

Use one of them to sync joined in progress player to your modules.

if (hasInterface) then {

    task1 synchronizeObjectsAdd [player];
    task2 synchronizeObjectsAdd [player];

};

Share this post


Link to post
Share on other sites

Is there no way using ArmAs functions to get a list of all tasks, that would be really useful

e.g.

A3_getAllActiveFunctions

A£_getAllFailedFunctions

Share this post


Link to post
Share on other sites

Is there no way using ArmAs functions to get a list of all tasks, that would be really useful

fnc_getAllTasks = {
	_tasks = [] ;
	{
		_isTask = _x find ".";
		if ( _isTask > -1 ) then {
			_nul = _tasks pushBackUnique ( _x select [ 1, _isTask -1 ] );
		};
	}forEach (( allVariables missionNamespace ) select {_x select [0,1] isEqualTo "@"} );
	
	_tasks
};

fnc_getSucceededTasks = {
	_tasks = call fnc_getAllTasks;
	_tasks select { _x call BIS_fnc_taskState == "SUCCEEDED" };
};

fnc_getFailedTasks = {
	_tasks = call fnc_getAllTasks;
	_tasks select { _x call BIS_fnc_taskState == "FAILED" };
};

fnc_getActiveTasks = {
	_tasks = call fnc_getAllTasks;
	_tasks select { !( _x call BIS_fnc_taskState in [ "FAILED", "CANCELED", "SUCCEEDED" ] ) };
};

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

×