ienatom Posted October 2, 2023 Posted October 2, 2023 (edited) Hello everyone, I am trying to create a script that changes the destination of an AI plane group once a specific flag is on but I cannot find the proper action/function for it. The main idea behind it is that once an F10 menu command is selected the previously spawned cargo plane would fly, land and eventually despawn at the selected airbase so that its cargo can be added in the warehouse of the airport. Due to the big amount of different cargoes and destinations it's too time-consuming to add 80 different groups that fly and have different destinations and cargo, so I was thinking that something like that would be easier to manage. Does anyone know how this can be accomplished? I am also accepting suggestions on how to do it differently. Edited October 2, 2023 by ienatom CPU: AMD Ryzen 7 5800X, RAM: 4x16GB G.Skill Trident Z Neo DDR4-3600 CL16, GPU: Gigabyte RX6800XT Aorus Master, MB: Gigabyte X570 Aorus ultra My userfile content is available here (liveries, mods and whatnot)
Grimes Posted October 2, 2023 Posted October 2, 2023 Have to push a new mission task to the group. https://wiki.hoggitworld.com/view/DCS_task_mission Should be as simple as creating a waypoint where the aircraft is currently at and then another at the airbase in question. local unit = Unit.getByName("cargo") local uPoint = unit:getPoint() local ab = Airbase.getByName("Krymsk") local abPoint = ab:getPoint() local rtb = { id = 'Mission', params = { airborne = true, route = { points = { [1] = { type = "Turning Point", action = "Turning Point", x = uPoint.x, y = uPoint.z, alt = uPoint.y, speed = 650, -- 350 knots }, [2] = { type = "Land", action = "Landing", x = abPoint.x, y = abPoint.z, alt = abPoint.y, speed = 650, -- 350 knots airdromeId = ab:getID(), }, } } } } unit:getGroup():getController():pushTask(rtb) The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
Recommended Posts