DCS Mission Building w/ enemy AI spawning at random alt and skill level

I am trying to build a number of different training missions for F15C (1.5xx ver) where the enemy will spawn
at random altitudes and have random skill level

I would like to first limit the type of aircraft that is spawned in a random event where it is a non-combat A/C such as the AN-26, AN-30, A-50, etc etc

Then in future missions, start dealing with aircraft bombers such as IL-78, Tu-95, etc etc

Third type of mission will intercept fighters.

All aircraft in each scenario would spawn in a certain area and random altitudes (between 2,000 to 30,000 ft) and have a random skill level. (easiest to medium only on some levels) or (Medium to excellent on other missions)

This is so that I can learn using the missile and radar system without being overwhelmed and develop some skill in searching so that I don’t always know where they will be on what altitude.

I have done some searches and saw how to create some random events, but not this specific type of spawning.
Most vids I see with triggers are placement of vehicles, but not enemy AC.

I am trying to understand this Moose system, but I am getting very confused with the script language.
I can’t figure out how to use the DCS trigger functions (as the drop downs don’t seem to accommodate this - as I understand them).

Is there a way to do this?

2 Likes

P.S. At first I only want one A/C to spawn at a time.

Later I would like to spawn two A/C (especially with fighters and bombers) when I develop missions with a wingman

hi @jack72

To what level do you already understand the mission editor? Are you still trying to learn the editor or is this just some MOOSE specific thing? IMO, as great as tools as MOOSE and MiST are, I’d think its best to learn with the editor just as it is, before adding advanced features with those 3rd party tools.

You could design a mission as you describe with only the editor if you’d be willing to drop a few features as random skill level, and changing from trully random altitude to a number of presets.

2 Likes

Thanks Sryan,
Well I will admit, I am trying to learn the mission builder (and I do seem confused by that alone right now) but was hoping that perhaps these 3rd party tools, would make thinks more understandable.

I can drop some of the features first to get use to the mission editor. Do you know of a good vid tutorial that explains it.

I have been going through the ones made by ranger79. but he concentrates on ground units and the A10
Do you know of a good vid tutorial that explains this stuff in a more layman terms.

Alright, Jack.

Unfortunatly, no, I do not know of any good video tutorials. I personally prefer good documentation over videos :slight_smile:

The DCS user manual covers the entire editor in about 167 pages. You can find it in C:\Program Files\Eagle Dynamics\DCS\Doc

the PDF is called DCS User Manual. Another good source of documentation on the editor is the Hoggit Wiki. Clicking this will take you right to the mission editor part of the wiki.

If you give me a few hours, I’ll show you the basics of how to create a mission such as you desire.

1 Like

If you want to show me, I am willing to learn.
As I have gone through the documentation and perhaps I don’t understand the documentation the way it should be understood (or am missing a thought point or two)…and the documentation doesn’t provide feedback, which is what I need.

How do you want to proceed if you are willing to help.

Here’s how I made a mission that is similair to what you seem to want:


Getting started. I gave myself an F-15 with a full compliment of slammers. We’re going to hunt various Red aircraft that will spam randomly, although only one at a time, above the flat plains in the Mozdok area.


My very first action in the editor. I opened the trigger menu. I added a trigger that will fire right away as the mission starts. This trigger will turn flag 1 to a value of 1 (the function of FLAG ON)

What are flags?

Flags are basically the one, single most potent function of the entire editor. Flags are basically a poor man’s version of what would be called variables in other languages of code. Basically, you can store information inside a flag/variable, and allow the code, or in this case, the sim, to act on it. In the most common languages of code, you can store three types of information in a variable.

  • A boolean. This means True or False. A variable that should be false will have a flag value of 0. A variable that should be true will have a flag value 1 or any number that is not zero.
  • an Integer. An integer is a non decimal number. “1” is an integer, and so are 2,3,4,5 and 6. 123456 is also an integer. 0 is also an integer. -2 is also an integer, but 1.5 is not an integer.
  • Strings. Strings are an important feature of real code, but the flags do not support them. So I will not cover them here. They are typically much more complicated than simple booleans and integers. You will most likely have to learn about strings when you decide to pick up scripting (for the Simulator Scripting Engine, wich is DCS’s default scripting engine based on the Lua language. I believe the Mission object oriented scripting enviroment, MOOSE and the Mission Scripting Tool, MiST also support strings)

