The AI Editor

The AI Editor is where you can create artificial intelligence that will command an army's development and attack strategies.
 

General

Name - Here you can name your AI.
Race - Select which race you would like to create an AI for. The custom race option allows the integration of custom units, abilities and upgrades. Remember to import the custom data.

Options

Set Player Name - Enable this option to set the in-game player name to the entered AI name.
Melee - Use a melee AI for standard melee games. Melee AIs tend to attack and defend more closely with allied players.
Target Heroes - With this option enabled, the AI will place a higher priority on attacking Heroes during battle.
Repair Structures - Enable this option to have workers automatically repair structures when needed.
Heroes Flee - With this option enabled, Heroes will attempt to flee from battle if they are seriously injured or unable to attack.
Units Flee - With this option enabled, non-Hero units will attempt to flee from battle if they are seriously injured or unable to attack.
Groups Flee - With this option enabled, attacking groups will attempt to retreat from battle if they are losing or at a disadvantage.
Have No Mercy - With this option enabled, the AI will watch for opportunities to attack when the enemy appears to be weakened or at a disadvantage. This attack corresponds with the Enemy - Major Assault attack priority.
Ignore Injured - Enable this option to ignore units with less than 50% life when assembling attack forces.
Remove Injured -Enable this option to periodically send injured units home (or to a fountain of life) to recover.
Take Items - With this option enabled, Heroes will attempt to pick up any useful items they encounter.
Slow Harvesting - With this option enabled, only 1 gold or wood will be harvested by workers instead of the normal amount. This gives the AI a slight economic handicap.
Allow Home Changes -This option allows the AI to potentially choose a new location as a home base for gathering and retreating forces.
Smart Artillery - With this option enabled, artillery units will attempt to come forward and mount a siege attack on an enemy base when possible.

Custom Data

Import - Import custom data exported from the Object Editor to include in your AI.
Export - Export custom data to examine someone else's custom AI data in the Object Editor.
Clear - Remove all custom data from your AI.

Conditions - Conditions can be configured here that are similar in form to the conditions in the Trigger Editor but are specialized for and only used with the AI Editor. Conditions created here can be used throughout the AI editor.

A helpful concept when creating AI conditions is that of the AI captain, of which there are two types, attack and defense. The captains are invisible units without collision that act as guides for the AI. The attack captain stays at the base structure (Town Hall, Great Hall, etc.), waiting for the attack wave to form. Once formed, the attack captain leads the attack wave to the current attack priority and then returns to the base. The defense captain stays in between the base and the first gold mine unless an attack on the base occurs. The defense captain then leads defense forces to attack the intruders.
 

Heroes

Heroes Used - Choose the Heroes you want the AI to train. Available Heroes are based on the race selected in the General tab.
Training Order - Modify each training order's chance it has to be run by the AI. Training order corresponds with the Heroes selected in Heroes Used.
Skill Selection - Modify the order in which the AI's Heroes will learn skills.
 

Building

Base Building - Select which unit will be used as the AI's base building. The options available here correspond to the race selected in the General tab.
Mine Building - Select which unit will be used as the AI's gold mining building. This is generally used for undead only, though other units with the Blighted Gold Mine Ability can be selected here.
Build Priorities - The AI's build, research and upgrade orders are specified here. When a unit dies, it will be replaced by the AI unless the AI has insufficient resources, or some condition prevents it. There are five columns here for build priorities:

Build - What will be built, researched or upgraded.
Total - Keeps track of the number of priorities of the same build type. The number without parentheses shows the total for all of the AI. The number inside the parentheses only shows the total at the town specified.
Food - Keeps track of the food used as well as the food cap. When a priority makes the food used go beyond the food cap, that priority will be red.
Town - Specifies where to process the build order.
Condition - If the condition specified here isn't met, the AI will skip this build priority and go to the next one. The condition can be one that was created under the General tab, or it can be custom-created for this priority only.

Gold Worker - Select which unit will be used as the AI's gold harvesting unit. The options available here correspond to the race selected in the General tab.
Lumber Worker - Select which unit will be used as the AI's lumber harvesting unit. The options available here correspond to the race selected in the General tab.
Harvest Priorities - The AI's harvest orders are specified here. There are four columns here for harvest priorities:

Harvest - Resource you want your worker to harvest.
Workers - Number of workers that share the same priority.
Town - Where the workers will harvest.
Condition - If the condition specified here isn't met, the AI will skip this harvest priority and go to the next one. The condition can be one that was created under the General tab, or it can be custom-created for this priority only.
 

Attacking
 

Attack Groups - The AI's attack groups are listed and created here.
Current Group - Attack groups get their definition here. There are three columns for each entry in the attack group.

Unit Type - The type of unit. The units available are determined by the race selected in the General tab.
Quantity - The number of units that match the particular unit type you have selected.
Condition - If the condition specified here isn't met, the current group won't include this entry. The condition can be one that was created under the General tab, or it can be custom-created for this priority only.

Attack Waves - The order of your attack waves are specified here. There are three columns for each entry in the attack group.

# - The wave number. This can be referenced in integer comparison conditions.
Attack Group - The name of the attack group that's assigned to the wave.
Delay - The amount of time before the next wave will start.

Minimum Forces - The minimum units necessary to send an attack wave.
Initial Delay - The amount of time before the first wave attacks.
Repeat Waves - How many waves, from the last wave, will repeat after the last wave has been sent.
Target Priorities - The targets for your attack waves. There are two columns here.

Target - Choose the AI's attack target. The targets higher on the list will be at a higher priority.
Conditions - If the condition specified here isn't met, the target will be skipped when assessing which target to attack. The condition can be one that was created under the General tab, or it can be custom-created for this priority only.
 

Test Configuration

This tab is used exclusively for AIs that you want to test using a melee map. For custom maps, import an exported AI file into your Import Manager and then use the Test Map command.

Games Speed - Modify the speed of the game when Test AI is used.
Game Options - Disable the Fog of War to allow for visibility of the whole map. Disable the Victory/Defeat conditions to avoid unnecessary interruptions.
Map File - Set map for the AI to be tested on.
Players - Individual player settings are set here. For each player there are the following options:

Control - Choose the controller of this slot.
Race - Choose the race played by the controller.
Team - Choose what team the controller is on.
Color - Choose the controller's team color.
Handicap - Choose the controller's handicap.
AI - If Computer is selected as the controller, choose the AI used.
AI Difficulty - If Computer is selected as the controller, choose the AI difficulty. The AI difficulty can be referenced in your AI conditions.
AI Script - If Computer is selected as the controller and Custom is selected for AI, an imported AI can be used for the slot.