Jump to content
Sign in to follow this  
thetrooper

script to check if objectives are complete

Recommended Posts

Hi guys, I tried posting a follow up to another thread though it didn't really get noticed, so I created this one.

I’ve got two separate objectives though they’re completely scripted. Is there a way I can run a script to check and see if obj_1 and obj_2 are complete, then create a new task? Triggers won't work for this one because there arn't any.

I’m thinking something along the lines of an if statement if it works like that, but unsure how that would work?

Share this post


Link to post
Share on other sites

How are you detecting when the objectives are completed ?

Share this post


Link to post
Share on other sites

Basically its a run by a script and if it continues through the loop to the bottom it's Objective complete. I've got two of these running, and wondered if there was a script to check if objectives are complete.

Both objectives running the same time, once both complete a script pics this up and fires something else. Any ideas if that's possible?

Share this post


Link to post
Share on other sites

Well, there's a way how check it. You can use the command taskState.

for instance:

tskSomeTask = player createSimpleTask ["NewTask"];
hint format["Taskstate: %1", taskState tskSomeTask];

Share this post


Link to post
Share on other sites

Just to check, do you think that this would work? It's something like this I'm looking for, but unsure.

if
(tskobj_1 TaskState "SUCCEEDED"; && tskobj_2 TaskState "SUCCEEDED";)
then {

tskobj_3 = player createSimpleTask["task"];
tskobj_3 setSimpleTaskDescription ["task", "task", "task"];
tskobj_3 setSimpleTaskDestination (getMarkerPos "obj_3");
taskhint ["New Task!\nNew task to do something", [1, 1, 1, 1], "taskNew"];

}

};

Share this post


Link to post
Share on other sites

Your syntax is a little off. Try this:

if ((taskState tskobj_1 == "SUCCEEDED") && (taskState tskobj_2 == "SUCCEEDED")) then
{
tskobj_3 = player createSimpleTask["task"];
tskobj_3 setSimpleTaskDescription ["task", "task", "task"];
tskobj_3 setSimpleTaskDestination (getMarkerPos "obj_3");
taskhint ["New Task!\nNew task to do something", [1, 1, 1, 1], "taskNew"];
};

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  

×