---
name: "BIS_fnc_taskHandler"
type: function
status: ok
groups: ["Tasks"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/BIS_fnc_taskHandler
revid: 379574
updated: 2026-10-31T14:02:31Z
---

# BIS_fnc_taskHandler

*Function · Tasks · Arma 3 v0.50 · introduced in Arma 2 v1.00*

## Description

Task handler: automatically sets a unit's current task. Whenever the unit receives a new task or a task is completed, the uncompleted task with the highest priority (lowest number) becomes current; among tasks of equal priority, the one with the nearest destination is chosen.
The function is meant to be called by mission scripts; no Arma 3 script calls it. It must be called where the unit is [local](../commands/local.md):

- the handler (*A3\functions_f\misc\fn_taskHandler.fsm*) is started only if the unit or a member of its group is a [player](../commands/player.md), and only once per group;
- it ends when the unit dies or when its "BIS_taskHandler_stop" variable is set to [true](../commands/true.md), and is restarted for the new unit after respawn;
- if AI tasks are enabled (*BIS_missionScope* variable "BIS_useAITasks" is [true](../commands/true.md) or an array containing the unit), *A3\functions_f\misc\fn_AITasks.fsm* is started for the unit as well; on the server it is started for a non-local unit once the unit becomes local (e.g. after its player disconnects).

> [!IMPORTANT]
> This is legacy Arma 2 code: it only handles tasks created through the Arma 2 Multiplayer Framework (stored in *BIS_missionScope*) and sets the current task through the framework function *RE*, which is not part of Arma 3's Functions Library. For Arma 3 tasks see [Arma 3: Task Framework](../topics/Task_Framework.md).

## Syntax

```sqf
[unit, taskPriorities] call BIS_fnc_taskHandler
```

**Parameters:**

- `unit`: [Object](../topics/Object.md) - unit whose tasks are handled
- `taskPriorities`: [Array](../topics/Array.md) of [Arrays](../topics/Array.md) in format [taskLink, priority]:

  - taskLink: [String](../topics/String.md) - link (variable name) of a task created through the Multiplayer Framework
  - priority: [Number](../topics/Number.md) - task priority; a lower number means a higher priority

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

```sqf
[
    BIS_cooper,
    [
        ["objShaftoe", 1],
        ["objEscortLagushina", 1],
        ["objRescueCrew", 2],
        ["objGorka", 3],
        ["objFindBase", 4]
    ]
] call BIS_fnc_taskHandler;
```

### Example 2

Stop the handler for a unit:

```sqf
BIS_cooper setVariable ["BIS_taskHandler_stop", true];
```

## See also

[currentTask](../commands/currentTask.md) · [setCurrentTask](../commands/setCurrentTask.md) · [simpleTasks](../commands/simpleTasks.md) · [Arma 3: Task Framework](../topics/Task_Framework.md)

<sub>Source: [BI Community Wiki — BIS fnc taskHandler](https://community.bistudio.com/wiki/BIS_fnc_taskHandler) (revision 379574).</sub>
