Solved!! 🥳
I find my mistake, I only needed to cast the coordinates to Core.Point#COORDINATE. This seems to work so far, it allows me to spawn several flights and set their route during my mission depending on what I need
BLUE_CAP_ISRAEL = SPAWN
:New("Blue CAP F15E")
:InitLimit(8, 16)
:OnSpawnGroup(
function(SpawnGroup)
local position = COORDINATE:New(ACTIVE_POSITION.x, ACTIVE_POSITION.y, ACTIVE_POSITION.z)
local flightgroup=FLIGHTGROUP:New(SpawnGroup)
flightgroup:Activate()
local wp1=flightgroup:AddWaypoint(position, 550, nil, 35000) -- This must be switched for a loop
end
)
And from the radio menu I can call
BLUE_CAP_ISRAEL:SpawnAtAirbase(AIRBASE:FindByName(AIRBASE.Sinai.Ovda), SPAWN.Takeoff.Runway)
In my simple tests it works. I create a marker, capture its coordinates on an event and then spawn a flight which is directed to that position. Now let's hope it will still work during an actual mission with enemies and air defenses, or if the AI decides to scrap its orders and do random stuff, as usual 😛