Jump to content

Recommended Posts

Posted (edited)

Hey everyone,

when building missions I always found it rather difficult to randomize certain events.
For example if you have 10 groups of enemy fighters and you want to activate them *all*, but in a random sequence with the ME alone this seem very difficult.

So I created a tool to create as many random sequences as you want in a mission.

 

This is the logic:

You define a certain range of flags for example 100 - 120. 
Then in the ME you create 20 Triggers with the condition Flag is true : 100,101, ..., 120 . And then for example Activate Unit -> Group1, Group2, ... , Group20.
Now you initialize an instance of REVSQ in a DO SCRIPT (you can create as much sequences as you want in a mission btw):
MY_RANDOM_SEQUENCE = REVSQ.new{baseFlag = 100, n=20}
-- This creates a new sequence that will correspond to the flags 100-120.
-- Now you can trigger the next random flag with MY_RANDOM_SEQUENCE:next()
---- So for example when one of the Group dies, you can create a trigger with condition group dead -> DO SCRIPT : MY_RANDOM_SEQUENCE:next(), or create a Radio command for it or whatever you can think of.

More detailled documentary in the file itself.

The only DCS API calls that are used are "trigger.action.outText" when debug=1 and "trigger.action.setUserFlag". The rest is just plain lua.
Feel free to try it out and to share it, and let me know what can be improved. 

REVSQ_v2_2_5.lua

Edited by Racoon-1-1

System: i7-12700k, 64GB, 3080TI, Win11, Reverb G2, Thrustmaster Warthog + Virpil WarBRD Base + Virpil Pedals

Aviate, Navigate, DISCOMBOBULATE!

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...