Home   Help Search Login Register  

Author Topic: AI Boarding and disembarking from plane  (Read 777 times)

0 Members and 1 Guest are viewing this topic.

Yippyfn

  • Guest
AI Boarding and disembarking from plane
« on: 10 Sep 2004, 11:34:44 »
So in this mission, what I'm basically trying to do is have a group of ten AI board a plane that I'm flying, then I'll fly them to another airfield and drop them off there. Kinda like a taxi service. The only problem is, I'm clueless as to how it's done. Any ideas?

PsyWarrior

  • Guest
Re:AI Boarding and disembarking from plane
« Reply #1 on: 10 Sep 2004, 12:17:18 »
Greetings,

Yes, this is possible. There are two main ways of doing this:

First make sure the editor is in 'Advanced' mode - If you see the word 'Basic' in the top Rt hand corner of the editor, click once on it. If it says 'Advanced', leave it... :P

With waypoints:

Place a 'LOAD' waypoint from your plane, next to the units you want to pick up (not on them). Then, place a 'GET IN' waypoint from the infantry group leader, next to your get in waypoint. Press F5, or click on 'Synchronise' at the top of the screen, and draw a line between the two waypoints.

This will cause the infantry units to board your plane, when you reach the waypoint. Place a 'TRANSPORT UNLOAD' waypoint for your plane at the end of the journey.

Note that this method is fine for AI units, but you should NEVER use waypoints to trigger something for a player unit. Use the method above if you want any AI controlled planes flying around, but use the Scripted method below for the Player controlled unit.

-or-

Scripted:
Place a trigger (F3, or the trigger button at the top, then double click on the map) near the infantry units you are to pick up. Make it large enough so that the edge of the trigger is about a realistic distance from the infantry group that you would stop your plane for the infantry to board. Go into 'groups' mode (F2, or groups button), and drag a line from the trigger to the player unit.

Now, we need to get the infantry to board the plane. First, ensure that you have given the leader of the infantry group a name (in the name field of the 'Edit Unit' dialog). For instance, you could call him InfLeader. Do the same with your plane. Then, go back into your trigger. In the field lablelled 'On Activation', type:

"_x assignAsCargo Plane1" forEach units group InfLeader; units group InfLeader orderGetIn true

substituting InfLeader with the name you called your infantry group leader, and plane1 with the name of the plane.

This will first assign all the units in the group of InfLeader (units group InfLeader) as 'Cargo' in the plane (assignAsCargo plane1), but will not order them to board the plane. Then, all the units in the group of InfLeader (units group InfLeader) will be ordered to get in whatever vehicle they are assigned to (orderGetIn true), in whatever position they are assigned (in this case, Cargo).

To get them to disembark, place a trigger near the end point, set the size to 0 by 0 and set the condition to "Radio Alpha". In the 'text' field, type "Disembark". In the "On Activation" field, enter
"UnAssignVehicle _x" forEach units group InfLeader

For a description of the ForEach command, look in the Command Reference, in the editors depot.

If you are new to scripting, you may want to read "A Friendly Introduction to Code Snippets" by snYpir

Reference:
-OFPEC Online ComRef:
http://www.ofpec.com/editors/comref.php
-snYpir's "Friendly Introduction to Code Snippets":
http://www.ofpec.com/editors/resource_view.php?id=13
-OFPEC Editors Depot:
http://www.ofpec.com/editors/

Enjoy... ;)
As always, no guarantees on syntax, logic, or even that I'm talking sense... :P

-Supr. Cmdr. PsyWarrior
-Psychic Productions
« Last Edit: 11 Sep 2004, 18:28:42 by PsyWarrior »

Yippyfn

  • Guest
Re:AI Boarding and disembarking from plane
« Reply #2 on: 10 Sep 2004, 17:48:42 »
Thanks man, I'll try that out! I appreciate the elaborate explanation!  :D

PsyWarrior

  • Guest
Re:AI Boarding and disembarking from plane
« Reply #3 on: 11 Sep 2004, 18:27:21 »
Quote
I appreciate the elaborate explanation!
That's good to hear - most people just tell me in short words and no uncertain terms to write shorter posts... ::)

Let us know how you get on...

-PsyWarrior