Jump to content
Varanon

BIS_fnc_setTask not working with JIP ?

Recommended Posts

I'm trying to create a task via BIS_fnc_setTask on the server. If another client joins, the task will show up, but no icon is displayed on the map or in 3D (it is shown for all clients that were connected at the time of task creation).

 

Is this a bug in this function ? 

Share this post


Link to post
Share on other sites

Could be, did you also try to use remoteExec?

Share this post


Link to post
Share on other sites

Replying to myself:

 

Here's the way the task is created:

["taskTest", true, ["Test task", "Task Test", "Test"], truck, "created", 0, true, true, "attack", true] call BIS_fnc_setTask;

 

The task target, "truck", is an Eden-placed truck called, well, "truck". As said above, it will correctly work for any client connected at the time of issuing the command.

 

When a client connects, it generates the following error:

19:12:29 Error in expression <letaskdestination _task;}} else {{_task setsimpletasktarget _destination;}};}e>
19:12:29   Error position: <setsimpletasktarget _destination;}};}e>
19:12:29   Error setsimpletasktarget: Type Object, expected Array
19:12:29 File A3\functions_f\Tasks\fn_setTaskLocal.sqf, line 205
..

Obviously, setSimpleTaskTarget requires an array [object, precise], while the script only gives a single object.

 

This might be related to fn_setTask:

private["_dest","_destTarget"];
 
_dest         = _this param [3,GET_DATA(_taskVar,DESTINATION),[objnull,[]]];
_destTarget     = _dest param [0,objnull,[objnull,0]];
 
if (typename _destTarget == typename objnull) then
{
    _dest =
    [
        _destTarget,
        _dest param [1,false,[false]]
    ]
}
else
{
    if (typeName _destTarget == typeName objNull) then
    {
        _dest =
        [
            _destTarget,
            _dest param [1,false,[false]]
        ]
    }
    else
    {
        _dest =
        [
            _destTarget,
            _dest param [1,0,[0]],
            _dest param [2,0,[0]]
        ]
    };
};
 
SET_DATA(_taskVar,DESTINATION,_dest);

Check the first if statement: If this is true, then the following code is execute. If false, it will go to the else branch, which start with the exact same condition again. If it wasn't true in the first place, it won't be true here either.

 

Share this post


Link to post
Share on other sites

Could be, did you also try to use remoteExec?

 

No, I didn't. The function is supposed to distribute it's state by itself. The task is created on the JIP'ing host, but it simply receives the wrong position

Share this post


Link to post
Share on other sites

And just verified:

["taskTest", true, ["Test task", "Task Test", "Test"],  getPos truck, "created", 0, true, true, "attack", true] call BIS_fnc_setTask;

works with a JIP'ing client (of course, the task is no longer tied to the object).

Share this post


Link to post
Share on other sites

Hi Varanon,

 

I have similar code in my mission, so I set the target to true and dest to position of my truck, but then placed a killed EH on the truck and put this in it:

 

[myTaskID,"Succeeded"] call BIS_fnc_taskSetState;

 

So that way it trips when truck is blown up and completes the task.  IIRC I set it all up on the server and it's fine with JIPs

 

The truck in my mission is stationary so I didn't need to update the position of the task marker or any of that shizzle.

 

Hope that helps.

Share this post


Link to post
Share on other sites

Change to BIS_fnc_taskCreate

I'll give it a shot

Share this post


Link to post
Share on other sites

I have similar code in my mission, so I set the target to true and dest to position of my truck, but then placed a killed EH on the truck and put this in it:

 

[myTaskID,"Succeeded"] call BIS_fnc_taskSetState;

 

My problem here is that I want to switch my own FHQ task tracker to use the BIS functions instead of createSimpleTask to make sure I can take advantage of future development in that area.

 

So I need to "fix" the problem somehow.

Share this post


Link to post
Share on other sites

Sorry to bump this but I have been suffering this since ages ago.

 

If you use BIS_fnc_setT ask with all the JIP proper parameters, on JIP players may happen the following (experienced several times):

 

- Task does not appear

- Task appear in the wrong state

- Task appear later on with wrong state.

 

I have allways bet the function has some bug there, and posted in the feedback tracker with no success.

 

I use scripted tasks because my missions are fully dynamic and scripted. No triggers, no modules. Also the nice icons :)

 

I use setTask because several things can happen with the task, so better to use a single script which is suppose to broadcast anychange, isnt it?

 

If anyone can enlighten me...

Share this post


Link to post
Share on other sites

No, at one point I gave up and task tracker is still doing it's own distribution of state

Share this post


Link to post
Share on other sites
3 hours ago, Varanon said:

No, at one point I gave up and task tracker is still doing it's own distribution of state

FWIW, I was able to work-a-round this issue by catching the JIP events, and for each send a signal to the server to re-initialize the tasks with BIS_fnc_taskCreate.  Not elegant, but it seems to do the trick.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×