Forum Jump :

Author Message


Posts: 2
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name: publicFunction

 
#1 Posted at 2013-09-25 19:23        
     
Hi all,

I am trying to get a task to update when passed through addAction as an argument.

Breifing.sql
Creating and assinging the required Task(s) to player
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;

diag_log objTaskOne;
diag_log objTaskTwo;

addAction on the object in question
Adding the addAction and 2 arguments one being the task and the other an integer for the _rotation for setdir.
player_objective addAction ["Pickup Intel", "objectiveGather.sqf", [objTaskOne, 158], 1, false, false, "", ""];

objectiveGather.sqf
This is the sqf file is supposed to deal with knowing the task object to update its state and assign the _object to the player by attachTo.
_object = (_this select 0); 
_soldier = (_this select 1); 
_action_id = (_this select 2);
_the_task = (_this select 3) select 0;
_rotation = (_this select 3) select 1;
_the_tasks = simpleTasks _soldier;

diag_log format["Task: %1", _the_task];
diag_log format["Rotation: %1 for %2", _rotation, _object];
diag_log format["All Tasks: %1", _the_tasks];

_object attachTo [_soldier, [-0.18, -0.03, 0.03], "Pelvis"];
_object setdir _rotation;

//_the_task setTaskState "Succeeded";

The error(s) I get as as follows:
Error in expression < _soldier;

diag_log format["Task: %1", _the_task];
diag_log format["Rotation: %>
  Error position: <_the_task];
diag_log format["Rotation: %>
  Error Undefined variable in expression: _the_task

I am getting very frustrated at this as I cant understand why I get the error and why it has such a problem with the variable _the_task.

Any help would be appreciated.

Added 4 hours 15 minutes later:

I have updated the script slightly to try to get a better idea of what is going wrong.

_the_task = objNull;

_object = _this select 0; 
_soldier = _this select 1; 
_action_id = _this select 2;

_the_task = _this select 3 select 0;
_rotation = _this select 3 select 1;

hint format["Task: %1", _the_task];
diag_log format["Rotation: %1 for %2", _rotation, _object];

_object attachTo [_soldier, [-0.18, -0.03, 0.03], "Pelvis"];
_object setdir _rotation;

_the_task setTaskState "Succeeded";

But the hint is stating Task: any. Stil lost as to why. ARMA 3 allows the passing of a Task object through the addAction args parameter.

This post was edited by publicFunction (2013-09-25 23:38, ago)


Author Message

Tajin  



Posts: 433
Rank:


Level: Member

Country: de
Location: Bavaria
Occupation: Communications Designer
Age: 33
In-game name: Tajin

 
#2 Posted at 2013-09-26 10:14        
     
Not 100% sure if that is the issue, but you might want to avoid naming your Variables like that:
"_the_task"

Use the underscore only at the very beginning. I normally use capital Letters to make them more legible, like this:
"_theTask"

Aside from that, you could always troubleshoot by passing a differnt value through the action, just to see if that works.

There are a lot of very capable people on this forum, willing to spend some of their time to help you out. So if you have a problem, it surely isn't too much to ask that you atleast take the time to describe it properly. Thanks.

Advertisement


Author Message


Posts: 2
Rank:


Level: Member

Country: uk
Location:
Occupation:
Age:
In-game name: publicFunction

 
#3 Posted at 2013-09-26 10:20        
     
Thanks.

I pass the objTaskOne as a string and everything is fine. I also used variables like _tsk, _thetask (all lowercase and camelcase) an _task. and still get the same results. I think I might have to raise this with BIS.






Tags: Addaction, Task