Arma 2: Task Tutorial

From Bohemia Interactive Community
Revision as of 20:11, 28 July 2010 by Shuko (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Description

Tasks were introduced in ArmA 2. 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 a file called "briefing.sqf".

State

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

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

Icon / Color

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).


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;