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.
-- 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)
-- 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
-- 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)