TEMPEST.114 Posted February 20, 2023 Posted February 20, 2023 I have a tanker created in the ME that is working perfectly. It's taking off, flying to a waypoint, and starting a race-track from that waypoint to the next (it's penultimate wp - the last being land back at base). The TACAN, EPLRS etc is all set and players can tank from it. In my script I give it a new waypoint some distance away (to simulate the front of the battle moving and returning players needing fuel to get home). This new position is a waypoint with a new task of ORBIT i.e. NOT Race-Track, with a new altitude and speed and obviously, new location. Here is the task I'm creating prior to doing the 'pushTask(missionTask)' command. missionTask = { ['id'] = 'Mission', ['params'] = { ['route'] = { ['points'] = { [1] = { ['speed_locked'] = true, ['type'] = 'Turning Point', ['action'] = 'Turning Point', ['alt_type'] = 'BARO', ['y'] = -171753.07753682, ['x'] = -74403.995537434, ['speed'] = 494.08524741803, ['task'] = { ['id'] = 'ComboTask', ['params'] = { ['tasks'] = { [1] = { ['id'] = 'Tanker', ['params'] = { } }, [2] = { ['id'] = 'Orbit', ['params'] = { ['altitude'] = 6093.019511968, ['pattern'] = 'Circle', ['speed'] = 494.08524741803 } } } } }, ['alt'] = 6093.019511968 } } }, ['airborne'] = true } } And here is the Tankers default tasks as set from the mission editor (as extracted from env.mission PRIOR to any push) { ['frequency'] = 308, ['uncontrollable'] = false, ['modulation'] = 0, ['groupId'] = 27, ['tasks'] = { }, ['route'] = { ['points'] = { [1] = { ['alt'] = 6096, ['type'] = 'Turning Point', ['action'] = 'Turning Point', ['alt_type'] = 'BARO', ['y'] = -120070.2017037, ['x'] = -112581.74056971, ['speed_locked'] = true, ['formation_template'] = '', ['speed'] = 256.94444444444, ['ETA_locked'] = true, ['task'] = { ['id'] = 'ComboTask', ['params'] = { ['tasks'] = { [1] = { ['enabled'] = true, ['auto'] = true, ['id'] = 'Tanker', ['number'] = 1, ['params'] = { } }, [2] = { ['enabled'] = true, ['auto'] = true, ['id'] = 'WrappedAction', ['number'] = 2, ['params'] = { ['action'] = { ['id'] = 'ActivateBeacon', ['params'] = { ['type'] = 4, ['AA'] = false, ['callsign'] = 'TEX', ['system'] = 4, ['channel'] = 5, ['modeChannel'] = 'X', ['unitId'] = 71, ['bearing'] = true, ['frequency'] = 966000000 } } } }, [4] = { ['number'] = 4, ['auto'] = false, ['id'] = 'Orbit', ['enabled'] = true, ['params'] = { ['altitude'] = 6096, ['pattern'] = 'Race-Track', ['speed'] = 256.94444444444, ['speedEdited'] = true, ['altitudeEdited'] = true } }, [3] = { ['enabled'] = true, ['auto'] = true, ['id'] = 'WrappedAction', ['number'] = 3, ['params'] = { ['action'] = { ['id'] = 'EPLRS', ['params'] = { ['value'] = true, ['groupId'] = 2 } } } } } } }, ['ETA'] = 0 }, [2] = { ['alt'] = 6096, ['type'] = 'Turning Point', ['action'] = 'Turning Point', ['alt_type'] = 'BARO', ['y'] = -179273.68825996, ['x'] = -29021.264048868, ['speed_locked'] = true, ['formation_template'] = '', ['speed'] = 256.94444444444, ['ETA_locked'] = false, ['task'] = { ['id'] = 'ComboTask', ['params'] = { ['tasks'] = { } } }, ['ETA'] = 398.56100914256 } } }, ['hidden'] = false, ['units'] = { [1] = { ['alt'] = 6096, ['type'] = 'KC135MPRS', ['alt_type'] = 'BARO', ['psi'] = 0.61641499418087, ['livery_id'] = '100th arw', ['skill'] = 'Excellent', ['onboard_num'] = '023', ['y'] = -120070.2017037, ['x'] = -112581.74056971, ['name'] = 'KC135-MPRS_TEXACO', ['payload'] = { ['pylons'] = { }, ['fuel'] = 90700, ['flare'] = 60, ['chaff'] = 120, ['gun'] = 100 }, ['speed'] = 256.94444444444, ['callsign'] = { [1] = 1, [2] = 1, ['name'] = 'Texaco11', [3] = 1 }, ['heading'] = -0.61641499418087, ['unitId'] = 71 } }, ['y'] = -120070.2017037, ['radioSet'] = true, ['name'] = 'KC135MPRS', ['communication'] = true, ['x'] = -112581.74056971, ['start_time'] = 0, ['task'] = 'Refueling', ['uncontrolled'] = false } And here is my code for creating and pushing the new task function MoveTankerTask(playerData) local point = GetMoveToPoint() if point.x and point.y and point.z then local missionTask = BuildAircraftTaskFrom(point, playerData.selectedTanker.speed, playerData.selectedTanker.altitude, true) PushNewTaskForGroup(missionTask, playerData.selectedTanker.group) end end function BuildAircraftTaskFrom(destinationPoint, speed, altitude, isAircraft) isAircraft = isAircraft or false local missionTask = {} missionTask.id = "Mission" missionTask.params = {} missionTask.params.route = {} missionTask.params.route.points = {} if isAircraft then missionTask.params.airborne = true end missionTask.params.route.points[#missionTask.params.route.points+1] = CreateBasicOrbittingAircraftUnitWaypoints(destinationPoint, speed, altitude) return missionTask end function CreateBasicOrbittingAircraftUnitWaypoints(destinationPoint, speed, altitude) -- Goes into POINTS local waypoint = {} waypoint.x = destinationPoint.x waypoint.y = destinationPoint.z waypoint.alt = altitude waypoint.alt_type = "BARO" waypoint.speed = speed waypoint.action = AI.Task.TurnMethod.FLY_OVER_POINT waypoint.type = AI.Task.WaypointType.TURNING_POINT waypoint.speed_locked = true waypoint.task = {} waypoint.task.id = "ComboTask" waypoint.task.params = {} waypoint.task.params.tasks = {} local orbitTask = { ["id"] = "Orbit", ["params"] = {} } orbitTask.params.altitude = altitude orbitTask.params.pattern = "Circle" orbitTask.params.speed = speed waypoint.task.params.tasks[#waypoint.task.params.tasks+1] = orbitTask return waypoint end function PushNewTaskForGroup(missionTask, group) group:getController():pushTask(missionTask) end So, if I don't push the new task, the tanker just does its regular race-track pattern between two waypoints just fine. When I push this new task, it deviates from it's race-track course for a few minutes but then returns back to its racetrack course and carries on as if nothing happened. If I popTask() before I push the new one, it makes no difference. I can't see anything wrong with this. HOWEVER, if I use 'setTask' and recreate the entire Tanker Task from scratch i.e. recreate the tacan, eplrs, tanker -a and the new waypoint information and SET that - then it loses the old racetrack pattern and moves CORRECTLY to the new position and does the circular orbit as I expect. Therefore I conclude that PUSH with a correctly formatted waypoint for a tanker, at least, is broken.
Recommended Posts