Jump to content
Sign in to follow this  
wiggum2

setCurrentTask Problem

Recommended Posts

Hi,

in a MP Mission have the following in a trigger:

Condition:

not Alive f1 AND not Alive f2

OnActivation:

task1 setTaskState "SUCCEEDED"; nul = [objNull, objNull, task1, "SUCCEEDED"] execVM "CA\Modules\MP\data\scriptCommands\taskHint.sqf"; hint"Luftschlag verfügbar !"; Luftschlag setTriggerActivation ["BRAVO", "PRESENT", false]; unlock2=true; win1=true; player setCurrentTask task2; nul = [objNull, objNull, task2, "CURRENT"] execVM "CA\Modules\MP\data\scriptCommands\taskHint.sqf";

Thats my Briefing.sqf:

/*

* Unofficial Zeus Briefing Template v0.01

*

*

* Notes:

* - Use the tsk prefix for any tasks you add. This way you know what the varname is for by just looking at it, and

* aids you in preventing using duplicate varnames.

* - To add a newline: <br/>

* - To add a marker link: <marker name='mkrObj1'>attack this area!</marker>

* - To add an image: <img image='somePic.jpg'/>

*

* Required briefing commands:

* - Create Note: player createDiaryRecord ["Diary", ["*The Note Title*", "*The Note Message*"]];

* - Create Task: tskExample = player createSimpleTask ["*The Task Title*"];

* - Set Task Description: tskExample setSimpleTaskDescription ["*Task Message*", "*Task Title*", "*Task HUD Title*"];

*

* Optional briefing commands:

* - Set Task Destination: tskExample setSimpleTaskDestination (getMarkerPos "mkrObj1"); // use existing "empty marker"

* - Set the Current Task: player setCurrentTask tskExample;

*

* Commands to use in-game:

* - Set Task State: tskExample setTaskState "SUCCEEDED"; // states: "SUCCEEDED" "FAILED" "CANCELED"

* - Get Task State: taskState tskExample;

* - Get Task Description: taskDescription tskExample; // returns the *task title* as a string

* - Show Task Hint: [tskExample] call mk_fTaskHint; // make sure you've set the taskState before using this function

*

*

* Authors: Jinef & mikey

*/

// since we're working with the player object here, make sure it exists

waitUntil { !isNil {player} };

waitUntil { player == player };

switch (side player) do

