Arma 2: Task Tutorial
- 1 Basics
- 2 Good To Know
- 3 How to use a task
- 4 How to read a task's information
- 5 See also
As opposed to the previous system:
- Tasks can be created at any time from anywhere (trigger, script, etc). They do not need to be created in an external file.
- Tasks are created "on the fly" as they are required and not "hidden/shown" anymore.
Task states are in String format.
Good To Know
Tasks are unit-specific. They are created to a unit and not to a client (computer). For example if you create a task for the player unit then teamSwitch to another unit, this new unit won't have any task. If you switch back to the original unit, it will have this created task.
The value returned by createSimpleTask is a unique handle to the unit's task, 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.
How to use a task
Create a task
private _myTask = player createSimpleTask ["taskName1"];
Set a task's description
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"; _myTask setSimpleTaskDescription [_description, _title, _waypoint];
Assign a task
_myTask setTaskState "Assigned"; player setCurrentTask _myTask;
Set a task's destination
_myTask setSimpleTaskDestination getPosATL objDocuments; // a position // or _myTask setSimpleTaskTarget [objDocuments, true]; // an object - Arma 2 OA v 1.55
Set a task's state
_myTask setTaskState "Succeeded";
Delete a task
player removeSimpleTask _myTask;
How to read a task's information
Get a task's state
Get a task's description
Get a task's destination