Jump to content
Sign in to follow this  
rothy

Understanding objectives and triggers

Recommended Posts

I wanted to share a little knowledge with the community on what I learned about mission objectives, triggers, and ending a mission when certain objectives are complete. I spent alot of time searching the forums on this topic, and never really found what I was looking for. I did, however find a similar post here called objectives

I found the answer I was looking for, after un-pboing one of the BIS ArmA campaign missions. The mission I examined is called "Beaten Dog", and after looking at the triggers and objectives in that mission, I was able to figure out how it all works. At the most part, I am not really a mission designer, but more of an addon maker. Some of you will know me from the OFP days. smile_o.gif

While waiting patiently for the modding tools to be released, I decided I would create a mission. The mission is called "The Battle of Rahmadi". and starts off with a platoon of marines at the southern base of the island. I placed two objectives in the mission. The first objective is to capture the village of Rahmadi, and the second objective is to seize the airfield to the west of the village of Rahmadi. It sounds pretty simple, however what I want to do is end the mission when both objectives are complete. I tried many ways of doing this, but none seemed to work how I wanted to. So now on to what I discovered. smile_o.gif

I created my trigger around the airfield, made it a rectangle 100X250, and set it to OPFOR detected. I made the condition; <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"{alive _X && !(fleeing _X) && someAmmo _X} count thislist <= 1"; which means that if there are less than or equal to one opfor left in the trigger area, or are fleeing, that the trigger will be activated. In the activation I simply created a value. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"airfield=1"; which means that when triggered the value become true. I did the same thing for the trigger area around the village of Rahmadi, and for the activation, I put <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"village=1";.

Now here is the fun part. I created three more triggers, and placed them off the map. Each trigger is 0x0.

The first trigger I put activated by NONE. It is a switch, and the condition is; <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"airfield==1"; then for the activation, I put; <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"2" objStatus "DONE";.

The second trigger is also activated by NONE. Is a switch, and the condition is; <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"village==1"; then the activation is; <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"1" objStatus "DONE";

the final trigger is the one that ends the mission after both conditions have been met. I put the type as "End1" This trigger is also activated by NONE, and as the condition I put; <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"airfield==1 && village==1"; which means that both conditions have to be met before the trigger is activated. Both values have to be 'not equal to' 1, which is what == means.

This works perfectly! yay.gif As soon as both objectives are met, the mission ends!

Anyway, I hope this was helpful to better understand how objectives and triggers work to end a mission.

Cheers!

Share this post


Link to post
Share on other sites

nice, i never found a half decent guide like this in my travels, just people telling what to type without explaination.

Thx

Share this post


Link to post
Share on other sites

I have a question that would fit in here.

I've been experimenting with the editor recently and here's a thing I would like an answer for:

I've put 3 trucks on a road somewhere. The objective is to blow 'em up. They're named t1, t2 and t3. So what exactly do I put in the trigger so that the mission ends after they're blown to pieces?

Must be something easy but then again... There are no such things as stupid questions wink_o.gif

Share this post


Link to post
Share on other sites

A stupid question is only one that wasn't asked!

As ever there are several ways to do this, the most easy (but limited to this specific setup):-

Supposing the trucks belong to opfor, and the attacking force is blufor.

Create a trigger area covering the area where the truck is and where it will travel, if u have nothing else in the mission, and massive trigger will do the trick.

In the trigger conditions, choose Opfor / Not present. Now when the trucks explode (ie Opfor dead hence isn't about) the trigger will activate. Now just a matter of what you want to do, in this case end the mission. Click on effects, and in there are a few clickable things you can experiment with, ie music, or some sort of text like "Good job lads".

There is also the End #1 in one of the drop downs, so trucks gone, your message pops up, music plays and the mission terminates.

----

If you want to add more opfor into the mission, the opfor not present wouldn't work (as a different guy may be patrolling elsewhere in the trigger area), so for this, you need to find a way to check if ur trucks are alive by name.

Now someone may need to edit this slightly, I'm only noob designer myself, but create a trigger (anywhere out the way to remove clutter), and in activation in the text line, remove the word this, and add something like

?!Alive(truckname1) && ?!(truckname2) && ?!(truckname3)

That should check each individual truck is dead, when all are, the trigger activates, and the same as above example, you tell it what to do. This method needs a touch of programing understanding, but is far more powerful when you move on to a more complex mish. thumbs-up.gif

Hope this helps smile_o.gif

Share this post


Link to post
Share on other sites

Or try:-

not (alive t1) and not (alive t2) and not (alive t3)

smile_o.gif

Share this post


Link to post
Share on other sites

What about if its just soldiers that you want dead. what would i put in the trigger? And also for both vehicles and soldiers together?

Share this post


Link to post
Share on other sites
Quote[/b] ]Both values have to be 'not equal to' 1, which is what == means.

Not equal to is !=

and I thought == is "becomes equal to" used when you want to change a value?

just = on it's own is "is equal to" I thought.

?? smile_o.gif

Share this post


Link to post
Share on other sites
Guest Ti0n3r

Good read. I had forgot some of this since it's been about a year since I touched the good ole' OFP editor smile_o.gif

Share this post


Link to post
Share on other sites
and I thought == is "becomes equal to" used when you want to change a value?

just = on it's own is "is equal to" I thought.

?? smile_o.gif

Backwards there...

== <--- checks for equality

= <--- sets a variable

Share this post


Link to post
Share on other sites
What about if its just soldiers that you want dead. what would i put in the trigger? And also for both vehicles and soldiers together?

Class Tree

You can check for the number of classes in the trigger's area... trigger should be EAST(or opfor), present

In the trigger's conditions:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"man" countType thislist == 0

for just enemy men.

Combine the two for the vehicles and men.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">("man" countType thislist == 0) && ("landVehicle" countType thislist == 0)

A good way to keep from having to hunt down that one bugger who's hiding is to use <= 3 or something instead of == 0.

That means when enemy men left are less than or equal to 3, it triggers.

Thislist is a fancy keyword that takes all the units in the "Triggered by" list that are inside the trigger's area... quite handy.

As always a disclaimer... not tested. smile_o.gif

Share this post


Link to post
Share on other sites

If you want a trigger to check if everything that is in the area is alive or not, it is very easy:

First create a trigger the size and shape you want.

Set the "Activated By" to the units you want to check for (i.e. East, West, etc..) Think of it like a filter.

    Hint 1: Group a unit or vehicle to limit it to a single group of units or specific vehicles

    Hint 2: Never use "Anyone" as that can include some objects like buildings wink_o.gif

In the Condition Line put:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{!(alive _x)} count thisList == 0

What this code above does is basically loop through every unit in "thisList" or the triggers personal array of units in the area. Each unit/object it checks if it is not alive (i.e. all the code between the { and })  and if it is, it "counts" it. At the end of the loop, it checks the total number versus the "0".

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  

×