Jump to content

How to make or edit an AI's behavior in Tiberian Sun and in Red Alert 2


Recommended Posts

I'm really glad that Banshee let me post all the information about the AI behavior in Tiberian Sun and RA2 here.


Now let's start with Taskforces.


Taskforces are the teamtypes that the AI would build in order to create a strikeforce. Adding them is a bit of headache. Open up your AI.INI it will show the taskforces part of the .ini file and there state the new taskforce you want.



Name=GDI Armor Battalion


Name can be anything. No need to worry about that. On the other hand 999 is the tag of the taskfroce. It defines the its entry. In the code, X is 0,1,& 2 and on the other hand Y defines the number of units you want to add and the name of the unit MUST MATCH with its filename. (Y is the 0=1,HMEC, etc.). You can add more than one type of unit. In this case, you should add more one line after 0=YY,UNIT that should be 1=ZZ,UNIT2...ZZ will be the number of units and UNIT2 will be the internal name of the unit that AI produce located in rules.ini/firestrm.ini.


Group is the formation used by the task force. I`m not sure if all of them work, but it seems to be imported by Ra1 engine:


-1 = Default - All units assume their default

movement and facing settings

-40094 = According to Deezire, the group attack

together at object posing least threat, but I`ve never tested that...


Keep in mind that taskforces don't work alone. They need to be attached with Scripttypes, Teamtypes, and AI Trigger Types, otherwise it will cause an IE (Internal Error).

End of Taskforces information.


Script Types


Script types measures how an AI would behave when ordered to attack. To make new script types open your ai.ini and Ctrl+F [scriptTypes] and you shall be directed there and it should look like this.



Name=Le new script 

Where W = is the entry of the script, X is the...

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 = Missile 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


End of Script Types information.



Teamtypes is where the part where you will combine the taskforces and scriptypes and set some extra infos so the AI will understand clearly on how it will be used. By adding the teamtypes. Follow this step...



000= This is the teamtype.
Name= Can be anything.
Aggressive= makes AI troops to execute their instructions blindly. They will not hunt for enemies or attack enemies that are near, but they will retaliate if attacked.
Annoyance= is set to "no" in every entry, which 
means that the default may be "yes". Annoyance makes AI team attack for a 
short while then retreat and attack again. Good for air strikes. AI will 
also persist with this team by replacing the destroyed members of the team 
and sending them again to the enemy base. 

AreTeamMembersRecruitable= controls if another 
team can steal units away when the current team acomplish its tasks 
(instructions from script types). This appears to to "yes" for every entry, 
so the default must be "no". 

Autocreate is set to "no" in every entry, which 
means that the default may be "yes". This may turn the team into one that is 
created based on time instead of triggers. The time is controlled by the 
setting TeamDelays= in your rules.ini. 

AvoidThreats= control weither or not the unit 
stops to return fire with every unit along it's trip. Only certain attacks 
have this set to "yes". In the ones who have it set as no, AI engages any 
enemy that is in its sight range or guard range. 

Droppod= says if these team members arrive in a 
Drop Pod. None of the entries has this set to "yes". This is probably only 
used in single player maps. 

Full= is set to "no" for every entry. I suspect 
that this is used for things like Weed Eaters arriving with full loads or 
transports. It`s recommended to only use it on single player maps. 

Group= controls the way that AI groups its units 
in the current task forces. It is set to "-1" for nearly every entry except 
a number of GDI "pools", which are "-40094". It may override the settings 
Group= in the Task Forces. 

GuardSlower= is set to "no" for every entry, so 
the default must be "yes". It increases the value of BaseDefenseDelay= (in 
the rules.ini) from the specific team. The current team will respond slower 
to attacks in its own base. 

House= controls which side gets this team. 

IonImmune= probably means that these team 
members ignore the effects of Ion Stroms, because they get immune to them 
(if it`s set to "yes"). Every entry has this set to "no", so the default may 
be "yes". 

IsBaseDefense= determines if this team hangs 
around to defend the base. It will also protect the units that has 
ToProtect=yes. The number of teams with IsBaseDefense=yes line is limited to 
the settings defined in MinimumAIDefensiveTeams= and 
MaximumAIDefensiveTeams= statements in rules.ini. This is set to "no" except 
for "pool" teams. 

Loadable= should be set to yes if one (or more) 
of the members of the team need to reload its ammo=. All entrys have this 
set to "no". 

LooseRecruit= is set to "no" for every entry. It 
determines if the team is dissolved after completing its tasks defined on 
the script type. Dissolved units are free to be recruited by other 

