#include "..\script_component.hpp" /* * Author: IDSolutions * Assigns an IED to a task and starts its required countdown timer * * Arguments: * 0: The object * 1: ID of the task * 2: Countdown timer in seconds (must be greater than 0) * * Return Value: * None * * Example: * [this, "task_name", 30] spawn forge_server_task_fnc_makeIED; * * Public: Yes */ params [["_entity", objNull, [objNull]], ["_taskID", "", [""]], ["_time", 0, [0]]]; if (isNull _entity) exitWith { ["ERROR", "Attempt to create entity from null object"] call EFUNC(common,log); }; if (_taskID == "") exitWith { ["ERROR", "No task ID provided for entity"] call EFUNC(common,log); }; if (_time <= 0) exitWith { ["ERROR", "Invalid time provided for IED"] call EFUNC(common,log); }; ["INFO", format ["Make IED: %1", _this]] call EFUNC(common,log); SETPVAR(_entity,assignedTask,_taskID); GVAR(TaskStore) call ["registerTaskEntity", ["ieds", _taskID, _entity]]; if (alive _entity) then { [_entity, "ied", _time] spawn FUNC(heartBeat); };