Task Tutorial – Arma 2

From Bohemia Interactive Community
Revision as of 21:56, 9 September 2019 by Lou Montana (talk | contribs) (Lou Montana moved page Tasks to Arma 2:Task Tutorial: I wanted to)
Jump to navigation Jump to search

Template:Feature arma3

Using the Arma 3 Task Framework instead is recommended

Description

Tasks were introduced in ArmA 2 and improved in Arma 3. They replaced the old objective system used in Armed Assault and Operation Flashpoint.

Basics

Creation

Tasks can be created at any time from anywhere (trigger, script, etc). They do not need to be created in an external file.

Hiding

As opposite to the old method of showing and hiding objectives, tasks are instead created "on the fly" as they are required.

State

Task state is in String format. The possible state of a task is one of these:

  • "Assigned"
  • "Canceled"
  • "Created"
  • "Failed"
  • "Succeeded"

Icon / Color

Arma 2

Task States
  • Assigned: gray
  • Canceled: one gray diagonal line
  • Created: black (empty)
  • Failed: red X
  • Succeeded: green


Good To Know

Creation

Tasks are unit (object) specific. They are created to a unit and not to a client (human player). The effect is local and should be executed on every client.

For example: You start mission in a unit which is named "unit1". The briefing creates following task:

task1 = unit1 createSimpleTask ["taskName1"];

Now, if you teamSwitch to another unit, he will not have the task. This is common with the usual "task = player createsimpletask" type of creation as the task will only be created to the unit player is referring to.

Return Variable / Handle

Command createSimpleTask returns a handle (variable which refers to the created task). Each task has a unique handle. Even using same line of code on different client will result in a different handle for the "same" task.


Examples

Creation

Simplest

task1 = player createSimpleTask ["taskName1"];

Common

task1 = player createSimpleTask ["taskName1"];
task1 setSimpleTaskDescription ["To be successful in this example task you need to...","Example Task",""];

Advanced

task1 = player createSimpleTask ["taskName1"];
task1 setSimpleTaskDescription ["To be successful in this example task you need to...","Example Task",""];
task1 setTaskState "Assigned";
player setCurrentTask task1;

Update

Simplest

task1 setTaskState "Succeeded";

Common

task1 setTaskState "Succeeded";
task2 setTaskState "Assigned";
player setCurrentTask task2;

Advanced

task1 setTaskState "Succeeded";
task2 = player createSimpleTask ["taskName2"];
task2 setSimpleTaskDescription ["Another task has been issued...","Another Example Task",""];
task2 setTaskState "Assigned";
player setCurrentTask task2;


See also

briefing, Arma 3 Tasks Overhaul