Jump to content
Sign in to follow this  
padarom

Get the task from object name

Recommended Posts

Hey,

I want to change a TaskState via my script. The task is created ingame and linked with all 8 playable units. Its current taskID is test1.

When using test1 setTaskState "Succeeded"; in my script file it tells me "Error Undefined variable in expression: test1".

This is obvious, as it only is the task id and not the actual variable name. Unfortunately when I try to use test1 as the module name, instead of the task id, it tells me the variable needs to be a task and not an object.

So how am I able to get the variable of the task type, when just being able to create a variable of the object type?

Thanks in advance

Padarom

Share this post


Link to post
Share on other sites

This is the dev branch right? Seems it works fine with triggers synched to setTaskState modules on the map, but scripting commands fail miserably.

Looks like it's a problem with the createTask module not properly creating the task. If you do this somewhere:

test1 = player createSimpleTask ["Test Task"];

Then do this later:

test1 setTaskState "SUCCEEDED";

it works.

Edited by kylania

Share this post


Link to post
Share on other sites
Hey,

I want to change a TaskState via my script. The task is created ingame and linked with all 8 playable units. Its current taskID is test1.

When using test1 setTaskState "Succeeded"; in my script file it tells me "Error Undefined variable in expression: test1".

This is obvious, as it only is the task id and not the actual variable name. Unfortunately when I try to use test1 as the module name, instead of the task id, it tells me the variable needs to be a task and not an object.

So how am I able to get the variable of the task type, when just being able to create a variable of the object type?

Thanks in advance

Padarom

Hi..

it depends on how the task was created..

the function you re asking for is called BIS_fnc_taskReal, it returns task object from given task name.. you can also check if BIS_fnc_taskExists with task name..

anyway.. you dont have to do this..

if you create your task with BIS_fnc_createTask or BIS_fnc_setTask, you can later use BIS_fnc_setTaskState, that function works with task name..

Share this post


Link to post
Share on other sites

I'll try out BIS_fnc_taskReal. Thanks :)

@kylania: That was my first thought as well, but the task needs to be assigned to 8 players which aren't in the same group. So I would need more than one task that do the same.

Share this post


Link to post
Share on other sites

The new BIS task functions should be able to do that in conjunction with BIS_fnc_MP.

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
Sign in to follow this  

×