Script Types (ai.ini)
August 09, 2003 - 14:32
Tutorial Name: Adding New Script Types
Made by: Banshee
Difficulty: Moderate

Extra Info:

The whole veracity of the information below cannot be guaranteed. I am unable to test everything, however, most of info over there comes from Final Alert 2, Deezire's Editing Guide and also from testing and comparison between script types. This tutorial was originally written to the old Intel Website (from PPM) and to Entertainment Explosion. Since EE is no more, it has been placed here in PPM. Note that it was also originally designed for TS and Red Alert 2, but when it came for EE, it become TS only. If you wanna post this tutorial anywhere, please ask me thorugh email ( ).

       :: Adding New Script Types ::

 Script Types are the way AI behaves when attacks. What does it target for? Will the units deploy? And other stuff.
 To make new Script Types, you need to open your ai.ini if you don`t have Firestorm or your aifs.ini if you have Firestorm and go to the ScriptTypes List and write your new script type:

 XX is an unused number for the script type and SCRIPT1 is the internal name of your script type.
 Then you have to decide what AI will do now. There are some codes that you can use, but it will be something like this:
 Name=My new script type.

 Name can be anything....W is the number that indicates the number of behaviours. (Begins with 0 and works like the number in these lists) X is the type of the act and Y is the value of the type.
 X can be:
 0 = Attack a target - In this case Y will be:
 1 = Go to the enemy base (Required if you want AI to attack someone, but it isn`t used for APC rushes).
 2 = Attack air units.
 3 = Attack harvester.
 4 = Attack infantry.
 5 = Attack vehicles.
 6 = Attack Factories. (Includes Construction Yard)
 7 = Attack Base Defense.
 8 = Attack Base Threats (Very usefull for your base defense team)
 9 = Attack Power Facilities
 1 = Attack a waypoint. In this case Y is the number of the waypoint. It can be used to make units infiltrates in buildings too. Only use it in maps.
 2 = Cyborg members of the team will go berzerk. Y must be 0.
 3 = AI team will move to a waypoint. Y will be the number of the waypoint. Only use it in maps.
 4 = Orders the team to move to a specific cell on the map. Y will be the cell...
 5 = With this, AI will guard area for an specified amount of time. Y is the time ticks. 1 time tick = 6 seconds.
 6 = This is a cool feature. It makes AI return to the line of the script that you want. I.e:

 Notice that when AI read the line 2, it will go back to the line 0. It`s good for big scripts.
 7 = Player wins. Y must be 0.
 8 = Unload transport. Infantry will leave any kind of APC. I`m not sure if it works with vehicles. Y can be:
 0 = Keep transports, keep units.
 1 = Keep transports, lose units.
 2 = Lose transports, keep units.
 3 = Lose transports, lose units.

 It`s recommended to use 2.
 9 = Set units to deploy. Y must be 0.
 10 = AI team will follow the nearest friendly unit.
 11 = Assing the team into a mission. Mission is Y that can be:
 0 = Sleep. (Unit sits still and plays dead).
 1 = Attack (using threat rate logic).
 2 = Move.
 3 = QMove (special move to destination after other queued moves occur).
 4 = Retreat (unit leave away, probably returns home).
 5 = Guard. (Sit around and engage any enemy that wanders within weapon range.).
 6 = Sticky. (Same to guard mode, but the unit doesn`t move).
 7 = Enter (in a building or transport).
 8 = Capture building (uses engineer`s logic).
 9 = Harvest. (Harvesters will only take near tiberium).
 10 = Area Guard. (Great for base defense).
 11 = Return (Unused in Tiberian Sun).
 12 = Stop (stop atacking or moving at th first oportunity).
 13 = Ambush (Unused in Tiberian Sun).
 14 = Hunt (AI will automatically search and kill every enemy unit).
 15 = Unload (when leave transports like APC, Dropship, etc...).
 16 = Sabotage (places a C4 in a building and leaves exploding it).
 17 = Construction (buildings use this after their
 placement. Don`t use it in ai.ini, because it just deal with buildings).
 18 = Selling (buildings use this after being sold).
 19 = Repair (service depot use this behaviour to repair units).
 20 = Rescue (special team override mission. Use it in maps).
 21 = Missile (special Missile Silo animation. Do not use it in ai.ini).
 22 = Harmless (Unit doesn't fire and is not considered a threat).
 23 = Open (animation that happens when a gate opens or close to allow passage).
 24 = Patrol (Patrol a series of waypoints).
 Note: You can edit these behaviour in your rules.ini.
 12 = Set global. Global is a variable that serves to make AI understand that the thing X happened. You can enable other triggers after a Global value is set. Y is the variable and can have any name you want.
 13 = Team members will have their idle animation. Y must be 0.
 14 = Load troops on transports like APCs... Y must be 0.
 15 = Was related to spy, but even Westwood says that it's obsolette. So, don`t use it.
 16 = Patrol to waypoint. Y is the number of the waypoint. Since you don`t know the number of the waypoint, because maps are different, it isn`t good to add it in ai.ini or aifs.ini, but if you make maps, it will be very good for you...
 17 = Change script. This makes the AI team to follow another script. Y will be the internal name of this script.
 18 = Change team. Causes the team to switch team-types. Y is the new team-type.
 19 = All members of the team will panic. Y must be 0.
 20 = Team members will switch sides. I.e.: With this script, a computer unit can be yours. Y is the house number of the new owner.
 21 = Units will scatter. Y must be 0.
 22 = Causes a unit to flee to a shrouded cell. It`s a weird function. Y must be 0.
 23 = Player loses. Y must be 0.
 24 = Play a speech from EVA, Cabal or even another user made speech...Y is the number of the speech.
 25 = Play a sound that is in sound.ini (or sound01.ini). Y is the number of the sound.
 26 = Play a movie. Y is the number of the movie set in your art.ini.
 27 = Play a music. Y is the number of the music in theme.ini
 28 = Reduces the ammount of Tiberium near team-members... Y is probably the ammount of tiberium...
 29 = House will begin the auto-production process (AI behaviour in skirmish games). It will build base and units. Y should be 0.
 30 = AI will sell its buildings and make all their units hunt the enemy. Y must be 0.
 31 = Causes the member to self-destruct. Y must be 0.
 32 = Ion Storm starts in a specified time that is Y.
 33 = Causes Ion Storm to end. Y is 0.
 34 = Center view on team. Y is the speed of this operation. It wasn`t really clear by Westwood.
 35 = Reshroud map. Y must be 0.
 36 = Reveal map. Y must be 0.
 37 = Delete team-members. Y should be 0.
 38 = Clear Global. (More info about Global on 12)
 39 = Set Local. Like Global, Local is also a variable. The difference is that Global can be used outside your maps and Local is just used in this map.
 40 = Clear Local. (More info about Local on 39)
 41 = Unpannic. Y must be 0.
 42 = Force team members to face certain direction. According to Deezire, Y can be:
 0 North
 1 North East
 2 East
 3 South East
 4 South
 5 South West
 6 West
 7 North West

 43 = This is basic for an APC attack. This code makes your APC wait until it`s fully loaded. Y must be 0.
 44 = This makes trucks unloads crates. Y must be 0.
 45 = This makes trucks to load crates. Y must be 0.
 46 = Attack a specifically building. Y is the number of the building specificated in BuildingTypes list in rules.ini and firestrm.ini. Note: an engineer will infiltrate in the building, a unit with C4=yes will explode the building.
 47 = Move into a specifically building. The unit will be adjacent to the building, but it will not enter on it. Y is the number of the building specificated in BuildingTypes list in rules.ini and firestrm.ini.
 Here are some special values that are used for Y when X is 46 or 47:
 131073 = Refineries
 131074 = Power facilities
 131076 = Upgrade Center
 131084 = Construction Yard
 131113 = Missilo Silo

 Each number is a building, but I couldn`t find them out yet.
 48 = The team will scout bases from players that hasn`t been scouted. Y should be 0.
 49 = It will force the team to acomplish the previous objective until it successfully acomplish it, so it can move into the next instruction.
 50 = Flashes a team for a period of time. Y is the period of time in time ticks (1 time tick = 6 seconds).
 51 = Plays an animation over every member of the team. Y is the animation.
 52 = Displays a talk bubble over the first unit of the team. Y can be:
 1 = * - General Speech
 2 = ? - Question
 3 = ! - Shouting

Related Tutorials:

- Task Forces (For TS and RA2)
- Team Types (TS Only)
- AI Trigger Types (TS Only)
- AI Mini Guide (RA2 Only, but it shows a global use of all parts of ai.ini together which is also interesting for TS modders)