Jump to content
Yolo Joe

Objective can be completed after its failed?

Recommended Posts

Hello everyone. 

 

I'm having some issues with an objective I'm making. 

I am using the objective modules. 

 

I have set it up so you are going to kill a man. If you kill anybody else than this man, the objective fails. 

If the objective have failed, you can still kill the VIP and change the state of the objective from "Failed" to "Succeeded". This should not be possible! How can I fix it? 

 

 

Share this post


Link to post
Share on other sites

And its the other way around too. You can complete the objective and kill one of the other people and fail the objective. 

Share this post


Link to post
Share on other sites

I'd probably spawn the targets and place variables on their object with who is supposed to kill them and the name of the task associated with their demise.  Than place a Killed EventHandler on them checking to see if their killer was the same object as their killer variable, if so succeed, if not fail.  That way the only time the state of the tasks is changing is within the EH.

 

I'd also probably not use the modules, they are fiddly and it's easier to just script state changes than have a spider web of sync'd triggers everywhere.

 

See:  BIS_fnc_taskCreate and BIS_fnc_taskSetState

Share this post


Link to post
Share on other sites

Just to confirm, Kylania.. you are recommending we DON'T use the BI task framework?

Share this post


Link to post
Share on other sites

No, definitely use the task framework, just control it via the functions rather than the modules.  Like with setting the task state.  If you use the module for it or the command for it the state simply changes but using the function for it also includes the pretty notification popup you'd otherwise need to do by hand.

Share this post


Link to post
Share on other sites

My suggestion which always works well for me is to give the succeeded task state module and the failed task state module variable names in their respective attributes window. Then, using your triggers, delete the module that you don't want based on the player's actions.

Example:

Trigger 1

Condition: !alive target

On Activation: deleteVehicle task_failed

Sync this trigger to the "succeeded" task state module.

Trigger 2

Condition: !alive anyone_else

On Activation: deleteVehicle task_succeeded

Sync this trigger to the "failed" task state module.

Hopefully that makes sense. Basically you're deleting one of the task state modules so it can no longer change the task state again later in the mission. You can add a few more failsafes to the triggers to account for the very slim chance that two enemy units, one being the target and one being a random other guy, are killed at the exact same time, but that depends on mission design and might not be necessary.

  • Like 1

Share this post


Link to post
Share on other sites

No, definitely use the task framework, just control it via the functions rather than the modules.  Like with setting the task state.  If you use the module for it or the command for it the state simply changes but using the function for it also includes the pretty notification popup you'd otherwise need to do by hand.

Right, gotcha. I'm doing that way already. :)

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

×