BIS_fnc_taskHandler
- Arma 3 v0.50
- First in Arma 2 v1.00
Function · Markdown · JSON · original wiki page
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:
- the handler (A3\functions_f\misc\fn_taskHandler.fsm) is started only if the unit or a member of its group is a player, and only once per group;
- it ends when the unit dies or when its "BIS_taskHandler_stop" variable is set to true, and is restarted for the new unit after respawn;
- if AI tasks are enabled (BIS_missionScope variable "BIS_useAITasks" is true 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.
Syntax
[unit, taskPriorities] call BIS_fnc_taskHandler
Parameters:
-
unit: Object - unit whose tasks are handled -
taskPriorities: Array of Arrays in format [taskLink, priority]:
Returns: Nothing
Examples
Example 1
[
BIS_cooper,
[
["objShaftoe", 1],
["objEscortLagushina", 1],
["objRescueCrew", 2],
["objGorka", 3],
["objFindBase", 4]
]
] call BIS_fnc_taskHandler;
Example 2
Stop the handler for a unit:
BIS_cooper setVariable ["BIS_taskHandler_stop", true];
See also
currentTask · setCurrentTask · simpleTasks · Arma 3: Task Framework