Jump to content
Sign in to follow this  
shockero

Multiplayer Tasks + addaction

Recommended Posts

I'm trying to make an mission with one "Main mission task"(activated by trigger,other players CAN see the tasks here) and side missions(activated via "addaction" thingy)for example: go to an civilian and select the mission you want. Now here's my problem,only the caller get the task,other players don't(YES, I know that there's something to do with "publicVariable" but I can't seem to get what or where to use that). Another problem is that tasks dosen't get updated for other players, only for the TeamLeader of the group.

Here is one of the scripts i'm using..

(Task 3 called via addaction)

/*

* Mikey's Briefing Template v0.02

* change the name to briefing.sqf to use in your mission...added by {USI}_Zombie/{USI} Studios

*

* 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 variable names.

*

*

* 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 an existing marker!

* - Set the Current Task: player setCurrentTask tskExample;

*

* Formatting:

* - 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'/>

* - custom width/height: <img image='somePic.jpg' width='200' height='200'/>

*

* Commands to use in-game:

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

* - 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 tskExample and the mk_fTaskHint function exist

*

*

* Authors: Jinef & mikey

*/

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

waitUntil { !isNull player }; // all hip now ;-)

waitUntil { player == player };

switch (side player) do

{

case WEST: // BLUFOR briefing goes here

{

};

case EAST: // REDFOR briefing goes here

{

};

case RESISTANCE: // RESISTANCE/INDEPENDENT briefing goes here

{

taskhint ["Task Assigned!\nBring back crates!", [1, 4, 1, 4], "taskCurrent"];

tsk3 = player createSimpleTask["Construction crates"];

tsk3 setSimpleTaskDescription["Bring back the construction crates from an abandoned location

<br/>GRID 019007<br/>

<br/>REWARD: 2X HEAT RPG-7 Rockets<br/>.", "Construction crates", "TSK3"];

player setCurrentTask tsk3;

};

case CIVILIAN: // CIVILIAN briefing goes here

{

};

};

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

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

{

player addEventHandler ["killed",

{

[] spawn {

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

execVM "briefing.sqf"; // make sure this path is correct

};

}];

player setVariable ["mk_briefingEH", true];

};

sleep 2;

s1 removeAction 0

Task 3 done

waitUntil { !isNull player }; // all hip now ;-)

waitUntil { player == player };

"player" objStatus "DONE"; tsk3 setTaskState "SUCCEEDED";tsk3 = true; publicVariable "tsk3";

taskhint ["Task Succeeded!\nGet your reward!", [0.600000,0.839215,0.466666,1], "taskDone"];

RPG hideObject false;

s1 removeAction 1;

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

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

{

player addEventHandler ["killed",

{

[] spawn {

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

execVM "briefing.sqf"; // make sure this path is correct

};

}];

player setVariable ["mk_briefingEH", true];

};

RPG hideObject false;

s1 removeAction 1;

I've also searched on different forums about this, found some solutions, but unfortunately they don't seem to work for me,and I've got no idea how to use "Taskmaster" if someone says something about it.

PS: I'm pretty new at scripting tasks.

Share this post


Link to post
Share on other sites

Your task3 done stuff is some super old code. All you need from that is this:

tsk3 setTaskState "SUCCEEDED";
taskhint ["Task Succeeded!\nGet your reward!", [0.600000,0.839215,0.466666,1], "taskDone"];

RPG hideObject false;
s1 removeAction 1;

The rest was from when tasks didn't survive respawns and ArmA1's objective system (all the objstatus and public variable stuff).

The problem you're running into is addAction, since that's a local command. Meaning that it's only viewable and only affects whatever client ran it.

One method you might want to do is have a trigger add the task3 instead of a script. Have the addAction set a variable and publicize it.

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  

×