Jump to content

Recommended Posts

As I'm not going to update the Arma 2 version, and it seems this script might work on A3 with minor changes, I'll post it here so we can work on it together. zuff and cuel already made some fixes for the hint notification in the A2 thread. I've included those in the version posted here.

Disclaimer: I still don't have time or motivation for the game. So, I have not tested this script in A3 myself. However, I will do my best to make this work if there are bugs/changes needed.

Features:

- The script is server driven; all task additions and updates are called on server side. All changes are broadcasted to players in one array variable. This enables more work to be done only on server, since most of AI-related things happen there anyway. This way the number of triggers placed goes down, as they are unnecessary for clients (players). Number of publicvariabled variables goes down also.

- Only one eventhandler is created instead of one per task.

- As tasks are kept in an array, no global variable is created for each task.

- No "call compile format" type of coding.

- Variables used to check for task states and statuses are replaced with functions, cutting down number of global variables.

- Usage simplified; briefings are easier to create, some parameters are made optional.

Creating a briefing in init.sqf

[[
 ["Task1","Task1Title","Task1Desc"],
 ["Task2","Task2Title","Task2Desc",true,["markerTask2",getpos obj2]]
],[
 ["Note1","Hello West",WEST],
 ["Note2","Hello East",EAST],
 ["Credits","Made by: Shuko of LDD Kyllikki<br />www.kyllikki.fi"]
]] execvm "shk_taskmaster.sqf";
 

Task Data

["TaskName","Title","Description",Condition,[Marker],"State",Destination]

Required parameters:
TaskName      string     Name used to refer to the task
Title         string     Task name shown in the in/game task list
Description   string     Task description, the actual text body

Optional parameters:
Condition     boolean/side/faction/unit/group/string/array   Units the task is added to. Default is everyone
Marker        array     Marker related to the task. It will be created only for the units who have the task. Marker will be hidden after task is completed. Can be an array of marker arrays, if you want to create multiple markers.
 Name        string    Name of the marker to create.
 Position    string    Position of the marker.
 Type        string    Marker type. Optional, default is "selector_selectedMission".
 Color       string    Marker color. Optional, default is red.