Fortunatly in DCS, you do not need to define what sort of information is stored in the variable/flag. DCS ‘sorts it out himself’ when the information is requested somewhere else. So if I created another trigger that would ask “Is Flag 1 true or false?” DCS would figure it out and answer “Flag 1 is true”. If I asked DCS “what is the integer of flag 1?” DCS would answer “The integer is 1”.

In DCS, there are 3 major ways to interact with a flag if you consider it a Boolean (true or false) via conditions (the 2nd row in the image)

  • FLAG IS TRUE means you are requesting if the flag is TRUE ( checking if the value is not 0)
  • FLAG IS FALSE means you are requesting if the flag is FALSE ( checking if the value is 0)
  • TIME SINCE FLAG is a pretty cool feature of the DCS editor. It will check if the value does not equal 0 (true), and when it does, it will keep track of the time (in seconds). Once the required amount of time has passed, the condition is met allowing the actual trigger to fire! (provided other conditions have been met as well)

Most of the functions that consider a flag an integer are fairly self explanatory ( FLAG EQUALS, FLAG EQUALS FLAG, FLAG IS MORE, FLAG IS LESS, etc)

Back to our mission!

I created a new trigger, using the pretty cool TIME SINCE FLAG function I talked about. Remember that beforehand, I made a trigger that when the mission starts, flag 1 will get a value of 1. This new trigger I made will look for that flag 1 to become true, then wait 5 seconds and then proceed to turn flag 2 true as well. In normal English: I told the sim to start the game, then wait 5 seconds before proceeding with anything else, I made this as sort of a contigency, making sure everything is loaded in before Continuing.

I think that’s enough info about flags for just now, lets add some things to kill!

In this image, I added a bandit candid. There are two important things to note here. The red arrow points towards the unit’s name. This is the name for this unit in the mission editor, and you can refer to it later. So name it something so you know what it is! The green arrow point towards a function called ‘late activation’. This means that this unit won’t exist in the actual sim until I tell the sim it’s time for this unit to spawn, using the trigger system.

as a bonus I am also showing how to tell the unit that when it reaches its final destination, return to the first waypoint, so it will circle the 4 waypoints indefinitely.

But… we wanted our enemy in a random position at a random altitude right? Like I said before we cannot TRULY do that, but we can emulate it close enough for all purposes. Simply click on the Candid, and copy-paste it around for a bit. (Use CTRL-C to copy, CTRL-V to paste) Make sure to give them all a unique name (I named mine bandit01, bandit02, bandit03 etc) and let’s give them unique routes and altitudes. It may look a little like this. For the example I added 10 possible enemies, but there is no real limit on how many you can add.

That looks like a lot of opponents right? But remember that we told the sim about ‘late activation’? If we start up the sim now, not a single enemy will appear, at all, ever. It’s time for us to dive back into the trigger system. This is the first ‘multi-pronged’ step we’re making, requiring several steps to get the sim to do what we want! Hopefully you can keep track.

To begin with, notice the orange 1 and connected elements. Instead of using the Mission Start or Once types, we’re using the SWITCHED CONDITION type for the first time! This is a ‘reusable’ trigger, one that we can activate an indefinite amount of times, unlike the ONCE trigger wich as the name suggests, can be used only once, or the MISSION START wich only checks once during the mission start (note that if you DO use mission start, and add conditions that are NOT met right at the start, that trigger will NEVER fire! the trigger we made at mission start had no conditions, so it will always work).

Secondly, note the red arrow marked with the numer 2. This trigger will activate when the boolean for flag 2 reads “TRUE”. The first thing this trigger will do is turn the boolean for flag 2 back to FALSE. So if we ever turn flag 2 to TRUE again, the whole mechanism of this trigger will work again.

Lastly, lets look at the juicy stuff for this trigger. The green arrow, marked with the number 3. What this does is give Flag 3 a random integer, that integer should be within the values of 1 and 10. See where this is going? :slight_smile:

We have created a new ONCE trigger.First, look at the conditions. If the integer of flag 3 equals to 1. Then the first Candid will be spawned in, the one flying at angels 15.

Note that there is a handy CLONE function. Simply press the clone button with the correct trigger selected, then increment all the values marked by a red arrow by one. Now the trigger we created 2 images back can choose any random integer between 1 and 10, and the trigger system will spawn a random enemy for us based on that!

So, our mission is complete. It will spawn one random enemy for you to kill. But wouldn’t it be cool that the sim observed your behaviour, and after you killed one, it will spawn someone else for you to kill? Let’s try to do just that. A fairly easy and visual way to accomplish that is by using a trigger zone. An area for DCS to check for bad guys. First, find the trigger zone functionality on the left side of the editor.

