Another DCS Mission Editor Question

So i have the following scenario worked out:

Pilot A flys into zone A and Group B activates.

No issues there however is it possible to make another group activate randomly based on Pilot A being in Zone A?

I guess I could set a random event at mission start to trigger a flag and then just set that group to activate when pilot A is in zone a and flag x is on right?

Yes. There are a couple of ways to do this. You are going to need to use flags and a little Boolean logic.

1 Like

Look at setting a Random Flag when pilot A goes into zone A, say from 1-4. Then activate your random group whenever the Random Flag = 1.

1 Like

So set flag 2 valve between 1 and 4. Then activate the group when flag 2=2. Do i need to set flag 2 as true anywhere?

I don’t think so. Setting a flag true or false is basically putting a 1 or a 0 in it AFAIK. Correct me if I’m wrong please.

Flags are set to On or Off, then tested for corresponding True or False. A Random Flag ( lets say #4 is set with the range of 1-4) is set up in an Action like for when pilot a flies into zone a. On another event that random flag is a condition, like does that flag #4 = 1 or 2 or 3 or 4. Pick one of those values. Then the Action of that event Activates your group. That action should happen about 25% of the time.

I like to use a flag # for the Random Flag that = the range. For a random range of 4, I use flag #4. For a range of 2 (1 or 2), I will use flag #2.

If you ever use the Flag Increment action, the 1st time that happens then that flag will go On and to the incremental value, and it can be tested for a True condition and for its value. A Decrement Flag action will take the flag’s value lower each time it is Actioned, and last I tested that, that flag’s value will eventually go negative. I am pretty sure that a negative value equates to False. Of course when a flag’s value is zero then it is False.

Any questions? :sunglasses:

1 Like

When I get to my computer, I will add in simple script that you can use to show flag values in a Do Script action.

To be honest that’s clear as mud! Lol

There is a random condition for triggers, so if it’s a simple randomization then have a condition for Unit (Pilot A) in zone, then Random and set a value in terms of percentage chance. You can either activate your group in the effects or activate a flag as needed.

1 Like

– Displaying Flag Values With Text Messages
– Use a Do Script Action (does not require Mist) -

local msg = {}
msg[#msg + 1]='Flag 1 value = '
msg[#msg + 1]=trigger.misc.getUserFlag('1')
msg[#msg + 1]='. \n'
msg[#msg + 1]='Flag 2 value = '
msg[#msg + 1]=trigger.misc.getUserFlag('2')
msg[#msg + 1]='. \n'
msg[#msg + 1]='. \n'
trigger.action.outText(table.concat(msg), 6)

My new Ira’Dib mission is attached so you can check out the events in there.Ira’dib (3.9 MB)

1 Like