0) How to use the AI editor.
One of the things that immediately caught my attention in the new Frozen Throne editor was the addition of an AI editor - something sorely lacking in the Realm of Chaos version. While in the old days, mapmakers were stuck with using the basic AI, going to great lengths to write a "fake" trigger-based AI, or learning JASS (Blizzard's own scripting language), now it's possible to create your own specialized AI with nothing more than a few clicks of the mouse.
Still, there seem to be a lot of people daunted by the possibilities of the new AI editor, and there are a few pitfalls to be avoided. This is why I decided to write this tutorial.
The tutorial will be a step-by-step creation of a campaign-style map, complete with customized units, initialization triggers and even a quest to boot. It therefore ventures slightly out of the area of AI now and then, to place things in context, but it will not go too far into detail.
...
1) Setting Up
First of all, we'll need to get some basic stuff done. Our map will tell the epic story of Jaina's battle against the evil Ogre-Mage Dentarg. Fire up World Editor and load the "(4)DevilsCauldron.w3x" map (from the Frozen Throne directory). Go to the Scenario - Player Properties menu and set up the races. Player 2 (Blue) will be Jaina's player-controlled Human forces, while Player 1 (Red) will be the color of Dentarg's computer-controlled Orcs. Don't forget to go to the Forces tab and turn on "Use Custom Forces" and "Fixed Player Settings".

Now, delete the creeps at blue's start position and place some stuff for Jaina. A Keep, Barracks, Arcane Sanctum, a pair of Towers, an Altar and some Farms should be enough. Put in Jaina, a few Peasants and some troops and she should be ready to go.
Then, it's time to set up Dentarg. Go to the other side of the map (which used to be Green's starting position) and delete the creeps. Place a Great Hall, Barracks, two Burrows and an Altar. Also place a couple of Grunts and Peons.
Now it's time to create Jaina's adversary - Dentarg the Ogre Mage. Go to the Object Editor and select the Units tab. We'll base Dentarg on a Tauren Chieftain, so click on the Chieftain and create a new custom unit. Name it "Ogre Mage". For Hero Abilities, give him Animate Dead, Bash, Cleaving Attack and Endurance Aura. In addition, add Bloodlust (neutral) to his Normal Abilities. If you're good with spell editing, you can make Bloodlust a Hero ability instead, but this'll do just fine. Now, select the appropriate model (Stonemaul Magi, Ogre Magi) and icon, and fiddle a bit with size, coloring, sounds, etcetera. Finally, delete the long list of Proper Names and add "Dentarg". Our Ogre Mage should be ready for action!
With our hero finished, place him firmly in the center of the Orcish base.
All that remains is to fire things up with some triggerwork. Go to the Trigger Editor and edit the "Melee Initialization" trigger. Remove the following actions:
- create starting units for all players
- run melee AI for all computer players (we want to use our own AI)
And add the following:
- make Player 1 treat Neutral Hostile as Neutral without shared vision
- make Neutral Hostile treat Player 1 as Neutral without shared vision
We'll need to add one new trigger, to make sure Dentarg never runs out of cash:
Events
- player 1's gold becomes less than 500
- player 1's lumber becomes less than 500
Conditions
- none
Actions
- add 1000 to player 1's lumber
- add 1000 to player 1's gold
And this is all the work that needs to be done in the trigger editor! All the rest can be managed via the AI editor.
2) Settings
Now that we've got the basic stuff set up, it's time to get to the gritty bits - the actual AI editing. Open up the AI editor and take a look at the first tab: the General settings.
First we've gotta choose which race the AI will be for. The possible choices are the four basic races or a completely customized race. Since we're only interested in Orcs vs Humans, without fancy custom races, we can safely select Orcs as our race and move on.
Below, there's some room to enable or disable some basic attributes of the AI. Information about each checkbox is displayed in handy tooltips that you can view by hovering your mouse over the short description. Our AI will be of the type that neatly follows attack patterns and sends wave after wave of baddies into your base. No fancy stuff like fleeing will be used. Here's a list of the options for Dentarg's AI:

