Advertisement

Author Topic: Task_manager function  (Read 258 times)

0 Members and 1 Guest are viewing this topic.

Offline Imutep

  • ArmAdeus
  • Members
  • *
  • What?
    • Assault Mission Studio
Task_manager function
« on: 22 Jul 2009, 22:57:27 »
Ifind a interesting function called BIS_fnc_taskManager. This function automatically sets tasks as current. You only set priorities for your tasks (lower number means higher priority). It also randomize the selection of tasks with the same priority. But i can't get it to work. Has anybody an idea how we/I can get it to work? Is this only for MP?  :dunno:

You can find this function under ArmA 2\AddOns\modules\Functions\misc\fn_taskHandler

Code: [Select]
/*******************************************************************************
 *
 * version: 1.0
 * name: Task handler
 * description: automatically sets tasks as current
 * author: Chose
 * paramaters: _this select 0: a unit whose tasks will be handled (Array)
  _this select 1: links to tasks created via MP Framwork with
  priorities (loewr number means higher
  priority)
 * return value: none

 * TODO: * generalize so it can be used in WF
  * add support for standard tasks
  * randomize the selection of tasks with the same priority
 ******************************************************************************/

[
  BIS_cooper,
[
["objShaftoe",    1],
["objGorka", 3],
["objNikolayev", 5],
["objLagushina",    5],
["objSmugglers",    5],
["objFindBase",    4],
["objSentries",    3],
["objLeader", 3],
["objDestroyBase", 3],
["objEscortLagushina", 1],
["objRescueCrew",    2],
["objSafehouse",    3],
["objMaksim",    6],
["objEvidence",    7]
]
] call BIS_fnc_taskManager

//validity checks
if (typeName (_this select 0) != "OBJECT") exitWith {debugLog format ["Error: taskHandler.sqf :: 1st parsed variable is %1 must be OBJECT!!!", typeName (_this select 0)]};
if (typeName (_this select 1) != "ARRAY") exitWith {debugLog format ["Error: taskHandler.sqf :: 2nd parsed variable is %1 must be ARRAY!!!", typeName (_this select 1)]};
if ({typeName (_x select 0) != "STRING"} count (_this select 1) > 0) exitWith {debugLog "Error: taskHandler.sqf :: All of the task links must be STRING!!!"};
if ({typeName (_x select 1) != "SCALAR"} count (_this select 1) > 0) exitWith {debugLog "Error: taskHandler.sqf :: All of the task priorities must be SCALAR!!!"};

//execute the FSM
BIS_taskHandler = _this execFSM "ca\modules\functions\misc\fn_taskHandler.fsm"
Assault Mission Strudio<br />It\'s always something!!

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Task_manager function
« Reply #1 on: 23 Jul 2009, 14:59:14 »
Uhm, why did you uncomment the example?  ???

Anyway, the function "BIS_fnc_taskHandler" appears several times in the campaign (it's called from "C1_IntoTheStorm.Chernarus\grpMain.fsm" for example). So it might be worth to take a look at this file and see how the function is used.
try { return true; } finally { return false; }