Arma 3 Scripting

Arma 3: Task Framework Tutorial

  • Also known as Arma 3 Task Framework Tutorial

Topic · Markdown · JSON · original wiki page

Basics

Tasks are a group's objectives. Arma 3 introduced the Arma 3: Task Framework to work with tasks with ease.
The Task Framework functions have a global effect.

Note

For Arma 2's Task Tutorial, see Arma 2: Task Tutorial.

How to Use a Task

Create a Task

private _title = "Get the documents";
private _description = "Enter the house to find the documents. Hurry, as the enemy is on its way.";
private _waypoint = "House";

private _myTask = [groupOfPlayers, "taskID", [_description, _title, _waypoint], objDocuments, true] call BIS_fnc_taskCreate;

Note

The "taskID" argument is the task's ID used for later references. This string gets defined here on creation and must be unique for each task. It should be kept short for network economy.

Assign a Task

"taskID" call BIS_fnc_taskSetCurrent;

Note

This step is optional here as we used true as the fifth argument of the BIS_fnc_taskCreate call, making it the current task.

Set a Task's Type

["taskID", "attack"] call BIS_fnc_taskSetType;

Note

This could have been set in the task creation call as the eighth argument. See BIS_fnc_taskCreate's type parameter.

Set a Task's Visibility

["taskID", true] call BIS_fnc_taskSetAlwaysVisible;

Update a Task's Description

// hardcoded language
_description = _description + "<br/><br/>UPDATE: an officer stole the documents; we got the GPS tracking, follow your HUD.";
["taskID", [_description, _title, _waypoint]] call BIS_fnc_taskSetDescription;

// new description
["taskID", ["STR_TaskDescription2", _title, _waypoint]] call BIS_fnc_taskSetDescription;

Update a Task's Waypoint Position

["taskID", [theOfficer, true]] call BIS_fnc_taskSetDestination;

Update a Task's Status

["taskID", "SUCCEEDED"] call BIS_fnc_taskSetState;

Delete a Task

["taskID"] call BIS_fnc_deleteTask;

How to Read a Task's Information

Find if a Task Exists

["taskID"] call BIS_fnc_taskExists;

Find if a Task is Completed

"taskID" call BIS_fnc_taskCompleted;

Note

"Completed" means that the task is either "SUCCEEDED", "FAILED" or "CANCELED".

Multiple Tasks Check

["taskID_0", "taskID_1", "taskID_2"] findIf { !(_x call BIS_fnc_taskCompleted) } == -1;

Get a Task's Status

"taskID" call BIS_fnc_taskState;

Get a Task's Type

"taskID" call BIS_fnc_taskType;

Get a Task's Visibility

"taskID" call BIS_fnc_taskAlwaysVisible;

Get a Task's Description

"taskID" call BIS_fnc_taskDescription;

Get a Task's Destination

"taskID" call BIS_fnc_taskDestination;

Get a Unit's Tasks

private _taskIDs = player call BIS_fnc_tasksUnit;

Advanced

Note

All these details can be found in the Description.ext's Tasks chapter.

Define a Task in Mission Config

You can define a task in Description.ext's CfgTaskDescriptions:

class CfgTaskDescriptions
{
    class myTask1
    {
        title        = "my task title";
        description    = "my task description";
        marker        = "my task destination marker";
    };
    class myTask2
    {
        title        = "STR_myTask2Title";            // note the lack of $ sign here!
        description    = "STR_myTask2Description";        // without $, it translates for each client
        marker        = "STR_myTask2Marker";            // with $ everyone sees the server's language
    };
};

Define a new Task Type

class CfgTaskTypes
{
    class Attack
    {
        icon    = "\A3\UI_F_MP_Mark\Data\Tasks\Types\Attack_ca.paa";
        icon3D    = "\A3\UI_F_MP_Mark\Data\Tasks\Types3D\Attack_ca.paa";
    };
    class Defend
    {
        icon    = "\A3\UI_F_MP_Mark\Data\Tasks\Types\Defend_ca.paa";
        icon3D    = "\A3\UI_F_MP_Mark\Data\Tasks\Types3D\Defend_ca.paa";
    };
};

Define Task Display Behaviour

class CfgTaskEnhancements
{
    enable       = 1; // 0: disable new task features (default), 1: enable new task features & add new task markers and task widgets into the map
    3d           = 1; // 0: do not use new 3D markers (default), 1: replace task waypoints with new 3D markers
    3dDrawDist   = 0; // 3d marker draw distance (default: 2000)
    share        = 1; // 0: do not count assigned players (default), 1: count how many players have the task assigned
    propagate    = 1; // 0: do not propagate (default), 1: propagate shared tasks to subordinates
};

See Also