DCS mission making - trigger actions and vehicle movement

From UOAF Codex
Revision as of 10:47, 21 June 2018 by Foxy (talk | contribs)
Jump to navigation Jump to search

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)

DCS mission making triggers.jpg

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. Here is the list of the actions available:

  • AI TASK PUSH. An AI action set in the TRIGGERED ACTIONS panel of the AI Group Properties Advanced Actions menu will be executed. The desired AI action identified by its name should be selected from drop down list.
  • AI TASK SET.
  • BEGIN PLAYING ACTOR.
  • DO SCRIPT. Runs a LUA script as entered in the TEXT filed.
  • DO SCRIPT FILE. Runs a LUA script file that is linked to in the TEXT field.
  • EFFECT SMOKE.
  • END MISSION. If you wish to have the mission end according one or more specified conditions being set to true, you can use this action. This can be a handy action to end a mission after all mission objectives have been met. In the text box, you can also enter text that will appear when one side has won the mission.
  • EXPLODE UNIT. From this action, select a unit that you wish to explode as a result of this action. You can use the volume setting to determine the size of the explosion.
  • EXPLOSION. To have an explosion appear in the mission based on a resulting action, you can use this action. The three values you need to set include the name of the zone that the explosion will occur in, the altitude the explosion will occur, and the size (volume) of the explosion.
  • FLAG DECREASE. This action allows you to set a defined flag to decrease in value. Use the FLAG field left and right arrows to set the flag number or manually enter it in the field. Use the VALUE field left and right arrow keys to set the value by which to decrease or manually enter it in the field.
  • FLAG INCREASE. This action allows you to set a defined flag to increase in value. Use the FLAG field left and right arrows to set the flag number or manually enter it in the field. Use the VALUE field left and right arrow keys to set the value by which to increase or manually enter it in the field.
  • FLAG OFF. This action allows you to clear a defined flag number to false. Use the FLAG field left and right arrows to set the flag number or manually enter it in the field.
  • FLAG ON. This action allows you to set a defined flag number to be true. Use the FLAG field left and right arrows to set the flag number or manually enter it in the field.
  • FLAG SET RANDOM VALUE. This action allows you to set a defined flag to a random value. Use the FLAG field left and right arrows to set the flag number or manually enter it in the field. Use the VALUE LIM MIN and VALUE LIM MAX fields left and right arrow keys to set the range of possible values for the flag or manually enter them in the fields.
  • GROUP ACTIVATE. By default, units appear automatically in a mission once the mission starts. However, using the Activate group action, you can set unit groups to only appear in the mission according to the set conditions. Common rules to govern the appearance of an Activated group are TIME MORE, FLAG IS TRUE, UNIT IN ZONE and RAMDOM. IMPORTANT: FOR A GROUP TO BE ACTIVATED VIA A CONDITION YOU MUST CHECK THE LATE ACTIVATION CHECKBOX
  • GROUP AI OFF. Disable the artificial intelligence of all units in the selected group. The group will stop all movement, sensor operations and will not engage in combat.
  • GROUP AI ON. Activate the artificial intelligence of all units in the selected group. Only possible after use of the GROUP AI OFF action on the group.
  • GROUP DEACTIVATE. To have a group removed from a mission while in progress, you can use this action tied to a condition. When enabled, the specified group will disappear from the mission.
  • GROUPE RESUME. This action orders to group to resume movement along its planned route.
  • GROUP STOP.
  • ILLUMINATION BOMB. For night missions, you can use this action to have an illumination bomb appear in a specified zone at a specified altitude. You can use this to simulate artillery fired illumination rounds.
  • LOAD MISSION. This is a very useful action that allows you to load a new mission in multiplayer, as a result of the rule conditions. As such, you could have different missions loaded depending on what is happening in the mission. In this way, you can use this action to create multiplayer campaigns. Working in the multiplayer only.
  • MARK TO COALITION
  • MARK TO ALL
  • MARK TO GROUP
  • MESSAGE TO ALL. To have a trigger display a text message on the screen, you will use this action. Upon selecting this action, a TEXT entry box will appear. Type the message you wish to be displayed here. Below the text box you can set how long you wish the message to be displayed in seconds.
  • MESSAGE TO COALITION. This action allows a text message to just be sent to the defined coalition. As with the Message action, you can enter text and message duration.
  • MESSAGE TO COUNTRY. This action allows a text message to just be sent to the defined country. As with the Message action, you can enter text and message duration.
  • MESSAGE TO GROUP
  • PLAY ARGUMENT. Turn on a graphics animation argument (such as turning of a radar antenna) of the selected static object.
  • PREVENT CONTROLS SYNCHRONIZATION. This trigger will prevent the synchronization of cockpit switch states with the settings on the player’s actual input controllers, such as joystick and throttle switches. Intended for use with training missions.
  • RADIO ITEM ADD. This actions allows you to add a custom radio message to the player's radio communications menu in-game. Enter the desired radio message in the RADIO TEXT field. In the FLAG field, set the flag number that will be set to ON when the player selects this radio message. Note, this trigger does not work in multiplayer.
  • RADIO ITEM ADD FOR COALITION
  • RADIO ITEM ADD FOR GROUP
  • RADIO ITEM REMOVE. Delete a custom radio message from the player's radio communications menu created earlier using the RADIO ITEM ADD action.
  • RADIO ITEM REMOVE FOR COALITION
  • RADIO ITEM REMOVE FOR GROUP
  • RADIO TRANSMISSION. Allows the user to define a sound file to play and the transmitter's location, emission power, frequency and modulation.
  • REMOVE MARK
  • SCENERY DESTRUCTION ZONE
  • SCENERY REMOVE OBJECT ZONE
  • SET ACTIVE HELPER GATE TO POINT
  • SET BRIEFING. (Not implemented yet).
  • SET FAILURE. This action is used to setup system failures for the player's aircraft. Select the system to fail in the FAILURE drop down menu. Set the probability of failure in per cent in the PROBABILITY % field. Set the desired time span after the trigger conditions are true for the failure to occur in the WITHIN field.
  • SET FLAG VALUE
  • SET INTERNAL CARGO
  • SHELLING ZONE
  • SHOW HELPER GATE
  • SHOW HELPER GATE FOR UNIT
  • SIGNAL FLARE. Use this action to have signal flares (flare gun) fired from a specified zone. You can also select the color of the flare. This can be a useful action to allow friendly units to mark their location to avoid friendly fire.
  • SIGNAL FLARE ON UNIT. This works the same as the previous action, but the signal flare is fired from the location of a specified unit. This should be used when the unit is moving.
  • SMOKE MARKER. To have a white phosphorous (WP) marker appear in the mission, you can use this action. When activated, a white WP marker will appear in the specified zone and at the specified altitude. This can be a useful tool when creating Forward Air Controller (FAC) missions.
  • SMOKE MARKER ON UNIT. This acts the same as the previous action, but instead of occurring within a specified zone, it will appear on a specified unit.
  • SOUND TO ALL. The Sound action enables you to add an audio file to play as a trigger function. This is often used in conjunction with a Message action to add voice messages with subtitles to the mission. Once selected, a FILE field will be displayed along with an OPEN button. Press the open button and then use the file/folder browser to select the desired file (.wav or .OGG formats). The name of the audio file will then be displayed in the FILE field.
  • SOUND TO COALITION. This action allows an audio file to just be play to the defined coalition. Once selected, a FILE field will be displayed along with an OPEN button. Press the open button and then use the file/folder browser to select the desired file (.wav or .OGG formats). The name of the audio file will then be displayed in the FILE field.
  • SOUND TO COUNTRY. This action allows an audio file to just be play to the defined country.
  • SOUND TO GROUP
  • START PLAYER SEAT LOCK
  • START WAIT USER RESPONSE. This action begins to listen for the player to press the Space bar key. Once pressed, the action sets the flag specified in the action attribute.
  • STATIC ACTIVATE
  • STOP AND DEPLOY TO TEMPLATE. Using this action, an AI group can be made to stop movement along its route and take up a position as defined by a formation template (for example, an artillery battle position).
  • STOP LAST SOUND
  • STOP PLAYER SEAT LOCK
  • STOP PLAYING ACTOR
  • STOP RADIO TRANSMISSION
  • STOP WAIT USER RESPONSE. This action stops listening for the player to press the Space bar key. This action can be useful when creating mission scenarios where the player is to command AI groups to perform various actions, such as advance forward or hold position, by binding the desired AI actions to the flag number of the corresponding custom radio message.
  • UNIT AI OFF. Disable the artificial intelligence of the selected unit. The unit will stop all movement, sensor operations and will not engage in combat.
  • UNIT AI ON. Activate the artificial intelligence of the selected unit. Only possible after use of the UNIT AI OFF action on the unit.
  • UNIT EMISSION OFF
  • UNIT EMISSION ON

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)

DCS Mission Making Make an AI helicopter to hover.png

Download the mission example

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.

DCS Mission Making add a tanker.png

Download the mission example