Subject: Follow me Till Death! Formations in JO, DFx, and DFx2
Location: Texas, U.S.A.
Member Is Offline
Mood: Not enough hours in a day
posted on 10-11-09 at 05:30
Follow me Till Death! Formations in JO, DFx, and DFx2
--Thread under construction-- Introduction
This thread covers scripting Non-Player Characters (more commonly known as AI) into following another AI or player.
This thread will cover AI scripting using the Event Tasker as well as the more advanced WAC scripting.
Getting set up:
If your going to do any sort of AI scripting, it is best to start out as simple and easy as possible. Thus, we shall use the Delta
Force: Xtreme Map Editor Deluxe (DFXMED) in the beginning. As you learn the WAC scripting, you can then use either the MED or Novalogic Interactive
Level Editor (NILE) to design your mission, however it must be noted that WAC scripting typically takes longer to hand-code.
Building the Test Map
First, Open up the MED and create a new mission file (MIS) or open an existing MIS via the File menu option.
Note: If you are creating a new MIS, go to Edit >> General Information (or Ctrl and I) to access the general
options of the map. Fill out the Mission's Name and the Creator's Name with the appropriate values, Select a terrain by clicking the drop-down box,
and then press OK. (Don't worry about the other stuff for now).
Second, place Six AI's, a player spawn marker, Four waypoints, and an Area Trigger
Tip: To see where you've placed your Area Trigger on the map, be sure to place small objects on each corner of the
trigger, such as FX Lights
Third, select Two of the AI's by first tapping the U key, and then select the two AI's
Fourth, tap either Enter key to bring up their attributes. Make sure that both AI are on Team Blue, are
Blind, and have the waypoint list of 127 - Follow Player.
Note: This will make the AI follow the player individually and stop at a set distance away. However, they will
also tend to run into each other due to lack of environment awareness.
Fifth, unselect your Two AI, and then select two more. Get them into the same group (We'll use group 3), and then set them to waypoint list
Note: If you haven't done so already, put your waypoints into list 1 by selecting all of the waypoints, and then
set the Waypoint List drop-down box to 1 in your Items Attributes (Enter)
Tip: Each time you create a new Waypoint List, Area Trigger, or Group, it's a good idea to name them by going into the
Edit drop-down menu, and then clicking on the respective selection
Sixth, create a new event, with an IF statement of "SSN 10000 is in Area 1"and a THEN statement of "Redirect SSN # to nearest waypoint in list
Lastly, Save and Export your map. to watch the AI's behavior
Observe, and Modify
What you have just done is create a simple map with a few AI that will carry out their two movement types: Follow an SSN (The
player), or Follow a Waypoint List.
For those of you who are wondering, yes, it is possible to create a formation of AI, but you must do massive scripting in order to make it come out
The easiest formation to make is that of Column, or a line in which the leader is in the front, and the units follow right behind him.
For column type formations, you make the leader of the formation follow the waypoint route, and daisy-chain each of the followers
to follow the guy in font of them. You can do this in the Events by Redirecting each unit to waypoint "125 - Goto SSN Any" and select the unit they
will be following. In WAC, you would use the ssn2ssn command.
Tip: It is highly suggested that you use the WAC for formations and general movement of AI. Try to keep the Event Tasker
for Player-initiated events and the WAC for AI movement/behavior
Note: if you are making a column formation using vehicles, you can't use the "Follow the guy in front of me" method, you have to
make them follow the same waypoint list. Make an event or WAC script that tells the formation to slow down and stop when the Leader reaches the end of
Tip: To make vehicles realistically slow down before reaching the end of the waypoint list, make one of the waypoints to be near the Stop
point, and make them slow down once they reach the "slow-down" point. For formations, you make the entire formation slow down (If you do not slow
down the entire formation, they will crash into each other.)
Line-Abreast, Finger-Four, and Echelon type formations require that each unit of the formation follows their own waypoint. Synchronization of these
formations requires scripting that makes the quicker units slow down or stop to wait for the slower units, or make the slower units to speed up.
For these tips of formations, you use the If statement of "SSN has reached Waypoint" to make sure your followers are on the same
track. If you want your followers to continue on once the leader has died, you place an "OR" statement for each of the followers.
SSN 0 Reaches Waypoint 1 - 0 OR
SSN 1 Reaches Waypoint 2 - 0 OR
SSN 2 Reaches Waypoint 3 - 0
Redirect SSN 1 to Waypoint 2 - 1 AND
Redirect SSN 2 to Waypoint 3 - 1 AND
Redirect SSN 3 to Waypoint 4 - 1
Tip: In the Event Trigger dialog, there is a tool group at the bottom of the dialog window called "Logic," This will daisy-chain the
triggers and initiate the actions for the event depending on the logic.
AND - Will initiate action if this trigger AND the next are triggered
OR - Will initiate action if this trigger OR the next is triggered, but will not take action if both are triggered
XOR- Will initiate action if this trigger, XOR the next is triggered, Will take action if either are triggered.
Note: You unfortunately can't make the Players as the Formation leader in these types of formations, only as followers.
If you are making a formation that will attack another formation, such as a Tank column attacking a convoy, you can script the attackers to run the
same waypoint list as the victim.
If you are making a convoy of different types of vehicles, you may also want to make sure they have the same AI Text file because each vehicle has
their own default Patrol (Normal) and Combat (Alerted) speeds.
Tip:To change an AI or Vehicle's AI Text file, simply look for the "AI Text File" drop-down box in the Items