State         string    Task state of the newly created task. Default is "created".
Destination   object/position/marker   Place to create task destination (game's built-in waypoint/marker). If an object is given, setSimpleTaskTarget command is used, attaching the destination to it.
Shape         string    Marker shape: Icon, Ellipse, Rectangle
Size          number or array     Marker size. If number given, it's used for both X and Y dimension.
 

Condition (limiting the units to who the tasks and notes are created)

Examples:
 [...,WEST]               All playable units on BLUFOR (WEST)
 [...,"USMC"]             Faction USMC
 [...,grpMarine1]         Units that belong to group named grpMarine1
 [...,myDude]             Unit named myDude
 

Then there is the IF syntax, so you can create a condition anyway you want, where _x is the unit (=player).

Examples:
 "((group _x == grpScouts) OR (_x == pilot1))"     Members of grpScouts and unit named pilot1
 "(typeof _x == ""CDF_Soldier_Sniper"")"           All CDF snipers
 

TaskState

The task state of the newly created task. Valid states are succeeded, failed, canceled and assigned. Default is assigned.

Note Data

[NoteTitle,NoteText,Condition]

Required parameters:
 NoteTitle     string     Text shown in the list
 NoteText      string     The actual note text body

Optional parameters:
 Condition    boolean/side/faction/unit/group/string   Units the note is added to. Default is everyone.
 

Updating tasks

Task states are updated by calling a function. Possible states are: succeeded/failed/assigned/canceled.

Example: ["Task1","succeeded"] call SHK_Taskmaster_upd;
 

It's possible to set state of one task and set another as assigned using an optional 3rd parameter.

Example: ["Task1","succeeded","Task2"] call SHK_Taskmaster_upd;
 

This will make task state of task Task1 to succeeded and the state of the task Task2 as current.

Another optional 3rd parameter can be used to add a new task after updating another task.

Example: ["Task1","succeeded",["Task2","Title","Desc"]] call SHK_Taskmaster_upd;
 

This will make task Task1 as succeeded and create a new task Task2. Same set of parameters is used for the creation as in init.sqf or SHK_Taskmaster_add.

Creating tasks during a mission

Tasks can be added after briefing with the add function. Same set of parameters is used as in creating a briefing. The new task is set as current task automatically.

Example: ["Task2","Extraction","Get to teh choppa!"] call SHK_Taskmaster_add;
 

Functions

SHK_Taskmaster_isCompleted

This function can be used to check if task(s) is completed. Task is considered completed with states succeeded, failed and canceled. Function returns a boolean (true/false) value.

Example: "Task1" call SHK_Taskmaster_isCompleted
 
Multple task example: ["Task1","Task2"] call SHK_Taskmaster_isCompleted
 

SHK_Taskmaster_areCompleted

Same as above, but only takes an array as parameter.

SHK_Taskmaster_getAssigned

Returns list of tasks which have "assigned" as their state.

Example: call SHK_Taskmaster_getAssigned
Example result: ["Task1","Task4"]
 

SHK_Taskmaster_getState

Returns the task state (succeeded/failed/canceled/assigned/created).

Example: "Task1" call SHK_Taskmaster_getState
 

SHK_Taskmaster_hasState

Checks if a task's state matches the given state. Function returns a boolean value.

Example: ["Task1","succeeded"] call SHK_Taskmaster_hasState
 

SHK_Taskmaster_hasTask

Checks if a task with the given name has been created. Returns boolean.

Example: "Task1" call SHK_Taskmaster_hasTask
 

SHK_Taskmaster_setCurrentLocal

Sets the given task as the current task.

Example: "Task1" call SHK_Taskmaster_setCurrentLocal
Multiplayer Example: ["Task1","SHK_Taskmaster_setCurrentLocal",true,true] call BIS_fnc_MP
 

SHK_Taskmaster_addNote (client side only)

Creates a briefing note. This can only be used on client side, and it's not boardcasted for other players.

Parameters: ["Title","TextBody",Condition], Condition is optional.

Example: ["Enemy forces","Oh noes, there will be enemy soldiers in the area of operation."] call SHK_Taskmaster_addNote
 

Files

 

2021 reupload https://drive.google.com/drive/folders/1XXrSZbu7nCaW2UkOVsaVbKmX0ZmfFUtg?usp=sharing

 

Feel free to use anyway you like, or dont. 🙂

  • Like 5

Share this post


Link to post
Share on other sites

Does anyone know why the tasks are making three/four at a time? It happens when I create them during the mission for some reason... Also, I am creating the tasks with this (see below) but through a script which I have done before which worked fine.

["Task2","Task 2","Fly to Camp Tempest and check out the area."] call SHK_Taskmaster_add;

Dirty Haz

Share this post


Link to post
Share on other sites

Good to see this updated for A3. Love it

Share this post


Link to post
Share on other sites
Does anyone know why the tasks are making three/four at a time? It happens when I create them during the mission for some reason... Also, I am creating the tasks with this (see below) but through a script which I have done before which worked fine.

["Task2","Task 2","Fly to Camp Tempest and check out the area."] call SHK_Taskmaster_add;

Dirty Haz

Are you trying to create multiple tasks at the same time? If so that's probably why it's happening, a guy I know (bangabob on here) had that problem anyways when he tried to create a few tasks through the same trigger.

---------- Post added at 23:29 ---------- Previous post was at 23:14 ----------

Btw shuko, the only thing I've seen it give an error for so far on Arma 3 was using a group name as the condition. It still worked but gave an error message which went away when I switched it to just east/west instead.

Edited by clydefrog

Share this post


Link to post
Share on other sites

I am creating the tasks in the same script which I have done before which worked. The creation of the tasks have delays between them too...

Dirty Haz

Share this post


Link to post
Share on other sites
Guest

Release frontpaged on the Armaholic homepage.

===================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Share this post


Link to post
Share on other sites

Fixed, the solution was in the readme file all along...

If multiple add/upd calls are used nearly simultaniously (for example in same onAct field of a trigger) the tasks can multiply.

This is because the script uses publicvariable and publicvariable eventhandler syncing. First command needs to travel over the net

from server to clients and be processed before another update comes in. Way to avoid this issue is to add some waiting between the

calls, for example "sleep 1;".

Dirty Haz

Share this post


Link to post
Share on other sites

I've been using the taskmaster for ages. Works perfectly. Cheers for the great work Shuko!

Share this post


Link to post
Share on other sites
[/color]Btw shuko, the only thing I've seen it give an error for so far on Arma 3 was using a group name as the condition. It still worked but gave an error message which went away when I switched it to just east/west instead.

How exactly was the group condition used?

Share this post


Link to post
Share on other sites
How exactly was the group condition used?

like this:

["Task1","Retrieve the box","Retrieve the package and transport it back to the Blufor camp",bluforgroup],

Share this post


Link to post
Share on other sites
So were your delays just too short then?

I never had no delays at all. :)

Dirty Haz

Share this post


Link to post
Share on other sites

Is there a way I can make a task that will succeed for Blue but Fail for Red - without making two tasks (one for each side)?

thanks great script.

Share this post


Link to post
Share on other sites

thanks, thought so.

Edited by KevsnoTrev
speeling!

Share this post


Link to post
Share on other sites

having an issue...

