DCS mission making - trigger actions and vehicle movement
Contents
Trigger actions
Triggers gives you the ability to script actions during the mission.
The trigger system is not an "event" type system, but rather a "condition" type system; this means that a trigger does not occur when something occurs, but rather when a condition becomes TRUE.
When using triggers you'll ear a lot about Flags. Here are some important fact you want to know about Flags
- Flags can be either Boolean (true/false/0/1) or a numerical value.
- FLAG IS TRUE checks for any value higher than 0.
- FLAG ON increases the flag value from 0 to 1.
- FLAG INCREASE adds a numerical value to the flag. (Useful if you're trying to tally a number of kills or hits)
Triggers list
This window will list all existing triggers of the mission therefore you better use your triggers names wisely.
Type
- ONCE. The trigger will be executed only once after the condition is evaluated as true. Once set as true, the condition is removed from memory
- CONTINUOUS ACTION. The Continuous Action trigger checks the trigger's conditions each second. Each second the conditions return true, the actions are performed; each second the conditions are false, no action is not performed
- SWITCHED CONDITION. The trigger will perform the set action(s) every time the trigger's condition is checked and evaluated as true and its previous state was false
- MISSION START. The trigger will only be checked at mission start
Comment
This is the name of your trigger. It should be self explanatory as you want to quickly understand what this trigger is used for.
PRO TIP:Try to group your triggers together chronologically by using a number in front of the trigger name (for example 01 - for the triggers on the ground at base, 02 for the triggers happening during the ingress, 03 for the triggers happening during the attacks etc ....) You can also use some special characther like /// to be able to find a particular trigger quickly in the list.
Event
Setting an event for a trigger limits the trigger's conditions to being evaluated only when the set events occur. With no event set, trigger conditions are evaluated once per second throughout the duration of the mission, unless already expired and removed from memory.
In a trigger-heavy mission, this can cost considerable CPU cycles and affect gameplay performance. Setting triggers to events can reduce the CPU workload and also provide some unique trigger mechanisms.
Several kinds of EVENT are available but the most useful is probably the ON DESTROY which gonna have his conditions evaluated whenever any unit is destroyed. (Really useful to save CPU when using a trigger that count dead units to trigger something like reinforcements for example)
Conditions
Once you have created a trigger, you will then need to set the conditions that govern when the trigger will be set to true or false. To do so, you first need to click on the trigger you want to set conditions for by clicking on it from the trigger list.
When multiple trigger conditions are set, they operate with an "AND" operator. In other words, all of the conditions must be true for the trigger to be activated. Press the OR button to separate conditions with an "OR" operator. In this case, the condition(s) either above or below the "OR" operator will activate the trigger.
Here is the list of the conditions types available in the mission editor:
- ALL OF COALITION IN ZONE. Set a trigger to true when all of the set coalition units (aircrafts, vehicles, ships) are inside a defined trigger zone. Upon selecting this condition, two new fields will be displayed. The COALITION drop down menu allows you to select the coalition that when inside the selected trigger zone will set the condition to true. The ZONE drop down will list all the trigger zones you have created according to the names you created for them.
- ALL OF COALITION OUT OF ZONE. This condition works the same as the ALL OF COALITION IN ZONE, but the condition will be set to true when the all coalition's units are outside the defined zone.
- ALL OF GROUP IN ZONE. Set a trigger to true when all units of the set group are inside a defined trigger zone. The GROUP drop down menu allows you to select the group that when inside the selected trigger zone will set the condition to true. The ZONE drop down will list all the trigger zones you have created according to the names you created for them.
- ALL OF GROUP OUT OF ZONE. This condition works the same as the ALL OF GROUP IN ZONE, but the condition will be set to true when the all group's units are outside the defined zone.
- BOMB IN ZONE
- CARGO UNHOOKED IN ZONE
- COALITION HAS AIRDROME. If the set coalition has captured set airfield, the action(s) will be activated. All airfields with no aircraft assigned for take-off or landing and with no ground units of either coalition within a 2,000 m. radius are neutral. Any ground unit present within a 2,000 m. radius of an airfield will capture the airfield for the coalition of the ground unit. If ground units of both coalitions are present within a 2,000 m. radius of an airfield, the airfield is contested and not assigned to either coalition. In cases when armed ground units of one coalition are present within a 2,000 m. radius of an airfield at the same time as unarmed ground units of the other coalition, the coalition of the armed units will capture the airfield.
- COALITION HAS HELIPAD. If the set coalition has captured set FARP, the action(s) will be activated. Note, FARP capture rules are identical to airfield capture rules (see above).
- FLAG EQUALS. This condition checks whether the value of a set flag is equal to the set value.
- FLAG EQUALS FLAG. This conditions checks whether the value of one set flag is equal to the value of another set flag.
- FLAG IS FALSE. When selected, a FLAG field is displayed below. By either using the left and right arrows or typing in the field, set the flag number that when set to false will set the condition to false.
- FLAG IS LESS. When selected, FLAG and VALUE fields are displayed below. By either using the left and right arrows or typing in the field, set the flag number to check the value for and the flag value, below which the trigger condition will be true.
- FLAG IS LESS THAN FLAG. This condition checks whether one set flag has a smaller value than another set flag.
- FLAG IS MORE. When selected, FLAG and VALUE fields are displayed below. By either using the left and right arrows or typing in the field, set the flag number to check the value for and the flag value, above which the trigger condition will be true.
- FLAG IS TRUE. When selected, a FLAG field is displayed below. By either using the left and right arrows or typing in the field, set the flag number that when set to true will set the condition to true.
- GROUP ALIVE. When selected, a GROUP drop down menu will be displayed below. From this list, select the group that will activate the trigger as long as at least one unit of the group is alive. Groups are listed according to their “NAME” from the unit placement windows.
- GROUP ALIVE LESS THAN. When selected, a GROUP drop down list and "%" field will be displayed below. From the GROUP list, select the group that will activate the trigger when the number of live units in the group corresponds to the per cent value set in the "%" field. For example, if the group has 10 units and you entered 40%, the trigger will activate when 3 units remain alive.
- GROUP DEAD. When selected, a GROUP drop down menu will be displayed below. From this list, select the group that will activate the trigger when all units of the group are destroyed (dead). Groups are listed according to their “NAME” from the unit placement windows.
- LUA PREDICATE
- MISSILE IN ZONE
- MISSION SCORE HIGHER THAN. If the set coalition has a score higher than the set amount, the action(s) will be activated.
- MISSION SCORE LOWER THAN. If the set coalition has a score lower than the set amount, the action(s) will be activated.
- PART OF COALITION IN ZONE. The trigger will be set to true if any of coalition's unit will appear inside the selected trigger zone. The COALITION drop down menu allows you to select the coalition. The ZONE drop down will list all the trigger zones you have created according to the names you created for them.
- PART OF COALITION OUT OF ZONE. This condition works the same as the PART OF COALITION IN ZONE, but the condition will be set to true when the any of coalition's unit are outside the defined zone.
- PART OF GROUP IN ZONE. The trigger will be set to true if any of group's unit will appear inside the selected trigger zone. The GROUP drop down menu allows you to select the group. The ZONE drop down will list all the trigger zones you have created according to the names you created for them.
- PART OF GROUP OUT OF ZONE. This condition works the same as the PART OF GROUP IN ZONE, but the condition will be set to true when the any of group's unit are outside the defined zone.
- RANDOM. The Random condition allows you to set a percentage chance of action(s) assigned to the trigger from happening. Use the left and right arrows or type directly into the field to adjust the value. Values can range from 0 (no chance) to 100 (certain) as a percentage. The most common action you will use this condition with is Activate Group. This will allow you to set a random appearance of units in a mission.
- SIGNAL FLARE IN ZONE
- TIME LESS. When selected, a SECONDS field is displayed below. By either using the left and right arrows or typing in the field, enter the time in seconds when the condition will become false. For example, if you set a value of 120, the condition will become false two minutes into the mission.
- TIME MORE. When selected, a SECONDS field is displayed below. By either using the left and right arrows or typing in the field, enter the time in seconds when the condition will become true. For example, if you set a value of 120, the condition will become true two minutes into the mission.
- TIME SINCE FLAG. When selected, FLAG and SECONDS fields are displayed below. By either using the left and right arrows or typing in the field, set the flag number that when set to true will set the condition to true in the FLAG field. In the SECONDS field, enter the delay in seconds that the condition will be set to true after the flag is set to true.
- UNIT ALIVE. When selected, a UNIT drop down menu will be displayed below. From this list, select the unit that will activate the trigger as long as the unit is alive. Units are listed according to their “UNIT NAME” from the unit placement windows.
- UNIT DAMAGED. When selected, a UNIT drop down menu will be displayed below. From this list, select the unit that will activate the trigger when the unit is damaged. Units are listed according to their “UNIT NAME” from the unit placement windows.
- UNIT DEAD. When selected, a UNIT drop down menu will be displayed below. From this list, select the unit that will activate the trigger when the unit is destroyed (dead). Units are listed according to their “UNIT NAME” from the unit placement windows.
- UNIT INSIDE MOVING ZONE. This trigger allows you to attach a trigger area zone to a unit and the zone will move along with the assigned unit. Note, the trigger zone can be placed anywhere on the map, but will in fact be always attached to the center of the assigned unit in-game. When selected, you should first select the unit that the area trigger will be attached to by selecting it from the ZONE UNIT drop down list. Next, select the area trigger zone that will be attached to the unit from the ZONE drop down list. Lastly, you need to set the unit that will set the trigger to true when it enters the zone unit’s zone. Do this by selecting a unit from the UNIT drop down list.
- UNIT INSIDE ZONE. When creating a Trigger Zone (discussed later in this document), you can set a trigger to true when a defined unit enters a defined trigger zone. Upon selecting this condition, two new fields will be displayed. The UNIT drop down menu allows you to select the unit that when inside the selected trigger zone will set the condition to true. The ZONE drop down will list all the trigger zones you have created according to the names you created for them.
- UNIT OUTSIDE MOVING ZONE. This trigger allows you to attach a trigger area zone to a unit and the zone will move along with the assigned unit. Note, the trigger zone can be placed anywhere on the map, but will in fact be always attached to the center of the assigned unit in-game. When selected, you should first select the unit that the area trigger will be attached to by selecting it from the ZONE UNIT drop down list. Next, select the area trigger zone that will be attached to the unit from the ZONE drop down list. Lastly, you need to set the unit that will set the trigger to true when it is outside the zone unit’s zone. Do this by selecting a unit from the UNIT drop down list.
- UNIT OUTSIDE ZONE. This condition works the same as the UNIT INSIDE ZONE, but the condition will be set to true when the unit is outside the defined zone.
- UNIT’S ALTITUDE HIGHER THAN. This condition allows you to set a unit and altitude in meters (MSL). If the set unit flies above the set altitude, the trigger will be set to true.
- UNIT’S ALTITUDE LOWER THAN. This condition allows you to set a unit and altitude in meters. If the set unit flies below the set altitude, the trigger will be set to true.
- UNIT'S BANK IN LIMITS. When selected, a UNIT drop down list, MIN and MAX fields will be displayed below. From UNIT list, select the unit that will activate the trigger when the bank angle is within the MIN and MAX values set in the corresponding fields. Note, negative angles denote left bank and positive angles denote right bank.
- UNIT'S HEADING IN LIMITS. When selected, a UNIT drop down list, MIN and MAX fields will be displayed below. From UNIT list, select the unit that will activate the trigger when the unit's heading is within the MIN and MAX values set in the corresponding fields.
- UNIT'S LIFE LESS THAN. When selected, a UNIT drop down list and "%" of life will be displayed below. From the UNIT list, select the unit that will activate the trigger when the per cent of "life" of the unit corresponds to the value set in the "%" field.
- UNIT'S PITCH IN LIMITS. When selected, a UNIT drop down list, MIN and MAX fields will be displayed below. From UNIT list, select the unit that will activate the trigger when the pitch angle is within the MIN and MAX values set in the corresponding fields. Note, negative angles denote negative pitch (nose down) and positive angles denote positive pitch (nose up).
- UNIT’S SPEED HIGHER THAN. This condition allows you to set a unit and speed in indicated meters per second. If the set unit flies faster than set speed, the trigger will be set to true.
- UNIT’S SPEED LOWER THAN. This condition allows you to set a unit and speed in indicated meters per second. If the set unit flies under than set speed, the trigger will be set to true.
- UNIT'S VERTICAL SPEED IN LIMITS. When selected, a UNIT drop down list, MIN and MAX fields will be displayed below. From UNIT list, select the unit that will activate the trigger when the vertical velocity in meters per second is within the MIN and MAX values set in the corresponding fields.
Actions
Once you have defined the condition(s) that will determine when a trigger will be true or false, you now define the actions that will result.
Vehicle movement
Make an AI helicopter to hover
Here is an easy trick to make your AI helicopter to remain stationary above a waypoint.
- Place your helicopter on the map and set the usual options like Country, Type, Skill etc .... Create a flight plan. Use as much waypoints as you want.
- Select the waypoint where you want your helicopter to remain stationary and click on ADD in advanced waypoint actions
- Select the following settings : TYPE - Perform Task , ACTION - Orbit , SPEED - 0 and set the ALTITUDE to wathever altitude you want the helicopter to hover
- Optionnaly you can add a stop condition to make it stop the hover and proceed with the rest of his flight plan (in this example I've set up a duration of 2 mn which mean that when the Gazelle will reach waypoint 2 she will hover for 2 mn before proceding to waypoint 3)
How to set up a tanker for air to air refueling
Before placing a tanker be advised that some airplanes are refueled using a flying boom (F16, F15 , etc ...) where others are using a probe and drogue (F18, Mirage 2000 etc ...) Therefore you have to choose the correct model of tanker in function of what kind of airplanes you want to refuel.
- Place a tanker on the map and set the usual options and be sure his TASK is set to Refueling. (should be selected as default)
- Create a flight plan (don't make it to fly too high or to fast to ease up the AAR)
- At the first waypoint where you want your tanker to start his racetrack pattern (in our example waypoint 1) click on ADD in advanced waypoint actions
- Select the following settings : TYPE - Perform Task , ACTION - Orbit , PATTERN - Race-track , SPEED - 300 kts and set the ALTITUDE to 15 000 ft. Your tanker will now orbit between waypoint 1 & 2 until it reaches his bingo fuel. (you can also assign a stop condition like a duration , a trigger etc ...) PRO TIP: Tankers are always doing a left hand turn in their orbit.
- Optionnaly you can add a tacan to your tanker (Normally DCS will automaticaly assign a TCN to your tankers) To do this just go on Waypoint 0 and open the advanced waypoint actions. Click on ADD and select TYPE - Perform Command , ACTION - Activate TACAN and then select a channel , a channel mode and the callsign of the TCN station (usualy TKR for tanker). If you already have an existing Tacan in the the advanced waypoint actions window just double click on it to edit its informations.
In this example, our tanker (a KC-130) will orbit in a racetrack pattern between steer 1 and 2 at 15 000 ft and 300 kts.
As I didn't set any stop condition it will orbit until it reaches his bingo fuel and then follow his waypoints to land at Kutaisi.
Players can use TCN 1X to find it.