Once you've selected the appropriate settings, it's time to move on to the next tab.
3) Heroes
This tab displays three Orcish heroes, and a bunch of possible build orders for those heroes. It all looks very interesting, but won't do at all.
We have one hero and one hero only, and that's Dentarg.
If you click on one of the Heroes Used, you'll see a drop-down box with the four Orcish Heroes in it. Dentarg is nowhere to be found. This is because the AI hasn't been coupled to this specific map yet - it's still a generic AI that can be used in any map.
To couple the AI to the map, go to the file menu and select "Add to Map". This will attach the AI to the map. You can see the files in the Import Manager. When it comes to saving, loading, and adding, the AI Editor behaves a bit quirky. More on this in chapter 8. *note: chapter not written yet :) basically you need to be very careful with saving and attaching, since it sometimes seems to de-attach the map again. What I did was use the import editor to completely delete the AI stuff, then select 'attach to map' in the AI editor again and then edit the trigger that runs the AI. After all this I save the map, without using the shortcut (can't remember what it was exactly, but there's something abuggy about the save shortcut)*
Now click on a hero again. You should notice a new entry in the combobox, namely "Ogre Mage". Select this. Set the other heroes to "none", Dentarg doesn't need any help. The AI editor will automatically change the chance of Dentarg being Primary Hero (which should be 100%). You'll also notice that the skill-chooser is automatically set up with Dentarg's skills where you can define the order in which he learns new skills as he levels up.

Fiddle around with his skills until you are satisfied, and switch to the next tab: Building
4) Build Order
In this section you can specifically define the build order for the AI. The computer will follow this list step-by-step, and very strictly at that. Before it starts building something from the list, it checks if it has (or is producing) everything that proceeds it in the list - so make sure to put stuff in the right order here.
The editor gives us the first six items in advance: a Town Hall and five peasants. Seems reasonable. Next thing to build is a Burrow. We can add the Burrow by simply clicking on "add priority" and selecting the Burrow from the list. Notice how the food total increases, so we can easily check if we need additional Burrows. Here are the priorities for all the stuff we already gave the computer:
1) Great Hall
2) Peon
3) Peon
4) Peon
5) Peon
6) Peon
7) Burrow
8) Barracks
9) Altar
10) Peon
11) Primary Hero
12) Orc Grunt
13) Orc Burrow
14) Peon
15) Peon
16) Orc Grunt

If we keep the build order like this, the PC will not build anything new, but replace any building that is destroyed in-game.
The 11th priority: Primary Hero, is special. Instead of selecting an Ogre Mage from the units list, click on the dropdown combobox right above the unit list. Here you can select Hero - Primary. The difference between Primary Hero and Ogre Mage is that Primary Hero will keep reviving the same Hero while Ogre Mage will just build a completely new one.

Of course we'll need it to build more stuff so we can throw attacks at the player. Fill the list up with some additional units (try to stick to Grunts, Headhunters and Raiders) and the necessary buildings, but take care not to do anything impossible (like trying to build a Beastiary without first upgrading to a Keep).
Since we're artificially providing the AI with heaps of money, the only delaying factor in how fast he builds his units is the number of barracks he has. You can also use special Conditions to impose some limits. We'll handle those later.
First, let's take a look at sending attack waves.
5) Attacking
The fourth tab in the series might look kind of complex, but is essentially very easy to use.
First off, in the top left under Attack Groups, are the various names of the attack groups. Right now there's "All Units" which does exactly what it says: attack with everything. Delete this ludicracy immediately! Now to add some more structured attack waves. Hit "add group" to create a new group. Select it and go to the field to the right.
Here you can change the attack group's name (call it "Dentarg plus two") and specify which units are in the selected attack wave. Add a unit, select "Hero - First". For Quantity, use "Fixed Amount" to determine how many there should be. Fill in: "1". One Dentarg is enough. Do the same for Grunts, but make those "2". Conditions can be used here to make stuff more complicated if you like.
Now we've got an attack group ready to send to battle. Use the method above to make a few other attack groups to use in the attack sequence.

Now let's move down to the Attack Waves. Simply add your predefined groups one by one, in the order in which they should attack, using the Add Wave button. Make sure to give the player some time to recuperate after each attack by filling in the Delay field. This typically varies between 30 seconds and a couple of minutes; playtesting should determine what works best for you.
The other values here: "time until first wave", "minimum forces" and "repeat wave" are pretty obvious. The first one indicates how long the AI should wait before initiating the first attack. The second one specifies the minimum amount of stuff the AI should have before attacking and the final one determines to which wave the schema should loop after completing the last one. A zero here means the AI will simply stop attacking. *note: actually, I'm not sure about this.. haven't tested it yet*
Finally, we move to the Target Priorities. There's a bunch of them listed here such as creep camps and common alliance targets and whatnot. Delete all of them - our AI is very basic. Hit Add Priority and add "Enemy - Any Town". That should be enough.
At this point you should have a complete AI in place. However, getting it to run properly can be slightly difficult.
First of all, there is a final tab labeled Test Configuration. We can safely ignore this one, since we're making a custom map. This tab is only useful for melee AI's, or to quote the AI editor:

6) Told you this tutorial wasn't finished. You'll have to figure out the rest by yourself.