Terminator357 Posted February 17, 2024 Posted February 17, 2024 The scenario: Single player CA mission with lots of ground units. CAS aircraft for red and blue have had their 'CAS' waypoint actions deleted and replaced with a series of scripts and triggers that assign them bombing and missile attacks from an orbit waypoint. Everything works great except for one frustrating 'bug': Occasionally (maybe 15-20% of the time) after the CAS aircraft has been assigned a target and initiated its attack run, a ground unit will kill the CAS aircraft's intended target vehicle before the aircraft can fire its own weapon. When that happens the CAS AI immediately breaks off (which is fine) and executes an RTB (which is not fine). I want it to go back to its que and pick up another attack command. While transiting back to its airbase it will always cross through the zone that assigns a new attack, but it ignores that and continues to RTB. I've read elsewhere in this forum that once AI assigns itself "RTB" it becomes a lost cause...I've tried everything from 'Go to waypoint' triggers to using scripts with popTask(), resetTask(), setTask() and pushTask() to force it out of RTB and back into the fight. Nothing works. PopTask, setTask, and resetTask tend to throw "Mission Scripting" errors (or crash the game to desktop) while triggering 'Go To Waypoint' through the ME just makes the aircraft wobble a bit, turn toward the correct waypoint, then immediately turn back to its RTB flightpath. I can kill the plane thru scripts and force the next CAS aircraft to spawn in, but that costs valuable mission time and more often than not the CAS aircraft I'd be killing is still at 100% health and chock full o' perfectly good weapons for blowing things up. Hoping someone out there has a way to work around this...Or am I just S.O.L?
Grimes Posted February 20, 2024 Posted February 20, 2024 As long as you are using pushTask and also not pushing a new mission task to the unit it *should* return to its orbit point once all pushed tasks it has is complete. If it was setTask then that task will overwrite any other task it has and I would expect the AI to return to base if they weren't given any other tasks. If you were giving it a new mission task then I would append a waypoint with the orbit task to the original orbit points so that it is part of the route. 1 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
Terminator357 Posted February 20, 2024 Author Posted February 20, 2024 (edited) Thank you, sir. So, after 3 days of testing I finally concluded that the planes weren't going RTB because their targets were dying before the attack could finish. They were going RTB because the abbreviated attack runs didn't allow enough time for a flag I'd set 50-odd triggers earlier to be reset by the time the aircraft reached the zone that assigns a new attack. Basically they were hitting their last waypoint and failing the assignment of another task, going RTB by default. That was fixed by making the flag I mentioned reset sooner. I have an "Orbit" assigned to that last waypoint but in some cases the plane still ignores it and goes RTB. That might be because sometimes there are no targets to assign until new ones spawn in, but it could be something else entirely too, I dunno. I kept up the testing until I got burned out trying to figure it out. Any kind of 'task' seems to be glitchy when it comes to forcing an RTB plane to go back to a previous waypoint. 'Push', 'Set', or 'Reset' just kept causing problems no matter how I tried to que up waypoint tasks with them. Interestingly enough 'setCommand' works ok. By 'ok' I mean the plane would receive the command en route to the airport, then when the gears went down and it was ready to turn in on final, it would pull the gears back up and turn toward the specified waypoint...only to re-lower its gear and turn back toward the runway a second or two later. Below is the script I used to make that happen, but it's basically the same as just setting a "Switch Waypoint" command in the ME. Both do the funky raise gear and turn away, then lower gear and turn back thing. Thanks again for the suggestions. In the end I just accepted that RTB is a black hole. Once AI goes in, it doesn't come out local Red3 = Unit.getByName('Red CAS 3'):isActive() local Group3contrl = Group.getByName('Red CAS 3'):getController() if Red3 == true then local _destination = {} _destination.fromWaypointIndex = 4 _destination.goToWaypointIndex = 5 local _return = {id = 'SwitchWaypoint', params = _destination} Controller.setCommand(Group3contrl,_return) end Edited February 20, 2024 by Terminator357
SUNTSAG Posted February 21, 2024 Posted February 21, 2024 @Terminator357 I am unsure what is happening in your mission with the scripting but using just the ME I can instigate the following events: · A10CII air start reaches its “ANCHOR POINT” and orbits. · 40 seconds later it starts its first MAV run. · After first attack it returns to the” ANCHOR POINT”. · After a further two minutes it carries out a final attack run. · On destruction of the ground units the A10CII bugs out and RTBs. I have provided the simple example above in the attached .miz file. I hope it helps. Cheers. A10CII AnchorAttack.miz Callsign: NAKED My YouTube Channel [sIGPIC][/sIGPIC]
Terminator357 Posted February 21, 2024 Author Posted February 21, 2024 Thanks. My mission is set up to behave much the same way your example is except that I used scripts and ME triggers in combination because it's just easier for me when there are several planes that will carry out the same tasks. Your aircraft RTB's when you'd expect it to (all ground targets gone) and I think mine is doing the same, but I have new ground units spawning in randomly so I need the aircraft to hold its station even when there are no targets presently available...Or at least force him to turn back to his orbit point after he's decided to RTB, but that bit has been a tough nut to crack.
SUNTSAG Posted February 22, 2024 Posted February 22, 2024 (edited) @Terminator357 In that case the new attached mission does exactly that. Fresh ground units spawn 5 minutes post the death of the previously active groups. I hope it helps. Cheers. A10CII AnchorMultipleAttacks.miz Edited February 22, 2024 by SUNTSAG 1 Callsign: NAKED My YouTube Channel [sIGPIC][/sIGPIC]
Recommended Posts