When passing a task to addAction in the arguments paramater the task object is reported as "any" and not the task object.
Description
Details
- Legacy ID
- 1439945735
- Severity
- None
- Resolution
- Open
- Reproducibility
- Always
- Category
- Scripting
add
this addAction ["Pickup Intel", "objectiveGather.sqf", [objTaskOne, 158], 1, false, false, "", ""];
To any object and use the following as the objectiveGather.sqf script:
_object = (_this select 0);
_soldier = (_this select 1);
_actionid = (_this select 2);
_thetask = (_this select 3) select 0;
_rotation = (_this select 3) select 1;
diag_log format["Task: %1", _thetask];
diag_log format["Rotation: %1 for %2", _rotation, _object];
_object attachTo [_soldier, [-0.18, -0.03, 0.03], "Pelvis"];
_object setdir _rotation;
the diag_log reports in the rtf file as Task: any an not the task object meaning you are unable to run:
_thetask setTaskState "Succeeded";
To update that specific task. The _rotation parameter sent works, but the _thetask does not.
I have tried many permutations to attempt to get any Task object passed like this. I understand that ARMA 3 allows the passing of any object as a parameter, including a Task object but I cannot use this method as the sqf fails to see _thetask as a Task object. The tasks are created in the briefing.sqf file as follows:
player createDiaryRecord ["Diary", ["Mission: Recover the Intel", "Your mission is to recover an important piece of intel from OPFOR hands. You must try remain undetected during the mission, it will make for you easier."]];
objTaskOne = player createSimpleTask ["Recover the Intel."];
objTaskOne setSimpleTaskDescription ["In Camp Rogain, the OPFOR have valuable intel we need, go recover it.", "Get the Intel", "Pickup the Intel"];
objTaskOne setSimpleTaskDestination (getMarkerPos "objTask1");
objTaskTwo = player createSimpleTask ["Kill the Bad Guy", objTaskOne];
objTaskTwo setSimpleTaskDescription ["Kill the Bad Guy", "Kill the Bad Guy", "Kill the Bad Guy"];
objTaskTwo setSimpleTaskDestination (getMarkerPos "objTask2");
player setCurrentTask objTaskOne;
player setCurrentTask objTaskTwo;