Home   Help Search Login Register  

Author Topic: Determining the Path  (Read 2152 times)

0 Members and 1 Guest are viewing this topic.

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Determining the Path
« on: 26 Dec 2010, 18:32:13 »
Hi okay, I have my mission as an insertion via helo with 4 soldiers inside cargo. The helo flies to drop off "above water" about 10meters. The soldiers eject out and swim to boat. Then drive the boat to shore.

The problem is:
The helo flies past the waypoint, turns around, and just stands there. What I want it to do, is continue it's waypoints, fly to the one where it flies in height at 6-7meters above the water; drops/ejects the soldiers in cargo; and flies carelessly away to a place away from the action.

Commands I use in triggers are;
Quote
helo1 flyinheight 6; W1 action ["eject"] &&  W2 action ["eject"] &&  W3 action ["eject"] &&  W4 action ["eject"]

What happens is the helo flies past the waypoint, turns around and just sits there at about 70 meters, it doesn't do what I want it to do..
Who's hyped for Arma4, long live Arma!

Offline savedbygrace

  • Intel Depot
  • Administrator
  • *****
  • Be swift to hear...slow to speak...slow to wrath.
Re: Determining the Path
« Reply #1 on: 28 Dec 2010, 10:05:56 »
Phew, I messed with this thing on and off for about 2 days, trying to figure out what the AI was actually programmed to do.

Trying the simple way first...
Waypoints that were meant for land terrain are certainly not meant for below sea level operations. So anytime a transport unload waypoint is synchronized with a getout waypoint on water, the helo will always find the nearest land to perform the order. It will then hover there while the group swims back out to sea to activate their waypoint before ever flying off. That's not what anyone wants to do at all. So, synchronized waypoints are definitely out the window for waterborne operations.

The next option is to assign waypoints to the helo and control it's movement with conditions and timeouts. this worked great so long as the piloting skills of the AI does not overrun waypoint activation perimeters.

The first thing you need to do is set the helo to "careless"("stealth" to shut down navigation lights) and "never fire". Otherwise they will ignore all waypoints and enter in to the hard code that seems to force them to engage all hostile threats that appear on their radar before carrying out other orders.

Secondly, you need to begin slowing the speed of the helo down to "limited" at about 150 meters before the actual hovering waypoint. This will give you a better chance of the AI being precise with it's stopping point.

The trick is understanding waypoint activation and completion rules. The thing to remember when depending on waypoints for movement is that speed, behavior, formation and combat mode are all inherited the moment the vehicle completes the waypoint before it. In order to stop a vehicle, you must control it with the condition field of the next waypoint.

Insert your first waypoint 150-250 meters before your chosen hovering point to maintain normal speed until then. You can adjust the flying height in the Onactivation field a little here if you like.

Insert your second waypoint where you would like the drop to occur. The speed should be set to "Limited" in this one so that once the helicopter completes the first waypoint, it will inherit the speed attribute of the second and slow down. That will prevent shooting beyond the waypoint. In the condition field of this waypoint, you want to prevent the drop from occurring to high or while the helo is still moving. So insert
Code: [Select]
(getpos heloName select 2 <= 6) && (speed heloName) <= 1 into the condition field. Now the chopper will come to a stop at a height of 6 or whatever number you choose to make the drop before the activation field kicks in. If you include a timeout in this waypoint, it will come to a stop and wait that timeout before executing the activation field. In your Onactivation field insert
Code: [Select]
zodiak1 setpos [(getpos heloName select 0),(getpos heloName select 1),(getpos heloName select 2)-1]; {_x action ["eject",heloName]} foreach units groupName; {Unassignvehicle _x} foreach units groupNameOf course, you'll have to create the zodiak boat and name it first before you can set it in place. That will eject all group members at once as the boat drops to the sea. If you don't unassign cargo units from vehicles, they will try and board it again. In this case, the helo will go to the nearest land and set down and wait for the group to swim ashore and mount.

Place a Third waypoint next to the second and put a timeout into the timeout fields, all the same number. If you don't do this, the helo will take off as it's executing the OnActivation field of waypoint number two and your drop scene may become messy. With the way that the chopper is spitting the group into the sea, it happens instantaneously. So put a 5 second timeout to keep the helo still long enough to look right. You can readjust the flying height of the chopper in the third as it's on it's way out.

The fourth waypoint should be placed wherever you want it to exit with speed adjusted to normal.

That is the easiest way to do it.

A script would better control the direction of which the boat is placed under the helo for drop, ejecting the units one at a time with a delay, handle the boat mount, etc.

I personally do not like the new way AI fly choppers above limited speed. It seems that they constantly job the nose to gain speed and then regain control causing an unsightly dipping effect. It's grossly unacceptable. So, I would prefer to place the helo closer, set it to limited speed at start and flying at 10 meters nearly all the way to the drop, lowering it to 6 at 20 meters away.

Hope this helps.
« Last Edit: 16 Oct 2011, 20:35:30 by savedbygrace »

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Re: Determining the Path
« Reply #2 on: 30 Dec 2010, 21:07:15 »
Hi, wow thanks for the effort. I'll definitely give some of these ideas a try. I'm still working on the mission; it's kind of in the back shelf right now, but in progress. But anyways, yeah waypoints and syntax is tricky when it comes to the AI. I'll figure something out. Basically SAS operatives are jumping out of a helo at about 6-7 meters above water and this would be a type of insertion they would do. Then they'll climb up on a boat.
Who's hyped for Arma4, long live Arma!

