Sertica 18 Posted September 13, 2020 Spoiler if (count _westHelis > 0) then { // are any helis available? if (_highestCount > 1 ) then { // is there more than 1 rebel spotted anywhere? { private _position = getPos (leader _highestCountGroup); // position of spotter with highest target count _position set [2, (_position select 2) + 100]; // add 100m elevation private _waypoint = _x addWaypoint [_position, 50]; _waypoint setWaypointBehaviour "COMBAT"; // combat mode _waypoint setWaypointCombatMode "RED"; // fire at will, engage at will _waypoint setWaypointType "SAD"; // search & destroy _x setCurrentWaypoint _waypoint; deleteWaypoint [_x, (currentWaypoint _x)-1]; } forEach _westHelis; } else { // no combat to join { private _position = getPosASL homeHelipad; // position of helipad _position set [2, (_position select 2) + 20]; // add 20m elevation private _waypoint = _x addWaypoint [_position, 0]; _waypoint setWaypointBehaviour "AWARE"; // aware mode _waypoint setWaypointCombatMode "YELLOW"; // fire at will _waypoint setWaypointType "MOVE"; // move to _waypoint setWayPointStatements ["true","(vehicle (leader this)) land 'LAND';"]; _x setCurrentWaypoint _waypoint; deleteWaypoint [_x, (currentWaypoint _x)-1]; } forEach _westHelis; }; }; With this code I have AH-99 attacking then landing. But the way it lands is wack. If it is near a map helipad after the switch to land waypoint it bounces up and down on that indefinitely. If it is over a field the pilots disembark then run to the destination. Share this post Link to post Share on other sites
Gunter Severloh 3948 Posted September 13, 2020 Hello, idk about your code, but have you seen my AI Compilation list, theres many threads talking about AI heli landing maybe there is something you can learn from them if it helps any. Scroll down and look under: AI CAS, Helicopters, & Jets Helicopters 2 Share this post Link to post Share on other sites
Sertica 18 Posted September 13, 2020 Nothing applicable. The one labelled "Let's make AI Helicopter Landings great!" was deleted. UnitPlay can't be used because this is an unpredictable path. However a comment made me realize that the land command ignores the destination. So that goes some way to explaining why they land on the spot and get out. Share this post Link to post Share on other sites
pierremgi 4737 Posted September 13, 2020 The land command can be applied on waypoint completion code or when the helicopter is ready (unitReady yourHelo). Difficulties arise with a pilot shifting on combat mode, detecting enemies. You will never land in combat mode. Furthermore, you can decide to set the waypoint behavior to "combat" mode, but it's a waste of code for "aware" behavior (or even "safe"). "aware" is the default behavior and... all behaviors but "careless" will shift automatically on "combat" mode due to the FSMs (here basic loop for AIs behavior). What you need to read, as Gunter pointed, is not what you're looking for, but the better understanding on what you can do. Share this post Link to post Share on other sites
Sertica 18 Posted September 13, 2020 49 minutes ago, pierremgi said: The land command can be applied on waypoint completion code or when the helicopter is ready (unitReady yourHelo). Difficulties arise with a pilot shifting on combat mode, detecting enemies. You will never land in combat mode. My code is already doing that with setWaypointStatements. It is trying to land in a field while in the AWARE waypoint placed on the helipad, which I know because a detailed waypoint list is printed to screen. The combat waypoint does not even exist at that time. Edit: Wait. Nevermind. I made the condition wrong. Share this post Link to post Share on other sites
Sertica 18 Posted September 13, 2020 Now I'm doubly confused. On one hand it is acting as the issue is how how the waypoint completion is decided. The current condition is "true" but I want it to be the normal behaviour of completing when the unit is near the destination. So I'm guessing setWaypointStatements overrides the default with "true" and now I need to emulate the default with explicit code. On the other hand that does not explain why the pilots still run to the destination. Share this post Link to post Share on other sites
pierremgi 4737 Posted September 13, 2020 The FSMs behavior for any AIs overrides simple goal like a move command. You can see that if, as leader, you order a move for your AIs group. The result is different along with the situation. Just because AIs are supposed to react in contact. They will fight, then reach the waypoint if alive and out of combat mode. Same for an helo pilot. You can do absolutely what you want in a clear area, but pilot will react in combat mode and the reaction is to take off, fly... (and be fired by manpads or heavy calibers). A waypoint completion is just a geographic area on the waypoint position. Different for infantry, vehicles, air assets. (I don't remember the default radius if no completion radius is set, but that can be 300m+ for a jet, 100 m (3D) for an helo). For a group, the leader's position is the reference. Spoiler So, the unit readiness depends on the proximity of the waypoint,... but also some arma engine conditions like the possibility to reach or not (calculated path in a decent time) the destination. You can see some infantry units replying "no, can't do" and staying at their positions. In the command bar, that doesn't take too much time to read their status from "move" to "ready". With an helo, at least, the path is usually OK. The way to override a combat reaction is to set the driver (group) to careless. That can be tricky if you want to keep the gunners aware then combative. Spoiler Behavior note: - if you set by script a full AI group to combat, even with no enemy, the group stays in combat mode... not sure to understand why (test in preview editor) - imho, there is no real differences between setBehaviour and setBehaviourStrong command. The group will react and shift into combat mode anyway. Share this post Link to post Share on other sites
Sertica 18 Posted September 13, 2020 I don't see how that is relevant in this case. I tried changing the wp to careless and exact same happens. But the pilot is supposed to continue engagement until no targets before landing. By the way #2, despite the wiki saying that setCurrentWaypoint takes an array, passing 1 wp does put it in the list. I'm fairly sure now that the main problem is setWaypointStatements not working as the wiki says. It should land and pilots do not run to the destination because the wp is completed. Share this post Link to post Share on other sites
pierremgi 4737 Posted September 13, 2020 1. I remarked your waypoint positions are confused. To make it short, use position ASL only with a waypoint radius set to -1 (see BIKI). And there is no real interest to set an altitude for the waypoint position. It's little bit different if you plan to create an invisible helipad with height and land on it (It's possible but the ground must stay within a reasonable distance (less than 15 or 20 m high, not tested). If you want better help, you should post your tested code (not the first one, but the one with careless status). We just can't see how and when your condition(s) are met, if there are already some existing waypoints (why do you delete the previous waypoint?)... Some people already worked on that, for an age. I wrote a module for (helo) taxi without this kind of problem. You're missing something but we need a more exhaustive repro situation. 2. BIKI is right. A waypoint is an array, so the format waypoint is. There is absolutely no problem neither on the syntax nor coding result on BIKI. People used that for several years. And, believe it or not, the setWaypointStatements is OK. (in your case vehicle leader this is just too much, as this is already leader. So vehicle this land 'land' is enough but your code doesn't fail). Share this post Link to post Share on other sites
Sertica 18 Posted September 14, 2020 6 hours ago, pierremgi said: If you want better help, you should post your tested code (not the first one, but the one with careless status). We just can't see how and when your condition(s) are met, if there are already some existing waypoints (why do you delete the previous waypoint?)... Some people already worked on that, for an age. I wrote a module for (helo) taxi without this kind of problem. You're missing something but we need a more exhaustive repro situation. The only difference is "AWARE" -> "CARELESS". But careless should never be used anyway. I can upload the test mission: https://drive.google.com/drive/folders/1Go7YZPZQU_6wqcXys1rLz4VZIIqs6m5F?usp=sharing You can compress time, then either enter Zeus or switch to gunner. The waypoints of each group are printed on screen. The previous waypoint is deleted because every 10 seconds it is renewed to keep it focused around the spotter. The pasted code is repeated every 10 seconds. I'll try to find a way to skip that if it is the landing order. 6 hours ago, pierremgi said: 2. BIKI is right. A waypoint is an array, so the format waypoint is. Someone said you can't do that in this thread from Gunter's list. Share this post Link to post Share on other sites
Melody_Mike 127 Posted September 14, 2020 Just an aside.. I'm reading a lot about how the Finite State Machine can override the set waypoint behavior. Would it be an idea to set- _heli disableAI "FSM"; For the AI pilot? Share this post Link to post Share on other sites
Sertica 18 Posted September 15, 2020 I tested by playing as the gunner from start to finish this time and solved the mystery of them getting out. It lifts off and lands again when the leader shouts the destination every 10 seconds. They get out and run because each landing is gradually smashing the engine until it it breaks and they abandon. Apparently bots can't land safely on fields, at least not with the AH-99. I also found a way to prevent it from resetting the RTB waypoint, then the pilot got back to the helipad 2/3 times. With that damage issue it still needs to be 100% or the mission is broken. I still don't know why the waypoint replacement makes it land in fields more. After playing as gunner for a while I think this will be a good slot for PvP or a reversely sided mission. Setting behaviour probably should be culled. It changes how ground vehicles drive, but aircraft maybe not. Spoiler if (count _westHelis > 0) then { // are any helis available? if (_highestCount > 1 ) then { // is there more than 1 rebel spotted anywhere? { private _position = getPos (leader _highestCountGroup); // position of spotter with highest target count _position set [2, (_position select 2) + 100]; // add 100m elevation private _waypoint = _x addWaypoint [_position, 50]; _waypoint setWaypointBehaviour "COMBAT"; // combat mode _waypoint setWaypointCombatMode "RED"; // fire at will, engage at will _waypoint setWaypointType "SAD"; // search & destroy _x setCurrentWaypoint _waypoint; deleteWaypoint [_x, (currentWaypoint _x)-1]; _x setVariable ["order", "attack"]; } forEach _westHelis; } else { // no combat to join { if ((_x getVariable ["order", ""]) != "land") then { private _position = getPosASL homeHelipad; // position of helipad private _waypoint = _x addWaypoint [_position, -1]; _waypoint setWaypointBehaviour "AWARE"; // aware mode _waypoint setWaypointCombatMode "YELLOW"; // fire at will _waypoint setWaypointType "MOVE"; // move to _waypoint setWayPointStatements ["true","(vehicle (leader this)) land 'LAND';"]; _x setCurrentWaypoint _waypoint; deleteWaypoint [_x, (currentWaypoint _x)-1]; _x setVariable ["order", "land"]; } } forEach _westHelis; }; }; Share this post Link to post Share on other sites
pierremgi 4737 Posted September 15, 2020 HELICOTER LANDING IN COMBAT I just made this little tuto. 1 Share this post Link to post Share on other sites