Max= is the number of times that AI will 
autocreate the team. The values range from "1" to "3", but you can put more 
than it. If your team type doesn`t have autocreate=yes, set it to 1. 

Name= is a quick description of the team, such 
as "H_GDI APC/commando attack". Useful for 
finding the right one to play with. 

OnlyTargetHouseEnemy= stops the teams from 
attacking neutrals. Every entry in ai.ini has this set to "yes". 

OnTransOnly= says that this team will only 
execute its associated script type if it has any instruction related to load 
and unload transports. If this transport task isn`t completed successfully, 
the team is dissolved. No entries in AI.INI have this set to "yes". 

Prebuild= determines if an inactive copy of this 
team type should be built before AI needs to use it. It`s usually used in 
high priority team types, so AI has a backup of the units if they are killed 
(usefull to expensive stuff that takes time to be built). Every entry in 
AI.INI has this set to "no". 

Priority= is the build priority for this team. 
The values used by Westwood in Tiberian Sun are "4", "8" and "12". But you 
can use any value. The lower the number, the greater the probability of AI 
build this team. 

Recruiter= probably means that this team can 
call up loose units to form it rather than build new ones. Every entry has 
this set to "no". 

Reinforce= is set to "no" in every entry. It`s 
used on single player maps only and determines if this team type forms 

Script= specifies which script type of the 
script types list that this team will use. Remember that script types are 
the actions that the team will do. 

Suicide= tells the units of the current tean to 
ignore any damage and keep on going. The team will not retaliate or scan for 
any enemies. The Sight= and GuardRange= is completely ignored by AI. Most 
entries have this set to "yes". Use this for air strikes, but avoid using it 
on land ones... 

TaskForce= specifies which task force from the 
task forces list the team will use. Remember that Task Forces are the units 
that make up this team. 

TechLevel= is the lowest tech level that this 
team is available at. This only affects the teams with autocreate=yes. Note 
that this overrides the tech levels in Rules.ini. All of the entrys in 
ai.ini have this set to "0". 

TransportsReturnOnUnload= tells the transport 
unit (normally some kind of APC) to return to base after unloading the rest 
of the team and dissolve the team. Use this to unnarmed transports. 

VeteranLevel= is set to "1" for all of these 
entries. It controls the Vetran status, and thus could be either a "2" or 

Whiner= is set to "yes" for "pool" teams and 
"no" for those with active jobs. It should only be used only by 'pool' 
TeamTypes to determine if destroyed members of the associated TaskForce are 
automatically replaced by the AI. This is because 'pool' TeamTypes are 
normally assigned to base defense missions or generic missions such as 
guarding, hunting or scouting and their members are always made available 
for recruitment into further teams (a mechanism which ensures that the AI 
doesn't always have to produce every team from scratch since it will have a 
pool of units from which to assemble future teams).


And here is an example:



Name=H_Nod banshee pool






























End of Team types.


AI Trigger Types

This is a complex one so step by step process and understanding skills is neccessary if you still wish to make or revise an ai.ini because without this trigger TS and RA2 will 100% cause an internal error.


AI Trigger Types determines the conditions to AI build your team type. It`s the hardest part of ai.ini, but it was recently supported in Final Alert 2. With Westwood`s help, it was easier to understand these codes.


Note that some settings of AI Trigger Types overrides the settings of Team Types (specially the ones without autocreate).


To make new AI Trigger 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 AI Trigger Types and write your new ai trigger type. You don`t need to declare it in lists. Take a look at an example:


080D6920-G=M_Nod tib. refinery attack 2,073AEA00-G,<all>,5,0,PROC,




Huh? What? How?


Too weird, don`t you agree? But I`ve compared some values and we have some translation here:


080D6920-G = Internal name of the Trigger

M_Nod tib. refinery attack 2 = Description made by the editor (can be everything you want)

073AEA00-G = Primary Team-Type used in the trigger.

<all> = Which house builds this?

5 = Minimum tech level required for AI use this trigger.

0 = Type of trigger. It will explain AI when it needs to launch the trigger. This is the main part of the condition to make trigger work (Check below).

PROC = Type of object in the condition to make trigger work (related to type). Use <none> if type is -1, 2, 3 or 4.

0300000003000000000000000000000000000000000000000000000000000000 = Internal data. It says if AI will need more, less, equal number of objects determined also inside it. It`s a huge value splitted in 3 codes (Check below).

30.000000 = Starting weight of the trigger. The higher the weight, the higher the probability of AI build this trigger.

10.000000 = Minimum weight.

70.000000 = Maximum weight.

1 = Available in Skirmish? (1 for yes, 0 for no).

