Jump to content
Sign in to follow this  
ColeMinor

End Mission When Objectives Complete

Recommended Posts

Hey guys, this one seems like it should be easy to find with the search function but I have been looking for at least an hour maybe two with no luck.

I'm making a mission with 5 objectives, mostly things like blowing up buildings and killing certain people. Can someone please give me some example script showing how I can end the mission when multiple objectives are completed?

Thanks in advance

Share this post


Link to post
Share on other sites

Add a variable to each of the completed task which you set to true once completed. Like "part1", "part2" and so on.

Example:

Once the first objective is completed you add this to the triggers onActivation line:

part1=true; publicVariable "part1"

You can skip publicVariable if the mission is single player only.

The same you do with the second, third, fourth and fifth objective.

Next add a trigger which ends the mission once all variables are set to true. In its condition line you type:

part1 AND part2 AND part3 AND part4 AND part5

Share this post


Link to post
Share on other sites

Thanks Wolle! Thoguh I know how to do it from copy n' pasting, I never saw an explanation either. Always wanted to know the publicvariable deal, thanks.

Share this post


Link to post
Share on other sites

While you on this subject.

Im making a mission with several objectives. They all involve taking control of different areas and all the areas must be in your control before you can complete the mission. Now the hard part is that you might take control of an area and go for the next one, this will show up as objective done. While you are on with next objective the enemy could retake the first area. I want the obective now to show as not done etc

Is this possible???

Share this post


Link to post
Share on other sites

Yes of course you can do that as well.

For this situation you have the on Deactivation (On Dea) line in the trigger setup window.

To change the marker/condition if the enemy has seized the area again you would have something like this in that line:

task1 setTaskState "FAILED"; part1=false; publicVariable "part1"

You also need to change the triggers activation from Once to Repeatedly.

If above doesn't work, you also can create a second trigger (activated by the enemy) with the same seize as the one who checks if friendlies seized the area and write above example line in the On Activation line.

Just remember that both check triggers must have their activation set to repeatedly.

Share this post


Link to post
Share on other sites

Hi WOlle, I tried your suggestions last night. All goes ok and on the map screen the task turns green but when the enemy retake the area it remains green, I need it to clear so that the task becomes active again? I tried both of your suggestions with the triggers but nither worked. Am I missing something.

Is there some kind of command to reset the task?

Just tried for another couple of hours, I tried it the other way round so it would say that the enemy has taken the area. Same again on the task menu it puts a red cross ( so all this is working great ) but once their is either a green mark or a red cross in the task there does not seem to be a way to remove it so it can be done again...

Edited by LockJaw-65-

Share this post


Link to post
Share on other sites

Been looking into this again as I gave up before. This is something I really need to work now to complete my mission that I have been working on for months.

I have tried both these ways but its the same every time.

Can Anybody help please.....:confused::confused:

Share this post


Link to post
Share on other sites
Been looking into this again as I gave up before. This is something I really need to work now to complete my mission that I have been working on for months.

I have tried both these ways but its the same every time.

Can Anybody help please.....:confused::confused:

When you say "In your control" what do you mean exactly? How do you have the triggers set up? Is it a Seized by Trigger or is it a Present/Not Present trigger or what?

Share this post


Link to post
Share on other sites

I have a trigger set at not present (opfor) with opfor being present when the map starts. It is also set to repeatedly

The trigger has this line in act:

Obj1 setTaskState "SUCCEEDED"; Obj1=true; publicVariable "Obj1"; hint "Elektrozavodsk Clear";

What I need is this: if the opfor re-enter the trigger area then the objective to become active again. I have tried putting the code in on deactivation that wolle said but it still marks as green on the breifing tasks.

I have also tried two triggers one fro each side present/not present with the code in each act box.

On the tasks in breifing screen once the objective has either gone green or a red cross, thats it, it will not change again.

Is there something that needs to be added to the briefing script?

To be honest I have never scrolled down far enough to notice the option seized by, what is the difference between that and the not present/ present trigger ?

Edited by LockJaw-65-

Share this post


Link to post
Share on other sites

From the Biki

Seized by <side> - Will activate when the seizing size is deemed to be in control of the area. This trigger type works with the Timeout Counter values - a low level of dominance will activate the trigger after a period of time close to the max timeout, and visa versa. Depending on unit types, the seizing side can be completely outnumbered (4:1) and still satisfy the minimum required level of presence for the Maximum timeout counter. This trigger type can also be used with the any Detected By <side> option, meaning only units known to the Detected By side will be considered by the seized by calculation. This can easily create some interesting area domination effects. For example, a Seized by BLUFOR trigger using the Detected By BLUFOR option will activate when BLUFOR think they have seized the area, while the same trigger using Detected by OPFOR option will activate when OPFOR think BLUFOR have seized the area. The Not Present option inverts the triggers normal behaviour (ie, Not Seized by <side>).

I don't fully understand it. I haven't ever really used it before. I think if you used a seize by trigger instead though that what Wolle said would work.

Share this post


Link to post
Share on other sites

Thanks for your help Jakerod, I will have a mess about with the triggers using the seized by options :)

Share this post


Link to post
Share on other sites

I have tried all these options now but the task still shows as complete on the map screen ?

Does anybody know how it is done in warfare because I might be able to adapt that..

Share this post


Link to post
Share on other sites

The only way I could find was to:

yourTask setTaskState "Created";

That resets the task but does not remove the completed/failed icon from the map.

That icon will be removed once the task is completed again.

It works ok if your task occurs in a random location. e.g. if you have 3 or 4 different Landing Zones but looks odd for a single location.

Share this post


Link to post
Share on other sites
I have tried all these options now but the task still shows as complete on the map screen ?

Does anybody know how it is done in warfare because I might be able to adapt that..

What warfare mission are you talking about?

I think it's done via scripting.

Share this post


Link to post
Share on other sites

settaskstate is what your looking for.....

just have your repeated trigger work that when blufor seize it

on act

obj1 settaskstate "SUCCEEDED"; hint "secured";

then on the deact (when blufor no longer has control of it:

obj1 settaskstate "CREATED"; hint "enemy have retaken the point, resecure it"

and that should be it, the color thing might still say complete (as theres no way to update it as an empty box) but throwing in hints or task hints saying its been retaken and the obj to secure it again will make this work

Share this post


Link to post
Share on other sites

can you not delete the task and just add a new copy task of that same task to make it green again?

_task = player createSimpleTask ["NewTask"];

player removeSimpleTask _task

Share this post


Link to post
Share on other sites

Settaskstate will work just fine.

The problem is that the onAct of the trigger is overwriting the task variable "Obj1" with a boolean value (true). After that it's not possible to refer to the task anymore, thus the state won't change. So, a bit more care with variable naming.

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  

×