{

case WEST: // BLUFOR briefing goes here

{

player createDiaryRecord["Diary", ["Lage", "Utes ist eine kleine, seit mehreren Jahren unbewohnte, Insel. Zentral gelegen ist ein Flugfeld das von den Aufständischen genutzt wird. Vor kurzem haben die Russen zwei moderne TUNGUSKA Flugabwehrpanzer an die Aufständischen geliefert, diese sind aber laut unseres Geheimdienstes noch nicht einsatzbereit."]];

player createDiaryRecord["Diary", ["Auftrag", "Sie werden um 5:30 Uhr auf <marker name=mkrObj1'>Utes landen</marker>. Zerstören Sie die beiden TUNGUSKA Flugabwehrpanzer und töten Sie so viele Aufständische wie möglich. Sie können jederzeit einen Hubschrauber zur Evakuierung anfordern.]];

//>---------------------------------------------------------<

// Secondary Objective

task2 = player createsimpletask["Radaranlage zerstören"];

task2 setSimpleTaskDescription["Zerstören Sie die Radaranlage des Flughafens. Damit nehmen wir den Aufständischen die Möglichkeit den Luftraum über Utes zu überwachen.", "Radaranlage zerstören", "Radaranlage zerstören"]; task2 setSimpleTaskDestination (getMarkerPos "zone2");

//>---------------------------------------------------------<

// Primary Objective

task1 = player createsimpletask["Flugabwerhpanzer zerstören"];

task1 setSimpleTaskDescription["...muss man dazu noch etwas sagen ?", "Flugabwehrpanzer zerstören", "Flugabwehrpanzer zerstören"]; task1 setSimpleTaskDestination (getMarkerPos "zone1"); player setCurrentTask task1;

};

case EAST: // REDFOR briefing goes here

{

};

case RESISTANCE: // RESISTANCE/INDEPENDENT briefing goes here

{

};

case CIVILIAN: // CIVILIAN briefing goes here

{

};

};

// run this file again when respawning (only setup the killed EH once though)

if ( isNil{player getVariable "mk_killedEHadded"} ) then

{

player addEventHandler ["killed",

{

[] spawn {

waitUntil { alive player }; // waitUntil player has respawned

execVM "briefing.sqf";

};

}];

player setVariable ["mk_killedEHadded", true];

};

But if task1 is finished, task2 is not the current task, why ?

Any ideas ?

Edited by Wiggum

Share this post


Link to post
Share on other sites

Just from searching I was able to find that you used the wrong syntax for setCurrentTask. Please, please search before posting (it's a rule).

Share this post


Link to post
Share on other sites

I use "player setCurrentTask task2" and i did not work.

I get the grey dot that marks task2 but i still can click "set this task as current" or whatever it is in english.

Edited by Wiggum

Share this post


Link to post
Share on other sites

You need to have a marker on the map (in briefing.sqf) that point to the objective ito be able to get "set as a current task"

Share this post


Link to post
Share on other sites
You need to have a marker on the map (in briefing.sqf) that point to the objective ito be able to get "set as a current task"

I dont know what you mean...

I have this in the "briefing.sqf":

; task2 setSimpleTaskDestination (getMarkerPos "zone2");

And a Merker "zone2" at the Map.

Share this post


Link to post
Share on other sites

I'm not sure exactly what your asking but here's how I have it for one of my missions:

 tsk3 = player createSimpleTask["Assassinate the Officer"];   setSimpleTaskDescription["High Level enemy officer believed to be meeting with insurgents at the Church in Elektrozavod", "Assassinate", "Ass"];
tsk3 setSimpleTaskDestination (getMarkerPos "obj3");


tsk2 = player createSimpleTask["Take the Mountain"]; 
tsk2 setSimpleTaskDescription["Flank and Assault the Mountain Top", "Mountain Top", "Mtn"];
tsk2 setSimpleTaskDestination (getMarkerPos "obj2");

tsk1 = player createSimpleTask["Clear the Beach"]; 
tsk1 setSimpleTaskDescription["Clear the Beach Head", "Clear Beach", "Beach"];
tsk1 setSimpleTaskDestination (getMarkerPos "obj1");

One thing I noticed that if I didn't have the SimpleTaskDestination in that exact order it wouldn't always work.

Share this post


Link to post
Share on other sites

I cant figure out what you mean.

My problem is this:

If task 1 is done, then task 2 should be set as current. But i did not work, the marker from task1 is still highlighted althought task1 is shown as completed.

Share this post


Link to post
Share on other sites

But can't you simply click on the 'Set as current task" on the map screen?

Share this post


Link to post
Share on other sites

Yes, but this is a stupid solution i think.

There must be a way to do that, hopefully.

Share this post


Link to post
Share on other sites

nul = [objNull, objNull, task2, "CURRENT"] execVM "CA\Modules\MP\data\scriptCommands\taskHint.sq f";

"current" is invalid state? Possible ones are succeeded, failed, created and canceled. Not sure if it affects anything though. Oh and, you have a space between sq and f there.

Share this post


Link to post
Share on other sites

The space is only here in forum...dont know why.

Share this post


Link to post
Share on other sites

I had the same problem, Wiggum.

But i find a interesting function called BIS_fnc_taskManager. This function automatically sets tasks as current. You only set priorities for your tasks (lower number means higher priority). It also randomize the selection of tasks with the same priority.

Example:

[
						BIS_cooper,
					[
						["objShaftoe",   		1],
						["objGorka",			3],
						["objNikolayev",		5],
						["objLagushina",   		5],
						["objSmugglers",   		5],
						["objFindBase",    		4],
						["objSentries",   		3],
						["objLeader",			3],
						["objDestroyBase",		3],
						["objEscortLagushina",	1],
						["objRescueCrew",   	2],
						["objSafehouse",    	3],
						["objMaksim",    		6],
						["objEvidence",    		7]
					]
				] call BIS_fnc_taskManager

I'll give this a try tomorrow.

Share this post


Link to post
Share on other sites

Sounds good. If you figured out how it works let me know.

Share this post


Link to post
Share on other sites

No clue why...but since i added the new task "task3" to my briefing.sqf it works well.

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  

×