0 = Unknown meaning. It`s 0 for every trigger. (According to Deezire, it`s probably related to AI Generals, yet it`s unknown)

2 = Side that builds this troop. (0 for None, 1 for GDI, 2 for Nod).

0 = Base Defense? (1 for yes, 0 for no)

04173E00-G = Secondary Team-Types used in this trigger.

0 = Easy AI Build this? 1 for yes, 0 for no.

1 = Normal AI Build this? 1 for yes, 0 for no.

0 = Hard AI Build this? 1 for yes, 0 for no.


Type of triggers can be:


-1 = No condition

0 = Enemy owns a certain number of a type of object.

1 = Player house owns a certain number of a type of object.

2 = Enemy`s power is yellow.

3 = Enemy`s power is red.

4= Enemy owns a certain ammount of cash.

7 = Neutral owns a certain number of a type of object.


The first part of the huge value is the number of objects of the condition in a hex value (use calculator for any help):




X = Hex value (I.e.: "1" or 1, "a" for 10, "f" for 15, etc...)


The second part of the huge value determines the limits for the condition become true:


000000000 = Less than...

010000000 = Less than or Equal to...>

020000000 = Equal to...

030000000 = Greater than or Equal to...

040000000 = Greater than...

050000000 = Not Equal to...


The third part of the huge value has an unknown meaning. Here are some examples generated by Final Sun/Alert2:





The rest is a mystery according to Banshee. If you know something you can e-mail him ([email protected]).



Confused in the AI Trigger Types section? Well it's a bit confusing but once you got your head on modding, you'll realize and understand it slowly. I'll try to break things down again for the AI trigger section using this code.


0CAD0C7C-G=Allied Anti-Weather,0A6E513C-G,<all>,9,0,GAWEAT,0100000003000000000000000000000000000000000000000000000000000000,70.000000,10.000000,70.000000,1,0,1,0,0CB246CC-G,0,1,1


0CAD0C7C-G - ID of the trigger. You can rename it to anyway you want.

Allied Anti-Weather - The name given to the trigger. Name it in anyway you can.

0A6E513C-G - Designated Team Type

<all> - Which house will build this??? (GDI, Nod, etc.) (1 for GDI, 2 for Nod, etc) so if you have more sides then assign it to the side you want.

9 - This is the minimum Tech level required for AIs in order to execute the trigger.

0 - This is the condition type. (-1 Special case - Pool team, 0 Enemy house owns?????, 1 Owning house owns???? 2 Enemy is low on power [yellow color], 3 Enemy is totally low on power [red color] 4 Enemy house has ???? of credits 5 and 6 is RA2 related stuff and 7 tells civilian owns a certain structure)

GAWEAT - Specifies the object that will be used as the Comparison Object (see the section on ConditionType for more information). IDs of AircraftTypes, BuildingTypes, InfantryTypes and VehicleTypes are accepted here.

0100000003000000000000000000000000000000000000000000000000000000 - This is the Comparator. It defines the comparator for the ConditionType. A normal comparison contains two operands and a comparison operator. The first operand is dependant on the ConditionType (typically amount of objects owned, or credits owned). The second operand is encoded in this argument. The comparison operator is one of (less, less-or-equal, equal, more-or-equal, more, not equal) and is also encoded in this argument. This argument is composed of eight chunks of eight hexadecimal characters each (64 characters in total). Each octet contains a textual representation of a little-endian hexadecimal number. The first octet contains the second argument, the second octet contains the operator (0 stands for "<", 1 - "<=", 2 - "=", 3 - ">=", 4 - ">", 5 - "!="), the next six octets are unused.

70.000000 - This is the starting weight of a trigger it specifies a floating point value that will be set as this AI Trigger's Starting Weight when the game starts.

10.000000 - This is the minimal weight and it specifies a floating point value that will be interpreted as this AI Trigger's Minimum Weight.

70.000000 - This is the maximum weight of a trigger and it specifies a floating point value that will be interpreted as this AI Trigger's Maximum Weight.

1 - This value tells if this is available in all but for skirmish if this value is set to 0.

0 - This one is an unused value. I dunno why but this is always set to 0 for safety measurements.

1 - This tells which side has the authority to use this trigger 0 for all however, positive values must be put for sides.

0 - This value tells if this is a base defense purpose or not 0 for not.

0CB246CC-G - The second TeamType that will be created when this AI Trigger meets its condition.

0 - This value tells if this trigger will be fired by AIs in Easy Difficulty.

1 -This value tells if this trigger will be fired by AIs in Average Difficulty.

1 - This value tells if this trigger will be fired by AIs in Extreme Difficulty.



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...