5.8 AI Configuration - Setting Up

The following section assumes you have a map ready to go, with a pre-built enemy base.

Open the file strategic.cfg in your missions folder (make one if none exists). If the AI is JDA, add the following inclusions:


#include "base_JDA.cfg"
#include "base_JDA_orderers.cfg"
#include "base_JDA_plans.cfg"


If the AI will be Sprawl:
#include "base_sprawl.cfg"
#include "base_sprawl_orderers.cfg"
#include "base_sprawl_plans.cfg"


Also be sure your strategic.cfg has the line:
#include "strategic_scripts.cfg"

For each side, these files control the AI base building. These files can be found in data\packs\base\configs\ai\bases

You can edit these three files to fit a specific mission. Whichever files you decide to edit, copy them to your mission folder and then edit them (do not remove or edit the files in the ai\bases folder!). Any files in your mission folder automatically override any other files of the same name in the build. The file most commonly edited is the orderers.cfg for each side. This file specifies what types of units to build, and how many of those types to build. Often this file needs to be modified to fit a specific mission. In the orderers.cfg file, down near the bottom you'll see three sections - [side].unit.ships, [side].unit.vehicles, [side].unit.infantry. Edit these three sections to suit your mission if necessary. If you want to remove a unit from the build order, just erase the line that refers to it.

Next we need to tell the script that we have an AI base. This is typically done in the initial start objective for the AI team. The following would go in an Action scope


AddBase("[base name]", "JDA")
{
 Orientation(180);
}

AssignBaseConstructors("[base name]")
{
 Tag("[tag name]");
}

AssignBaseUnits("[base name]")
{
 Tag("[tag name]");
}

SetBombardierPreferences("Default");



(note, after adding the above, you will need to give the AI team a start location if you haven't done so already. The AI team normally doesn't need one, but when you add a base it uses the start loc as a point of reference)

The base name can be anything you wish. Where it says "JDA" would be "SPRAWL" if the AI team is sprawler. The tag designations are for categorizing your pre-placed units on the map, it tells the game which units should be considered part of the base and which shouldn't.

If you just have one AI base, put all buildings and units that should be a part of that base into one tag, and use that tag name for both the above [tag name]. If you have multiple AI bases, you would have another set of specifications just like the one above, in the same action scope, but designate the correct tags and name for the other base. Enemy units placed far away from the main base typically aren't included in the base tag, but can be.

SetBombardierPreferences sets how the AI will use it's airstrikes/mojo's. The possible values are:

Default
LowEnd
LowEndOnly
HighEnd
Nasty
Mines
Bombs
EMP
Rage
Eyebiters
Berzerk
Barons

Finally, you'll need to add one more .cfg file to your mission folder. Make a new text file and call it "recruit_types.cfg". Then, open your strategic.cfg file, and include it by adding the line:


#include "recruit_types.cfg"


Recruit_types.cfg is the file where you configure all your recruit types. A recruit type is a set group of units that can be referred to as often as needed from your main script. When your main script is recruiting units from the AI base to send them out to attack, it will be doing so by recruit types. Here's the standard format for configuring a recruit type. This goes in recruit_types.cfg, just as appears.
CreateRecruitType("[name]")
{
 Type("JDA.unit.rover", 1);
}


The above recruit type just contains one rover. So if an attack script called for this recruit type, it would just be sending out one rover. The number can be changed to anything, but it's a good idea to not have the number exceed the amount of the unit being built in the orderers config. The units are specified by type name (you can view the type name of all objects in the studio by clicking the "type names" button in the Objects menu). You can list as many unit types as you want in one recruit type, just add more lines. For example:
CreateRecruitType("[name]")
{
 Type("JDA.unit.siegeboat", 1);
 Type("JDA.unit.supportboat", 2);
 Type("JDA.unit.assaultboat", 4);
}