Jump to content

Recommended Posts

Posted

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?

Posted

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?

Posted

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)

 

Posted

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.

Posted (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 by cfrag
  • Like 1
  • Thanks 1
Posted
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.

Posted
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?

  • Recently Browsing   0 members

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