Configuring High Value Air Asset Attack Missions

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

Post Reply
User avatar
SeaQueen
Posts: 1436
Joined: Sat Apr 14, 2007 4:20 am
Location: Washington D.C.

Configuring High Value Air Asset Attack Missions

Post by SeaQueen »

Sometimes you want to create a mission to attack high value aircraft might not be airborne at the scenario start. For example, you might want to set a 4 ship of fighters on strip alert (or maybe airborn) to strike AWACS, tanker, and electronic warfare aircraft. There's not an obvious way to get aircraft of a particular type on the target list of a mission, so I created this LUA script, which is intended to be run in the console, to help you configure your missions.

Code: Select all

 -- to run in LUA console
 
 -- select enemy bases to look for aircraft on the ground
 enemyBaseId= {name='Al Asad Airbase', guid='GWKW9V-0HM9314L9UDIG'}
 enemyBase = ScenEdit_GetUnit(enemyBaseId)
 

Code: Select all

 -- determine targeted aircraft types
 enemyBaseAircraft = enemyBase["embarkedUnits"].Aircraft
 targetAircraftTypes = {[214] = true, [343] = true, [617] = true, [1984] = true,[2045] = true}  -- KC-10, EA-18G, KC-135, E-3B, RC-135W
 

Code: Select all

 -- build target list
 targetAircraft = {}
 k=1
 for i, j in ipairs(enemyBaseAircraft) do
     acft = ScenEdit_GetUnit({guid=j})
     if ( targetAircraftTypes[acft.dbid] ) then
         targetAircraft[k] = j
         k=k+1
     end
 end
 
 print(targetAircraft)
 
 msnName = "OCA - HVAA-A"
 msnTgts = {targetlist = targetAircraft}
 ScenEdit_AssignUnitAsTarget(targetAircraft, msnName)
 
 
hrfepo1
Posts: 248
Joined: Tue Sep 19, 2017 5:19 pm

RE: Configuring High Value Air Asset Attack Missions

Post by hrfepo1 »

Thanks!
Post Reply

Return to “Lua Legion”