DCS ME create 2 random spawn at random time

Hi,

I am trying to create a simpe mission where the F/A-18C enter in a holding for a CAP mission.

A single ship of F-15, F-16 or F/A-18 agressor appears at random time to fly toward the CAP. When the single ship is dead, a dual ship of F-15, F-16 or F/A-18 agressor also appears at random time and do the same.

Basically, this a BVR/BFM mission 2vs1 and then 2vs2.

I am able to manage a unit/group to appears at random time, but I am not able to understand how to make the dual ship to appears. Either they appears at the same time than the single ship or they don"t appears at all.

I am trying to do that for a week without success. Any ideas ?

Thanks,
Vincent

2 Likes

I would make a flag that turns from zero to one on destruction of your first aggressor.

This would then be in the condition for group two to appear.

Welcome to the spike Vince!

2 Likes

Welcome to Mudspike!
@schurem’s solutions is what I would to, too.

1 Like

Hi,

Thank you.

I have tried some trigger and flags, and honestly, this is very difficult to understand for me. Here’s what I did :

Once Unit inside zone (F18, activate) Flag set random value (1,1,100)

Repetitive Time since flag (1,3) Flag decrease (1,1)

Once (1xF15) Flag equals (1,66) Group activate (1xF15)
Group deactivate (1xF16)
Group deactivate (1xFA18)
Flag off (1)

Once (1xF16) Flag equals (1,33) Group deactivate (1xF15)
Group activate (1xF16)
Group deactivate (1xFA18)
Flag off (1)

Once (1xFA18) Flag equals (1,1) Group deactivate (1xF15)
Group deactivate (1xF16)
Group activate (1xFA18)
Flag off (1)

Once Group dead (1xF15) Flag set random value (2,1,100)
OR
Group dead (1xF16)
OR
Group dead (1xFA18)

Repetitive Time since flag (2,3) Flag decrease (2,1)

Once (2xF15) Flag equals (2,66) Group activate (2xF15)
Group deactivate (2xF16)
Group deactivate (2xFA18)

Once (2xF16) Flag equals (2,33) Group deactivate (2xF15)
Group activate (2xF16)
Group deactivate (2xFA18)

Once (2xFA18) Flag equals (2,1) Group deactivate (2xF15)
Group deactivate (2xF16)
Group activate (2xFA18)

I used flag 1 for the first wave and flag 2 for the second at the condition the first wave is dead. In my logic, that should work, but it didn’t.

You are doing three or four different things with flag 1. Try using different flags for different uses.
1 is your random number. 2 is wether you are in engagement zone. 3 is wether 1xf15 is alive or dead, etc.

1 Like

I would probably do it in Lua with MOOSE … but I tend to like to over complicate things.

1 Like

Hi,

Found the solution, just use a flag to determine when the first wave is dead.

I cannot attached the file to the mission because I am a new user ?

Thanks a lot for your help.

1 Like

Yup, this. The ‘flag’ thing is a royal PITA. I have cheat-sheets to denote a scheme for flags for each mission. Wish they’d just provide hooks for a ‘more real’ language like C/C++/#, Java, etc. The tools are free and they have debuggers! Arg. Probably a tool for LUA now but I’m not messin with that stuff much anymore (DEEP bunny hole there).

1 Like

@Vctpil welcome to Mudspike! I bumped up your user level. Let me know if this helps.

I will try to throw together a quick mission tonight with Lua. Will post it later unless I get distracted by Scotch, the Viggen and/or Divinity Original Sin 2.

Divinely original sins committed with two Viggens, hmm I’ll drink a scotch to that :beers:

2 Likes

I think I see what you are doing and as you have already observed, you need to use more than one flag.

A couple of things for what they are worth, from how I approach missions:

  • I always start with a an initialization tigger to get all men flags set up using a “Time is More =1” condition. If I have any randomized functions I set them in this trigger. Also I set all the T / F flags that I will be using.

  • I use different flags for different functions. T / F, counters, randomized, Time Sicne Flag, etc - each gets its own flag. That way you can keep things separated - if you change one thing, the other are not changed.

  • I like to take use of the Time is More and Time Since Flag conditions - gives you some flexibility. e.g. if you want a SAM to become active at a 5 minutes into the mission and then 1 minute later you want to get a radio call that the SAM is active: First trigger Time is More = 300; Flag 1 = On. Then a trigger Time since Flag 1 = 60; Radio Message. If later you work to that you want the SAM to activate earlier or you want the call at a different time, you can change 1 without doing the math for both…I don’t like doing a lot of math. :grimacing:

…and welcome.

1 Like

Oh, you guys and your Flag 1 use.

WC’s Flags.txt (15.0 KB)

2 Likes

Ok. Here is my attempt. It is a little more chaotic that the original specs.

Zip file contains:

  • My development version (dynamic .lua file loading – you probably don’t want this one): MS-D15-Air_Training-v01.miz
  • A release version with all the lua packaged inside it (you probably want this one): MS-D15-Air_Training-v01_rel.miz
  • A copy of my .lua scripts outside the .miz:
    • Moose*.lua - is the Moose library;
    • MS-D15-DevLoader.lua - is my dynamic loader so I can edit the lua without having to go back and re-add it to the mission in the editor for every change I make;
    • MS-D15-WorldSetup.lua - which is the meat and potatoes;

Mission has:

  • 1 F-18C set to ramp start as player (I think you want an AI wingman, so add one to that);
  • When you enter the polygon CAP zone, an enemy target will spawn within 2-4 minutes;
    • Targets are selected at random from:
      • F-15, F-16 or F-18;
      • 1-ship or 2-ship elements;
      • Clean, AIM-9M + AIM-7M or AIM-9M + AIM-7M + AIM-120B load outs;
      • Generally from the North, flowing down to your CAP zone;
      • 15,000 to 25,000 feet;
  • 1x C-130 for fuel;
  • 1x E-3C AWACS;
  • 2 Hawk batteries south of the CAP if you get into trouble;
  • If you leave the zone, the spawning stops, but the active AI do not :-);

I was going to adjust the spawn interval from 2-4 minutes to 4-15 but I forgot. This is the line in the WorldSetup.lua that you have to change for that:

Line 27: _spawndelay_min = 2
Line 28: _spawndelay_max = 4

This may or may not work. No warranty is expressed or implied. :slight_smile:

[Mudspike-D15-Air_Training.zip|attachment](upload://qeNmAFosAncVvj5ZJNeHzYTt7Wl.
zip) (2.0 MB)

© 2020 Mudspike.com | Articles Website | Forums Rules & FAQ