Jump to content

[MOOSE] Make helo land on different airbase than take off


Recommended Posts

Posted

Hi,

 

I'm scripting a mission where helo's are dynamically spawned and get assigned waypoints to land at a different airbase. The problem is that (depending on the spawn type) they won't land, but instead turn around and fly back to the airbase where they spawned.

 

Note that I spawn the helo's using SpawnAtAirbase. If i use SPAWN.Takeoff.Cold or SPAWN.Takeoff.Hot they won't land and fly back. If I use SPAWN.Takeoff.Runway or SPAWN.Takeoff.Air they do land at the designated airbase.

 

I can't figure out what's causing the difference. If I create this in the mission editor they land as intended. I tried to mimic the code but with no succes yet. This is the code I'm using to assign the waypoints, but have tried multiple variations already:

 

function routeHELO (GROUP,FROMAIRBASE,TOAIRBASE)

 -- ROUTE
 local route = {}
 
 -- SPEED & ALTITUDE
 local speed = math.random( 150, 250 )  

  -- CURRENT
 local currentCoordinate = GROUP:GetCoordinate()
 local currentWaypoint = currentCoordinate:WaypointAir("RADIO",COORDINATE.WaypointType.TakeOffParking,COORDINATE.WaypointAction.FromParkingArea,speed,true,FROMAIRBASE,nil,"TAKEOFF")  
 route[#route+1] = currentWaypoint 

 -- AIRBASE
 local landingCoordinate = TOAIRBASE:GetCoordinate()
 local landingWaypoint = landingCoordinate:WaypointAir("RADIO",COORDINATE.WaypointType.Land,COORDINATE.WaypointAction.Landing,speed,true,TOAIRBASE,nil,"LAND") 
 route[#route+1] = landingWaypoint 
 
 GROUP:Route( route, 1 )
 
end

 

Does anybody have a clue as what might be the reason for this behaviour?

Why is spawnType causing a difference?

Posted

Thank you for your reply. I tried looking at the RAT code to see how it's done, but I can not find the essential difference. Also the RAT code is very complex al together.

 

I noticed this problem does not only apply to helo's. I also can't have an aircraft land at a different airbase compared to the one it spawned. It is as if the spawn airbase is pinned to the group/unit if I use the SpawnAtAirbase function. Or maybe I'm completely misunderstanding the waypoint/routing system?

  • Recently Browsing   0 members

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