Jump to content
Sign in to follow this  
CaponeSB

Tasks problem

Recommended Posts

Hello everybody, here's the situation:

There are two tasks, and both of em require explosives to complete.

There's a trigger that alert every OPFOR unit if BLUFOR gets detected.

When the explosives detonate, the tasks become FAILED automatically due to a trigger and a module I put into the mission editor.

If a task is complete, I want it to remain SUCCEEDED, even tho the other one fails.

My main problem is: when the explosives detonate, the tasks become FAILED, and I fear a succeeded task would become FAILED too.

I hope the explanation is clear. If not, I'll try to make it better.

Thanks in advance.

Share this post


Link to post
Share on other sites

If your task succeeded, simply define a variable in the onActivation field: taskCanFail = false;

On the other trigger put in the condition field taskCanFail

When the trigger sets the first task on succeeded, the variable becomes false, hence the other trigger cannot be activated anymore, since the variable will not turn true anymore.

I hope that was understandable.

There a probably thousands of other ways, but I always use variables for complicated task chains.

Edit: As ST_Dux has already mentioned, you would need to define the variable taskCanFail before. Put in you init.sqf taskCanFail = 0;

Edited by R3vo

Share this post


Link to post
Share on other sites

What actually sets the task to FAILED? If it's a trigger of yours, then add the following condition to the trigger activation field:

if (!taskCompleted myTask) then {myTask setTaskState "FAILED"}

Even if the trigger fires in the above example, the task state will only be modified if it hasn't already been completed (meaning its state isn't CANCELED, FAILED or SUCCEEDED).

Share this post


Link to post
Share on other sites

Let's try to make it simpler... I don't know why but when I synchronize a "FAILED TASK" module the CREATE TASK one, it gives me the tasks already failed, even tho I synchronized it to a SWITCH TRIGGER that would get activated once BLUFOR is DETECTED BY OPFOR.

Share this post


Link to post
Share on other sites

Don't use the "FAILED TASK" module. Instead, in the activation field of your trigger (which doesn't need to be a switch type, by the way), use the setTaskState script command to change the state of the task.

Share this post


Link to post
Share on other sites

Looks like it doesn't work yet.. do I need to use the script command to create tasks as well?

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  

×