Jump to content

Aircrafts don't always fly at the given altitude of their task mission when scripting


HugoA

Recommended Posts

Hi,

I've been having issues where AI aircrafts do not fly at the altitude I gave them through the task mission in scripting. I have a mission with two fighter groups (Rafale C), an AWACS (E-3A) and a Tanker (KC-135MPRS).

At first, I make them start from parking. I then give them this task

local on_the_way = { 
        id = 'Mission', 
        params = { 
            airborne = true,
            route = { 
                points = { 
                    [1] = { 
                        type = "Turning Point", 
                        action = "Fly Over Point",
                        x = coordinates_plane.x, 
                        y = coordinates_plane.y, 
                        alt = args.altitude, 
                        alt_type = "RADIO", 
                    },
                    [2] = { 
                        type = "Turning Point", 
                        action = "Fly Over Point",
                        x = coordinates_racetrack_start.x, 
                        y = coordinates_racetrack_start.y, 
                        alt = args.altitude, 
                        alt_type = "RADIO", 
                    }
                }
            }, 
        } 
    } 
    


    
    local orbit = {
        id = 'Orbit', 
        params = { 
            pattern = "Race-Track",
            point = coordinates_racetrack_start,
            point2 = convertCoords(args.point2),
            speed = args.speed,
            altitude = args.altitude,
        } 
    }

    local controller = Group.getByName(args.group_name):getController()
    controller:resetTask()
    controller:pushTask(on_the_way)
    controller:pushTask(orbit)

The aircrafts all go to their zones and perform their race track orbit so I know that it  works. The issue I have is that my AWACS flies close to ground level despite the altitude of 20000 feet I give them (I checked this altitude by printing it). When I change the AWACS plane to any other plane it then works and the AWACS flies at the right level.

Things get weirder with the fighters, when starting from parking, my Rafales fly at the right level.  But when they start from the runway, they fly at ground level as well. And when I change their type to Mirage 2000C, they work again and fly at the right level, even when starting on the runway.

So what I thought to be a plane issue seems to also be an issue with their starting zone. But I tried changing the start of the AWACS and none of my changes made it work. I'm also thinking the issue could come from mission scripting as the altitude works when I set the planes routes from the mission editor and not from scripting.

I was wondering if anyone had encountered the same issue in the past. And if so, is there a solution to these issues.

Thanks a lot for your help.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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