I have a multiplayer mission that uses a radio command to select a marker on the map and spawn OPFOR on that maker and create a task for that marker. With only one player in the mission, this works perfectly and I only get one marker on the map. When there is more than one player however, I get two markers at a time. Any ideas?

Share this post


Link to post
Share on other sites

A radio is a trigger on the map. A trigger on the map executes for the server and each client on the map. Always be careful spawning things from triggers and make sure only the server does by running a script and having a isServer check at the top or something similar.

Share this post


Link to post
Share on other sites
A radio is a trigger on the map. A trigger on the map executes for the server and each client on the map. Always be careful spawning things from triggers and make sure only the server does by running a script and having a isServer check at the top or something similar.

Thank you very much for your quick reply. I thought that something like that was occurring but was not sure. I removed the radio trigger and instead am using an addAction in the init.sqf but now the it will not add a new task. It works fine from the editor but won't create a task if in multiplayer. Sorry for being a scripting newb. :(

Thanks again.

Share this post


Link to post
Share on other sites

That is probably because actions added with addAction are run locally. So, when a player uses an action the server will not know anything about it, unless you tell it.

Share this post


Link to post
Share on other sites

Thanks everyone for your assistance. I used Kylania's recommendation and added an isServer check in the .sqf that I was calling from the radio trigger and it's working great now. It turned out that the issue I was having had nothing to do with SHK_Taskmaster. My error.. newb scriptor here.

On another note... I was trying to to use a variable for the task name in the call line to create a task using SHK_Taskmaster and am having some issues there though. Basically, I have created a script that allows you to request a task via Radio Alpha. What I wanted to do was to create a variable, like taskNumber = 0; and then each time a request for a task is performed, increment taskNumber +1, then create a string for the task name, like taskNumberString=("Task" + str(taskNumber)), then use taskNumberString (the variable) as the task title in the call line to create a new task via SHK_Taskmaster. When I set this up in my script though, I received an error when trying to create the task regarding the task name. Sorry I don't have the exact error message as I am not at home right now.

My goal was to keep a list of the tasks going so at the end of the play time on the mission, I could review how many tasks were created and completed. Right now I am stuck with just having the same task name used over and over in the script that creates the task and even after completely more than one task, the mission only sees it as one taske being completed. (I hope that makes sense.)

I'm just amazed at the talent of the people that work on scripts for Arma though.. truely amazing work.

Edited by Zlin

Share this post


Link to post
Share on other sites

Hi Shuko

I have done 2 mission in Arma 3, with the last one I started using the modules it was a pain to do, but I did get the first 2 tasks to work, I am now using your program to do it, & have redone the modules work

with this code.

[[

["Task1","Find the old abandoned base",

"HQ said we have an <marker name=mkr1>old abandoned base</marker> South East, where we could find Weapons and Ammo, check it out",

true,["markerTask1",getpos task1mkr]],

["Task2","Find the OPFOR boats",

"After you get your supplys move to <marker name=mkr2>the old town at the cost</marker> and steal the boats from the OPFOR Units",

true,["markerTask2",getpos task2mkr]]

],

[

["Note1","Hello West",WEST],

["Note2","Hello East",WEST],

["Credits","Made by: Gazac"]

]]

execvm "shk_taskmaster.sqf";

----------

Sorry 1st time here don't know how the use the editor for code!

it does work great, but I have a problem, the 2 tasks are showing in the map tasks, when I used the modules I could have only the 1st task shown & when it was completed the 2nd task show up

how do I do this with your s/program, also I'm at a lost with doing markers in the code, & do I need to place them on the map?

Thank you

Gazac

from Australia

Share this post


Link to post
Share on other sites

You'd use the taskMaster_add function to create new tasks.

Example: ["Task2","Extraction","Get to teh choppa!"] call SHK_Taskmaster_add;

The only thing you need for marker is the position where it should be, can be anything from an array to an object.

 Name        string    Name of the marker to create.
 Position    string    Position of the marker.
 Type        string    Marker type. Optional, default is "selector_selectedMission".
 Color       string    Marker color. Optional, default is red.
State         string    Task state of the newly created task. Default is "created".

["MyMarker2",[1234,1234,0],"selector_selectedMission","ColorRed"]

Share this post


Link to post
Share on other sites

Hey.

In line 309 of your file, you got

if (_cond in ["USMC","INS","CDF","RU","CIV","GUE","CIV_RU"]) then {

Can i change that to the Arma 3 units without messing it up?

Share this post


Link to post
Share on other sites
Hey.

In line 309 of your file, you got

if (_cond in ["USMC","INS","CDF","RU","CIV","GUE","CIV_RU"]) then {

Can i change that to the Arma 3 units without messing it up?

Yes you can do that. However, I updated it myself and uploaded the new version.

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

×