Offline savedbygrace

  • Intel Depot
  • Administrator
  • *****
  • Be swift to hear...slow to speak...slow to wrath.
Re: Determining the Path
« Reply #3 on: 16 Oct 2011, 20:36:30 »
The AI has proven to be quirky when trying to get them to do what you expect them to.

I have worked for nearly a week on attempting to start the engines of a helo and having it sit idle on the tarmac until troops board it(however long it takes). I have come to a conclusion that it's possible to have a helo sitting with it's engines off and start it any time you like and have it stay there indefinitely if you so choose. BUT, the second a unit attempts to board it with a Getin waypoint whether it's synched to a Load WP or just double clicked onto the helo, the pilot will decide that he no longer likes his loading spot and will reposition the helo to allow the unit(s) to board.

I've tried ordering the pilot to turn the engines on and then eject him until the unit(s) board but the leader of the boarding group decides that since the driver seat is not assigned to someone at the moment it's GetIn WP is activated, he will fill the role himself and jumps in behind the controls. That obviously breaks the follow up WP's as there will be no way for them to GetOut without the synched TransportUnload WP with the original pilot.

I've tried scripting things and got it to a point where I would start the engines, eject the pilot, move the boarding group leader into a cargo slot while the others load through their ordered WP and then once all are in, the pilot gets back in and off they go, BUT it breaks the GetOut WP for the leader because it seems he never actually activated the GetIn WP(I presume).

In any case, I could only get the helo to stay still until the entire group is aboard by keeping the engines off because if the engines are on, the pilot does his nasty tricks. It IS possible to script a sequence to start the helo, move troops in through code, move the helo, land the helo, order the troops out, and send the helo back to start but I was hoping to make it as simple as possible for newcomers.

I have attached a simple mission demonstrating the taxi service for others to view. the results are not how I originally wanted to do it but it's the closest I have come to without leaning heavily into the scripting world. I went ahead and took a little more time to add an objective you can play through if you like. It's balanced to allow a challenge but not be frustrating enough to ruin game play as most user missions do, unless you have no regard for your safety at all.

There is no briefing or cinema but to outline the goal. You start in an MTVR, pulling onto the tarmac. Ordered out and then into the Chinook. Transported to the general area nearly 300 meters outside of the goal and then ordered to clear the camp. Once the camp is clear, the same helo will return to pick you up before the mission ends.

It's not much but it should give you a good grasp of how to do some things with helos.

If you need to have the engines start when the troops pull into the area before they board the helo, it's better to do it in an intro and then start the actual mission with the troops already aboard.

I'd like to encourage anyone who has been trying to figure out AI and helos loading or unloading to post mission examples of your efforts and results in this thread. It could never hurt to canonize the information.
« Last Edit: 16 Oct 2011, 20:55:12 by savedbygrace »

Offline SaOk

  • Missions Depot Staff
  • *****
    • My youtube profile
Re: Determining the Path
« Reply #4 on: 16 Oct 2011, 20:56:50 »
I have commanded AI choppers with these steps:
-First I use "move"-command to order the chopper to fly wanted location:
Code: [Select]
group pilotname move (position helipad1);-Then I have loop checking if he have reached the location, before forcing pilot to land the chopper:
Code: [Select]
while {!unitready leader group pilotname} do {sleep 3;};
choppername land "land";
-To unload the cargo (group named g1) when chopper is low enough:
Code: [Select]
while {(getpos choppername select 2) > 0.5} do {sleep 3;};
_tt = units g1;
_ct = count _tt - 1;
while {_ct > -1} do {
sleep 1;
unassignvehicle (_tt select _ct);
[(_tt select _ct)] ordergetin false;
_ct = _ct - 1;
};
-Finally order the chopper fly away when cargo is out with:
Code: [Select]
while {({(alive _x) && (_x in choppername)} count units g1) > 0} do {sleep 3;};
group pilotname move (position helistart);

Like this you can have complex "do to"-list for the transport chopper (and land vehicles with small changes). To get a group enter the chopper, you can use the unloading part the other way round:
Code: [Select]
{_x assignascargo choppername;} foreach units groupname;
(units groupname) ordergetin true;

http://community.bistudio.com/wiki/land
« Last Edit: 16 Oct 2011, 21:04:54 by SaOk »

Offline eegore

  • Members
  • *
Re: Determining the Path
« Reply #5 on: 17 Oct 2011, 13:37:38 »

  In regards to loading while the engines run I managed to use flyinheight. 

  I put:  helo1 move (position LZ1); helo1 flyinheight 1   into a trig. 

  Then a :  helo1 flyinheight 30   this gets it to fly but I dont know how to make it trigger when the cargo is loaded so I just made it a Radio ALPHA trig.

  Landings are easy since the helo automatically slows down and will not overshoot a move position location.  I just use another trigger telling it to flyinheight 1.  I don't know how to get it to fly up once the cargo is unloaded so one again I just use the radio. 

  The unfortunate thing is that AI seem to only go to a move position once so I cant get the helo to fly back.  In OFP there was a "domove getpos" command that you could fly units to over and over.  Seems like in ARMA2 you must use waypoints.