To begin, you'll of course need to have 3 or more factions done. See this tutorial for instructions:
http://www.ppmsite.com/forum/viewtopic.php?t=18889
Next, use this trick to allow the AI to start a match as 3rd, 4th, etc factions:
http://www.ppmsite.com/forum/viewtopic.php?t=16736
Now that that's out of the way, go to [Houses] in rules.ini. You'll need to add a new faction for the AI. In my case:
Code:
[Houses]
0=GDI
1=Nod
2=ForgAI ; This is for the AI only
3=Forg
4=Neutral
5=Special
Note that its important the faction is placed after GDI and Nod. If you wanted a 4th faction playable by the AI, you'd add it after ForgAI. Right below you'll see the [Sides] list. Again, add ForgAI after GDI and Nod.
Code:
[Sides]
GDI=GDI
Nod=Nod
ForgAI=ForgAI
Forg=Forg
Civilian=Neutral
Mutant=Special
Move on to the Country Statistics and add ForgAI there (just search for [GDI]):
Code:
[ForgAI]
Name=Do not choose me!
Suffix=FRA
Prefix=A
Color=DarkBlue
Multiplay=yes
Side=ForgAI
SmartAI=no ; Haven't tested enough to tell if this should be yes or no.
Next, go to the MCV unit entry. You'll have to use a faction shared MCV vehicle as the AI does not understand more than 1 MCV / construction yard. In my case GDI and Nod use the default MCV, while my own faction has a seperate one. You need to edit the GDI / Nod MCV as shown below:
Code:
[MCV]
...
Owner=GDI,Nod,ForgAI,Special
...
Same thing for the default construction yard:
Code:
[GACNST]
...
Owner=GDI,Nod,ForgAI,Special
...
Now it gets bit trickier. You'll need to "hijack" one of the default shared prerequisite settings. Look for this bit in rules.ini:
Code:
; Building prerequisite categories are specified here.
PrerequisitePower=CACSITE,FAKEY ;GAPOWR,NAPOWR,NAAPWR ; Took over this one. CACSITE is my 3rd faction's con.yard. Fakey will be explained later.
PrerequisiteFactory=GAWEAP,NAWEAP
PrerequisiteBarracks=NAHAND,GAPILE
PrerequisiteRadar=GARADR,NARADR
PrerequisiteTech=GATECH,NATECH
In my case the power prerequisite had become obsolete, since in my mod GDI and Nod have seperate refineries, and refinery used to be the only building with POWER as prerequisite. If POWER doesn't work for you, you'll have to find a way to free one of the other shared prerequisites.
Now, go to your 3rd faction's buildings and add this to all of them:
Code:
Prerequisite=POWER
Rest of the prerequisites for specific buildings will of course be listed after this one. But make sure at least one building (probably the power plant) has ONLY this prerequisite. Make sure all your 3rd faction buildings have AIBuildThis=yes set to them, except the construction yard. So in my case every building except CACSITE has it. If you give AIBuildThis=yes to the 3rd faction's construction yard the AI will get the cloning bug, so it's not a good idea.
EDIT: You also need to add the correct ownership to all 3rd faction buildings:
Code:
Owner=Forg,ForgAI,Special
The 3rd faction construction yard is the exception (CACSITE in my case), it needs to have:
Code:
Owner=Forg,Special
Next we need to define FAKEY to give the AI access to the 3rd factions buildings (since he never builds CACSITE):
Code:
[FAKEY]
Name=IM_NOT_HERE! ; Shouldn't be able to see this anyway
Image=INVISO ; I'm not sure this works for buildings... anyway, use an empty shp here.
BuildLimit=0 ; Disables it from human players
Owner=ForgAI,Special ; Notice the owners!!!
AIBuildThis=yes ; Yes, yes, yes!
Nominal=yes ; Rest of these keys simply make this fake building invisible and blow it up when the AI dies
Strength=10000
Cost=1
;Prerequisite=
Armor=wood
TechLevel=1
Adjacent=12
Sight=0
Invisible=yes
InvisibleInGame=yes
RadarInvisible=yes
Insignificant=yes
BaseNormal=no
IsBase=no
Immune=yes
LegalTarget=no
Selectable=no
Repairable=false
Capturable=false
TogglePower=no
Powered=false
Power=0
Crewed=no
Points=1
Explosion=
MaxDebris=0
DamageParticleSystems=
ThreatPosed=0
Finally, go under [AI] and add your side's structures to the list correctly:
Code:
BuildConst=GACNST ; Only accepts 1 value
BuildPower=NAPOWR,GAPOWR,NAAPWR,YOURPOWER
BuildRefinery=PROC ; I don't recommend more than 1 value, it can cause some SERIOUS bugs. Create extra AI only refineries instead.
BuildBarracks=NAHAND,GAPILE,YOURBARRACKS
BuildTech=NATECH,GATECH,YOURTECH
BuildWeapons=GAWEAP,NAWEAP,YOURWEAP
BuildDefense=NAOBEL,YOURDEFENCES
BuildPDefense=NAOBEL,YOURDEFENCES
BuildAA=NASAM,YOURDEFENCES_AA
BuildHelipad=GAHPAD,NAHPAD,YOURHELIPAD
BuildRadar=GARADR,NARADR,YOURRADAR
The AI will now start a match with the shared MCV, move on to construct this FAKEY building, and then gain access to all the 3rd faction structures and units. This method will not mess up sidebar building / unit lists for GDI, Nod or for any other extra factions. However there are few quirks:
1. You have to use up one of the shared Prerequisites as mentioned earlier
2. One extra faction will show up in the side selection box. This can't be exploited though, if you choose to play as ForgAI you'll start with an MCV. But once you deploy it you won't be able to build anything. So choosing the fake side really makes no sense.
3. The AI controlled 3rd faction has to use the default MCV / construction yard. I already tried and the AI does not build anything if he doesn't have the first building listed in BuildConst=. The human controlled 3rd faction can (and must) use a custom MCV / construction yard.
4. For some reason the AI will build some basic nod power plants and some of the 3rd factions power plants, even if you list the new factions power plants in BuildPower=. This might be fixable but I haven't found a way yet.
You can now make the AI build your 3rd factions units like you would with GDI and Nod AI. Just remember to set the owner of the TeamType to your 3rd faction, eg. House=ForgAI. In the AITriggerTypes you'll need to use 3 as the new faction indentifier. An example (the highlighted number needs to be 3):
Code:
08594AB0-G=H_Forg tank attack,07EB8E90-G,<all>,6,-1,<none>,0000000000000000000000000000000000000000000000000000000000000000,40.000000,10.000000,70.000000,1,0,[b]3[/b],0,<none>,0,0,1
Here's some pics of my tests with the AI.
Extra faction shown in the selection box

Forgotten AI base #1

Forgotten AI base #2
