...
April 13, 2003 - 04:25
This is a simple tutorial that shows and you explains to you how to make AI use your custom units. Use Deezire's guide to complement it as well. You can find Deezire's Guide in his site, http://www.deezire.net. Feel free to reply if you have any doubts about it.

Making AI Use Custom Units


AI.ini has 4 sections:

- task forces (indicates the units that AI will build)
- script types (indicates the actions that AI units will do)
- team types (link task forces with script types and also controls the group behaviour)
- ai trigger types (specify the causes of AI building this team)



Overview in Task Forces:

The Task Forces are declared in [TaskForce] list and have the following formula:

[INTERNALNAMEOFTHETASKFORCE]
Name= Name of Taskforce that serves as comments. You can write all crap there including "hello mum! i'm modding"
0=N0,MYUNIT
1=N1,MYOTHERUNIT
2=..... follow the aboves if you want more units
Group=-1  

Explanation:

[INTERNALNAMEOFTHETASKFORCE] = The name you used declared your task force and the same name needed in TaskForce= of your team types to make AI build the units of this task force

Name = Put the name you want for your task force, specially something that will help you to recognize the units built here.

0=, 1=, 2=.... This is the sequence that will tell the units that needs to be built. It starts with 0 and grows as long as you want other unit types in your force.

N0, N1, N2... = Quantity of the unit type to be built

MYUNIT, MYOTHERUNIT.. = Internal name of the unit declared in rules.ini

Group=-1 => related to formation, it's better to not mess up with it.


Overview in Script Types:

The Scripts are declared in [ScriptTypes] list and have the following formula:


[INTERNALNAMEOFTHESCRIPTTYPE]
Name= Name of ScriptType that serves as comments. You can write all crap there including "hello mum! i'm modding"
0=T0,V0
1=T1,V1
2=..... follow the aboves if you want more units


Explanation:

[INTERNALNAMEOFTHESCRIPTTYPE] = The name you used declared your script type and the same name needed in Script= of your team types to make your teams follow the actions you wanted for this Script Type.

Name = Put the name you want for your script type, specially something that will help you to recognize the actions that will be followed here.

0=, 1=, 2=.... This is the sequence that will tell the actions to be followed. It starts with 0 and grows as long as you want other actions in your force.

T0, T1, T2... = Type of the action to be followed.

V0, V1, V2.. = Value atributed to the type.


There is documentation for all types in Deezire Editing Guide that you can get in his site (by being registered to his forums).


Overview in Team Types:

The Teams are declared in [TeamTypes] list and have the following properties:

[INTERNALNAMEOFTHETEAM]
Name=
VeteranLevel=
MindControlDecision=
Loadable=
Full=
Annoyance=
GuardSlower=
House=
Recruiter=
Autocreate=
Prebuild=
Reinforce=
Droppod=
Whiner=
LooseRecruit=
Aggressive=
Suicide=
Priority=
Max=
TechLevel=
Group=
OnTransOnly=
AvoidThreats=
IonImmune=
TransportsReturnOnUnload=
AreTeamMembersRecruitable=
IsBaseDefense=
OnlyTargetHouseEnemy=
Script=
TaskForce=

The whole documentation can be found in Deezire guide. But if you cant be bothered to learn all of them, the most important ones are the Script= where you put the script type used by the team and the task forces (the units that the team will have). Other than that, Name can be anything you want, and some of them self-explains.


Overview in AI Trigger Types:

The AI Triggers are not declared like the other things, but it has the most complicated codes. You can find info about it in Deezire's Guide and in the AI Trigger Types Tutorial in the TS Tutorials Forum.

The changes between TS and RA2 in AI trigger types are minimal.

There are two new types of trigger:

5 = Iron Curtain is near ready.
6 = Chronosphere is near ready.

And also, the way the use the countries and sides are different than how they used in Tiberian Sun. In Tiberian Sun, Westwood used <all> to represents the houses of all triggers, because each side had only one house. The sides in RA2:YR have more than one side (except YR), so if you wanna to have an exclusive country to build have that AI Trigger, you should put the internal name of that country instead of <all> in the country part. Also, Yuri uses the number "3" to represent its side.



The final example:

Considering the info above, here's an example where 5 of a custom unit known as BANSHEE will be used by france to attack all factories of the enemy. (By being an aircraft, it will not patrol)

; Note: I'm not gonna show it being declared.
;New Taskforce:

[NEWFORCE]
Name=5 Banshees
0=5,BANSHEE ; 5 Banshees will be built by this task force
Group=-1

Now for script... hmm.... let's get straight to the point.

[VSFACTORY]
Name=Hello mum, I'm modding... Ops, I mean, lets attack the factories.
0=0,1 ; attack enemy
1=0,6 ; attack factories

Now, for a new team type:

[BANSHEETEAM-G]
Name=5 Banshees will attack the enemy factories
VeteranLevel=1
MindControlDecision=0
Loadable=no
Full=no
Annoyance=no
GuardSlower=no
House=<none>
Recruiter=no
Autocreate=no
Prebuild=no
Reinforce=no
Droppod=no
Whiner=yes
LooseRecruit=no
Aggressive=no
Suicide=yes ; dont patrol...
Priority=5
Max=2
TechLevel=0
Group=-1
OnTransOnly=no
AvoidThreats=yes
IonImmune=no
TransportsReturnOnUnload=no
AreTeamMembersRecruitable=yes
IsBaseDefense=no
OnlyTargetHouseEnemy=yes
Script=VSFACTORY
TaskForce=NEWFORCE

;The AI Trigger Type

DASTRIKE=5 Banshess will destroy the factories,BANSHEETEAM-G,French,2,-1,<none>,0000000000000000000000000000000000000000000000000000000000000000,60.000000,60.000000,60.000000,1,0,1,0,<none>,1,1,1




Related Tutorials:

- Task Forces (For TS and RA2)
- Script Types (TS Only)
- Team Types (TS Only)
- AI Trigger Types (TS Only)

The "TS Only" tutorials shows several things that also works in RA2, but they doesnt show the options that came with Red Alert 2....