Let’s place it somewhere, make it big enough for the enemies to spawn inside of it. Give it a name so you know what it means. You can give it a color if you want.

Ok, that’s that! Back to the trigger system.

There are two good habits I am hoping to teach you by showing you this. Flag 1 was the mission start flag. By telling it to wait 20 seconds after that flag activates, we’re pretty much tell it to slumber for some time until the normal spawn mechanism is done. Otherwise it might spawn one via the regular system, and one via the respawn system. The second habit is, I am Continuing using flag 10. Why flag 10 and not flag 4? No reason… Other than that the flag system has to make sense to only one person… YOU! the mission designer. Imagine if we wanted to add fighter escorts like you described later, would it not be nice if we could use sensible flags like 4,5,6 and 7 instead of having whatever flags come after the respawn systems we’re creating now?

There might be several ways to go at it, but this is the way I made it. Once the slumber time is over. This trigger will start checking if any RED unit is inside the trigger zone. If there is, it will wait. Once that unit is gone because it left the area or you killed it, it will fire flag 2 again, restarting the spawn system we created before! A new random integer is chosen for Flag 3, and a new enemy will appear :slight_smile: Flag 11 will fire my contigency system.

Behold my contigency system, and allow me to explain. The respawn system is not really a respawn system, because you can’t really make units respawn without resorting to scripts (this is where those tools come in handy, IMO MiST is great at doing proper respawns). It simply selects another random bandit to spawn in. This means that after the first bandit, there’s a 10% chance an integer is chosen that is already ‘spent’. And after the 2nd enemy, a 20% chance and so on. This contigency is to make sure that even if an integer is chosen that will not work, the system will ‘cycle’ again to make sure a new integer is chosen until a new bandit does really show up.

Let’s put our mission to the test!

In my trusty Eagle. The skies are completely clear while I settle in the cockpit.

Exactly 5 seconds later, Bandit09 spawns in! Let’s go find him and kill him!


For the best shot, center the dot

That one lone slammer wasn’t enough to kill him so…


BRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRT

That’s more like it

A few seconds after that, Bandit10 shows up! Let’s give him a similair treatment.

And after dealing with that transport as well, Bandit03 shows up!

I hope this proves useful to you. Let me know if you have any questions.

3 Likes

I can help

Thanks Sryan. Will review this and try an duplicate what you’ve got. See what I can learn

Hi Sryan,
I am able to duplicate what you have shown. (will use it as a go to guide for future missions.
I think I better understand it, but it is still swirling around in my brain.

I want to add a variable, in that I want to have two bandits appear in different areas of the trigger zone.

I was thinking that at this stage


and put two random arguments in the Action column. Would that be it

Or
do I also have to continue and set the following:


I would add a second action line (in the Action column) that has another bandit. (i.e. Bandit 1, Bandit 3)

If I then continue as you have indicated and use the clone function in the Type column for as many times I want to repeat this, and add other bandit parings (I.e. Bandit 2, Bandit 5 - Bandit 3, Bandit 8 - Bandit 1, Bandit 9, etc. etc) I want to appear in the Action column it would give me at two bandits at a time.

There are multiple roads that lead to Rome! But this should work. Actions in the trigger list are performed from the top down. So after one random integer is assigned and the corresponding unit spawned, it should immediatly assign a new integer, spawning another bandit. It might be worth testing to see if it works though, because that is a lot of actions in a short space of time, and DCS might skip some. To be on the safe side of things, you could also simply clone this entire trigger as is, and change the FLAG IS TRUE condition to TIME SINCE FLAG and make it wait 1 second after the flag turns true. On the first trigger (the one that simply has FLAG IS TRUE) remove the FLAG OFF action.

The respawn system will work with either of these systems, and select two new integers for spawns. But the system won’t keep cycling until 2 aircraft have spawned. If there is just 1 plane in the area, the system is currently happy. There’s also ofcourse a 1 in 10 chance that the chosen integers are duplicates. If you want to make sure the respawn system keeps cycling until 2 aircraft are flying, we’ll have to modify it, probably using something like the handy [OR] function. If you want to, I’ll be happy to show you just like I did last time, sometime late tomorrow evening (Central european time) when I have acces to my simming computer again.

Otherwise some other mission designers here on Mudspike may be able to help you as well in the meantime. Maybe @WreckingCrew or @near_blind par example, if they have the time for it.