Code sample: ScenEdit_AddMission, ScenEdit_SetMission, ScenEdit_AddUnit

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

Post Reply
Craigkn
Posts: 200
Joined: Thu Jan 27, 2022 12:06 am
Location: Central Maryland

Code sample: ScenEdit_AddMission, ScenEdit_SetMission, ScenEdit_AddUnit

Post by Craigkn »

Finding working code can be a chore, so I wanted to share this code. This script creates a ferry mission, sets the flight size to a single airframe, and then creates a series of air units through a loop that will then deploy to that base, from their home base. This specific situation is the remainder [units #7 through #12] of the RAF No. 3 Fighter Squadron (Eurofighter Typhoon) deploying from their home base at RAF Coningsby to a forward deployed air base in Bulgaria. You can adjust this for your own bases and aircraft.

Code: Select all

ScenEdit_AddMission('NATO','Ferry to Bezmer AB Bulgaria','Ferry',{destination='Bezmer AB Bulgaria'})
ScenEdit_SetMission('NATO','Ferry to Bezmer AB Bulgaria', {FlightSize=1, UseFlightSize=false})

for x = 7, 12, 1 do
local callsign = "Thirds #"..x

ScenEdit_AddUnit({type ='Air', unitname=callsign, loadoutid =771, dbid =4948, side ='NATO', base ='RAF Coningsby', mission ='Ferry to Bezmer AB Bulgaria'})
ScenEdit_SetUnit({side='NATO', unitname=callsign, base ='Bezmer AB Bulgaria'})

end
Post Reply

Return to “Lua Legion”