Task Tutorial – Arma 2
Important Information
In Arma 3 version 1.58 task system was greatly enhanced. To name few of the improvements:
- improved 2D & 3D visualization
- improved UX (user experience)
- new features - e.g. shared objectives, task overview, always visible tasks, task types, ...
Check Arma 3 Tasks Overhaul page for more information.
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".
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
- 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;