jsr9597 Posted December 13, 2024 Posted December 13, 2024 I'm trying to write a script for an aircraft to cold start at an airport then fly to a destination airport via multiple waypoints. I simply can't figure it out. Will someone please help me?
buur Posted December 14, 2024 Posted December 14, 2024 nothing simple my friend, nothing simple. Nearly a year a go a worked on a class based on Moose which is doin this job. Unfortunately hadn't the time during this year to work on it. From the scratch is very hard. You wan't to use something like Moose or MIST?
jsr9597 Posted December 14, 2024 Author Posted December 14, 2024 Yes...Moose. Just can't figure it out...erg!
buur Posted December 14, 2024 Posted December 14, 2024 Check out attached mission. There are several option to let a plane fly around: It is based on Moose develop version. Done this begin of the year but unfortunately I didn't found the time to really finish it. Hope it is working for you. You know how to get out the code out of a mission?NRAT_exampleMission.miz point1 = ZONE:New("point1"):GetCoordinate() point2 = ZONE:New("point2"):GetCoordinate() -- create a route via PATHLINE route = PATHLINE:FindByName("path1") myroute = route:GetCoordinates() -- example 1: plane fly from one airport to an other with given departure parking spots and set to takeoff hot testFlight = NRAT:New("plane","no1",nil,AIRBASE.Caucasus.Kutaisi,AIRBASE.Caucasus.Batumi) testFlight:SetDepartureParkingSpot({43,44,45}) testFlight:SetTakeoffType(SPAWN.Takeoff.Hot) testFlight:Start() -- example 2: plane fly from one airport to an other via given points with given altitude testFlight2 = NRAT:New("plane","no3",{point1,point2},AIRBASE.Caucasus.Kutaisi,AIRBASE.Caucasus.Batumi) testFlight2:SetAltitude({3000,3000}) testFlight2:SetTakeoffType(SPAWN.Takeoff.Runway) testFlight2:Start() -- example 3: plane fly via a given route with given altitude and given speed testFlight3 = NRAT:New("plane","no4",myroute,AIRBASE.Caucasus.Senaki_Kolkhi,AIRBASE.Caucasus.Batumi) testFlight3:SetAltitude({1000,2000,3000,4000,5000,4000}) :SetSpeed({250,300,350,250,350,350}) :Start() -- example 4: planes are sheduled. function flightNo5repeat(aVar) flightname = string.format("funflight%d",aVar) testFlight4 = NRAT:New("plane",flightname,myroute,nil,AIRBASE.Caucasus.Batumi) testFlight4:SetAltitude({1000,2000,3000,4000,5000,4000}) testFlight4:SetSpeed({250,300,350,250,350,350}) testFlight4:SetRandomizeCallsign(true) testFlight4:Start() end for i = 10 ,50, 10 do local mytimer=TIMER:New(flightNo5repeat,i) mytimer:Start(i) end -- example 5: plane starting in air and despawn at the endpoint. Start is delayed for 30 seconds. testFlight5 = NRAT:New("plane","no6",{point1,point2},nil,nil) testFlight5:SetAltitude({3000,3000}) testFlight5:__Start(30)
jsr9597 Posted December 14, 2024 Author Posted December 14, 2024 I will take a look. How do I get the code out of the mission? very much appreciate you and your help.
buur Posted December 14, 2024 Posted December 14, 2024 miz files are simple paked folders. Unzip the .miz and check for the luas in l10n/DEFAULT folder. 1
jsr9597 Posted December 15, 2024 Author Posted December 15, 2024 OK..thx for teaching me about the miz file....that is very helpful. So, when I have been starting my missions I load moose.lua then my scripts. But you are using two differint files. Can you help me understand that? Again, really appreciate your help.
jsr9597 Posted December 15, 2024 Author Posted December 15, 2024 One last question....why dont the aircraft land at their destination base? They simply fly around the vicinity but never land.
cfrag Posted December 15, 2024 Posted December 15, 2024 (edited) 3 hours ago, jsr9597 said: .why dont the aircraft land at their destination base? Off the top of my head, a coupe of possible reasons come to mind the airbase may not be in possession of the coalition the airbase may not have a free parking lot of sufficient size the airbase may not be an airbase the AI is wonky and feels that you should suffer Edited December 15, 2024 by cfrag 1 1
buur Posted December 15, 2024 Posted December 15, 2024 vor 8 Stunden schrieb jsr9597: OK..thx for teaching me about the miz file....that is very helpful. So, when I have been starting my missions I load moose.lua then my scripts. But you are using two differint files. Can you help me understand that? Again, really appreciate your help. NRAT is the class with all the necessary commands and in the mission file they are called. You need both with NRAT loaded first.
buur Posted December 15, 2024 Posted December 15, 2024 vor 6 Stunden schrieb jsr9597: One last question....why dont the aircraft land at their destination base? They simply fly around the vicinity but never land. wondering... in the uploaded example mission they are landing on the destination base. You have simply start the example mission? For landing the AI needs some time, and the AI flying lot of curves before start landing. So give the AI some time. You are working with the develop version of Moose?
jsr9597 Posted December 15, 2024 Author Posted December 15, 2024 Yes…working with the develop version (the file you used). 1
Recommended Posts