Jump to content
Sign in to follow this  
tomturner

Difference between Current and Assigned task?

Recommended Posts

I am working on a rather complex task assignment system and I have gotten hung up on how the MP game mode on a dedicated server (arma3server.exe) distinguishes the difference between what is current and what is assigned. Which BIS_fnc's make a distinction when referencing them and the syntax to use when integrating them into other scripts usage. for example:

player named blufor1_1 is a squad leader and he is the owner of the tasks. There are 12 children and 1 parent. blufor1_1 selects one of the children from the Map Screen's Task menu and sets it as the "Current Task" which returns with a "Task Assignment" notification generated by the MissionTasks.sqf system and then my scripts send a BIS_fnc_showNotification to the other MP players. It then executes a few lines that move a marker and execute an AI spawn script.

Hope this helps and hoping you can enlighten me. By the way, it works well on SP and MP (hosted client) but the misc script execution routine does not execute on the dedicated server. The task is selected and marked as "Current" and "Assigned" but the other scripts fail to execute on the dedi.

		private ["_tsk"];
	_tsk = blufor1_1 call BIS_fnc_taskCurrent; sleep 0.5;

	if ("objarea1" == _tsk) then {
		if (TEG_taskState1) exitWith{};
		private ["_gLogic", "_curTask", "_taskDescArray", "_ntd0", "_ntd1", "_ntd2", "_ntd"];
		_curTask = blufor1_1 call BIS_fnc_taskCurrent; sleep 0.5;
		_gLogic = "objarea1" call BIS_fnc_taskDestination; sleep 0.5;
		_taskDescArray = "objarea1" call BIS_fnc_taskDescription; sleep 0.5;
		_ntd0 = _taskDescArray select 0;
		_ntd1 = _taskDescArray select 1;
		_ntd2 = _taskDescArray select 2;
		_ntd = format["%1 at %2", _ntd1, _ntd2];
		server_1 setVariable ["taskLocation", _ntd, true]; sleep 0.5;
		"tskmrkr" setMarkerPos _gLogic;
		"tskmrkr" setMarkerText "ATTACK";
		objcnt setPos _gLogic;
		[["TaskAssigned", ["", _ntd]], "BIS_fnc_showNotification", nil, true] spawn BIS_fnc_MP; sleep 0.5;
		nulm1 = [fh1,2,200,true,true,false,[20,20],[2,0],"default",nil,nil,1] execVM "militarize.sqf";
		TEG_taskState1 = true;
	};

if (isServer) then {
TEG_finTasks = 0;

"Stratis" call BIS_fnc_missionTasks;
"objarea1" call BIS_fnc_missionTasks;
};

if (not isNull blufor1_1) then {
waitUntil {count simpleTasks blufor1_1 > 12};
};
[] spawn {
waitUntil {(damage comtwr1 > 0.7)};
["objarea1", "Succeeded"] call BIS_fnc_taskSetState;
[["TaskSucceeded",["", "AGIA MARINA"]],"BIS_fnc_showNotification",nil,true] spawn BIS_fnc_MP;
TEG_finTasks = TEG_finTasks +1;
};

		case "objarea1": {
		if (_taskState == "") then {
			[
				blufor1_1,
				[_taskID, "Stratis"],
				[
					"Clear Agia Marina of enemy forces !",
					"Destroy Comm Tower! at Agia Marina",
					"AGIA MARINA"
				],
				position fh1
			] call BIS_fnc_taskCreate;
		} else {
			if (_this == "Current") then {_taskID call BIS_fnc_taskSetCurrent} else {[_taskID, _this] call BIS_fnc_taskSetState}
		}
	};

Not actual code but written to help explain what I am trying to say.

Thanks

Edited by tomturner

Share this post


Link to post
Share on other sites

current = assigned

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

if u create the task in right way u dont have to use BIS_fnc_showNotification

and i really dont understand why u have so many sleep commands there...

---------- Post added at 15:36 ---------- Previous post was at 14:35 ----------

i made little example for u that works in MP....

http://loonywarrior.dyndns.org/arma/Experiment_4.Stratis.zip

Share this post


Link to post
Share on other sites

NO, Current does not equal Assigned when it comes to scripting commands. That is why you would have taskCurrent (or currentTask) and taskAssigned. They are not interchangeable. The sleeps are just temporary.(not useable code). I'm really not so interested in just MP but "dedicated MP" with the arma3server.exe.

Your example code doesn't answer my original post. When additional script commands, conditional statements, etc. are used in code like you submitted, the dedi breaks the flow and the intended task responses don't work. I tried using varying degrees of sleeps to find out if the server was just too busy. But finally and reluctantly decided that the arma3server executable just wasn't complete yet. Thank you for responding maybe someone will get something out of all this.

The showNotification is used because NO ONE owns the task except the squad leader so typically he would be the only one receiving response from the dedicated server. ShowNotification allows all to see and helps control the process better. The BIS_fnc_MP does not "guarantee" that the MP functionality will work on a dedicated server. Take some time, try it out and you will find as I have that it breaks down and is not stable (same line of code, same task, just different name, etc.) sometimes it works, sometimes it doesn't. Just a simple restart and it works fine, do another restart and it fails. Go figure.

Edited by tomturner

Share this post


Link to post
Share on other sites
current = assigned

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

if u create the task in right way u dont have to use BIS_fnc_showNotification

and i really dont understand why u have so many sleep commands there...

---------- Post added at 15:36 ---------- Previous post was at 14:35 ----------

i made little example for u that works in MP....

http://loonywarrior.dyndns.org/arma/Experiment_4.Stratis.zip

I checked out file and the function taskHint never worked for me but the function createTask did.

Share this post


Link to post
Share on other sites
NO, Current does not equal Assigned when it comes to scripting commands. That is why you would have taskCurrent (or currentTask) and taskAssigned. They are not interchangeable.

Sure they are. There's no scripting command for "taskAssigned". taskAssigned is just an example for the Notification thingie in ArmA3. "Assigned" is just a state that tasks can be set to and when a state is "assigned" in that manner it's your current task, which is returned by currentTask or set by setCurrentTask.

Long story short, Current = Assigned with regards to tasks. You assign a task and it becomes current.

As for why this isn't working in MP? Well, tasks and MP always suck. Even more so with dedicated servers. Best plan is to keep things super simple and be happy if anything at all ever works. :)

Share this post


Link to post
Share on other sites
Current = Assigned

my words :D

...anyway... i was playing yesterday with tasks all day and i have to say that using BIS_fnc_MP in combination with BIS task functions is one BIG BULL****.. :)

the example was updated...

all magic can be done like this:

if isServer then
{
 _null = [] spawn
 {
   waitUntil { triggerActivated LW_trigger_createTask };

   _null = [west, "taskName", ["description", "title", "waypoin"], "LW_taskWaypoint", true] spawn BIS_fnc_taskCreate;

   waitUntil { triggerActivated LW_trigger_setState };

   _null = ["taskName", "SUCCEEDED"] spawn BIS_fnc_taskSetState;
 };
};

i tryed it in editor and localy client -> dedicated and it simply works..

Share this post


Link to post
Share on other sites

Hmm.. those new task functions seem magical! I'm gonna have to look into using those.

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  

×