Tutorial to guide new users with the basics

Get to know AMAI.
If you downloaded this software and read this far you already know that AMAI is a sophisticated version of the ordinary AI found in warcraft 3, so let us get on to the instructions on how to work with AMAI to make it operate with it's full potential.
Everything you need to do to make AMAI do your bidding is to setup some goals and settings. There are several different setting levels, like strategy specific setting, race specific settings and global settings that are applied no matter what race and strategy AMAI uses.
The goals are what AMAI does. The build sequence that every strategy consists of is simply a list of the goals, where you tell AMAI what to do, how many to make and how important it is that it is done. There isn't much more to be said here, since you don't need to know much about AMAIs functions to make it work. Just follow the instruction steps for the different activities in the following sections and you will understand how easy this really is.


Making a profile.
If you used AMAI before you probably noticed that when the game is ongoing and at the end screens all computers get names instead of 'Computer(Normal)'. The meaning of this is to personalize the computers better and giving them an individual feel.
Some might think the names are only names but that is not the case. Behind every name is some unique settings, the 'profile settings'. These are different for every profile and give them a personality. For example the computer named '[AMAI]Aggressario' is a aggressive computer that dares to attack stronger foes and he also got some other properties like switching strategy more often and expand early.
Currently AMAI has got 26 different profiles but got room for some more if you want to add a personal one to the list so it got a chance of getting randomly picked by one of the computers in the game. Or maybe you want to remove or edit the current profiles to get an own list of profiles that you can keep to use with all future versions of AMAI.
You will also be able to upload your own profiles and download other profiles from a database on internet, read more about this in the strategy exchange section.

Before playing around with AMAI profiles there is one limit you need to keep in mind:
There have to be at least 11 different profiles since AMAI pick a unique profile for every computer in the game, there will be trouble if a game is started and there are more computers than names on the profile list.

Lets get started. I will be making a new profile named 'Willy' and in detail describe every step I take to do so.

Make sure you installed Perl as instructed in the requirements section and after this you can run the strategy manager in AMAI directory 'AMAIStrategyManager.pl'.

Now press the "profiles" tab to get to the list of profiles that is currently installed in AMAI. Make a new profile by pressing the button 'New' to the right and select the profile "New_Profile" that should have appeared at the bottom of the list.

After this we want to customize this profile and give it a name. To do so we need to open it in the profile editor. Hit the button 'Edit' to the right to bring forth this editor with "New_Profile" selected.
The editor should now appear. We start by giving our new computer player the name of "Willy".

Race
Change this to a desired race available to make this profile only be picked if computer is a certain race. This is left at Random by Default.

Aggression recommended: -10 to 10
This is usually a value between -10 and 10. A higher number means more aggressive while a lower means less aggressive. By many tests I have found out that computers work best if they are less agressive but that might have changed due to recent changes in the features. It's hard to know. However to be on the safe side I fill in -6 for Willy meaning he will only dare to attack a opponent if the opponents force is 6 strengthpoints smaller than his own force.

Uncertainty recommended: 5 to 15
This is one of the things we have to decrease the amount of cheating in the AI. This is how false the information about the enemies strength can be. For example 6 means this computer will get the strength of the enemy force +-6 points or less of the actual strength value.
First you might think you do the computer a big favor by setting this to 0 but thats actually wrong. In many cases it's good that the uncertainty makes the computer attack a stronger opponent that might not be home to defend his own base at the moment and just because this computer was lucky he then wins instead of sitting at home knowing that the enemy force is stronger and therefor not dare to attack.
I set this to 5 for Willy so he still knows the enemy pretty accurate.

Minimum Attack Strength recommended: 6 to 9
This is a number for how strong this computers army must be before it dares to leave the base to attack the enemy or do some creeping, for example a hero and a footman is 5+4 strength points(almost double the food value for units with exception of heroes) this mean if this computer got a 6 here it will not attack until it got both the hero and at least 1 military unit completed.
I give Willy a 8 here so he doesn't try to leave base and get his units killed becuse he used a too small force.

Build Farm at left food recommended: 6 to 12
This setting tells how much free food there can be left before it is ordered to build another farm or whatever building it has that produces more food.
Willy gets 8 here meaning that when his food use is 8 less than his total food capacity he builds another farm.

First expansion time recommended: -10 to 10
A small influence on this computers expansion time, it's counted in units of 5 seconds meaning that a 5 will allow Willy expand 25 seconds later than usual or -5 will allow Willy to expand 25 seconds earlier than normal.(5*5=25)
Willy gets a 6 here.(allowing him to expand 30 seconds later than usual)
The base expansion time is depending on what strategy is used since it differs from different strategies. Look it up in the strategy making part of this manual.

Second expansion time recommended: -20 to 20
Same as the first but it's the influence for when this computer is allowed to make a second expansion. Remember that for both of these cases it doesn't mean that a computer 'will' make a expansion exactly when this time has passed, it will only be allowed to make a expansion. The computer can find out on it's own if it's in need of an expansion.
Willy gets -10 here. (allowing Willy to make second expansion 50 seconds earlier than normal)

Strategy Persistence recommended: 500 to 1500
this is how much the computer wants to keep using the current strategy. This mean that a lower value here will make the computer change strategy more often and therefor react faster on what the enemy does and counter it. But changing strategy more often isn't only good for the computer since it will ruin all it's current plans. For example a Orc computer might be using a strategy that builds grunts so it starts by building a barrack and just before the barrack is completed it discovers that the enemy got lots of ground attack units and decides to use a mass wyvern strategy instead. Now the barrack was built in vain. Such things are avoided by using a higher strategy persistance.
I give Willy a good average number of 900 here so he won't change strategy too often.

Influences number of factories built recommended: 0.9 to 1.0
This value is a part used in the computer's formula for calculating if they got enough income to be able to make use of extra buildings for faster unit production. The higher this value, the more unit production buildings of a type are built. As an example a human computer uses a strategy that builds lots of riflemen from one barrack. After this computer completes an expansion and starts to gain gold faster it might consider building another barrack to spend the higher income on producing riflemen much faster. Depending on this value it might do that or not.
Willy gets the good average number 0.9 here.

Taunt rate recommended: 0 to 2
This is how often this computer will display a taunt message. For now all profile got the value 1 becuse it has prooven to be a good avrage value. Every 5th second of game time the function that decides if a computer is going to taunt is executed, when that hapens it's the chanse of this value in % if the computer shall display a taunt chat message. '1' says that the computer will display a chat messege every 5th second 1% of the time. For Willy I enter 0.5 here since I don't want him to talk very often.

Expansion target bonus recommended: 0 to 20
This is an added aggression bonus if an enemy expansion is targeted for attack. Meaning that the higher this value is the more often will the computer dare to attack an enemy expansion.
Willy gets 8 here.

Hard coded AI target bonus recommended: 0 to 20
Same as the expansion target bonus but this is aggression added for targets selected by the hard coded AI made by Blizzard. These targets will most of the time be enemy expansions or backstabbing enemy forces that currently engage larger creeps nearby.
Willy gets 6 here.

Hard coded AI target rate recommended: 0.3 to 0.8
This is how often AMAI lets the hardcoded AI choose target instead of AMAI itself. A higher number closer to 1 means that the computer will attack expansions and backstab enemy forces more often while closer to 0 will make the computer creep more and attack enemy bases if enemy force is weak. Willy gets 0.5 making it a 50% chance that AMAI or hard coded AI choose a target.

Surrender Value recommended: 0 to 4
This is how forceful a profile will keep fighting. A higher number makes computer give up more easily while a lower value will make it almost impossible for that profile to give up in a fight. A value of 0 is the default blizzard setting which defeats only when every single unit is destroyed.


Favorite hero
This effects in a small way what hero Willy will use the most for every race. For example if 'ARCHMAGE' is Willys favorite hero for Human he will more likely be using that hero. There is even a small chance that he will pick the Archmage hero even if the strategy used has no priority at all for that hero.
Just go ahead and give Willy a favorite hero of your choice for every race.

Favorite unit
Like the favorite hero this effects how Willy plays in a small way but probably in a larger way than the favorite hero since it has influence on what strategies Willy is going to use when playing. For example if Willy's favorite Night Elf unit is 'HUNTRESS' he will most likely use strategies that orders him to build lots of huntresses. Of course he will still switch to a strategy that better counters what the enemy got if huntress don't work but he rather sticks to huntress most of time since it's his favorite unit.


Willy should now look something like this.

After filling in all the settings for Willy I can now save this profile by hitting the ok button. Willy is created,but before you can play with or against Willy you will have to compile AMAI then install it to the maps you want to play. There is always a chance that Willy will be one of the computers in the game and that computer will have the peronality you just created.

As I said you must compile AMAI and since you probably not know how to do that yet that will be what you will learn in the next section of this manual.

Compiling your AMAI.
This is very simple if you still got the strategy manager open. You just need to hit the 'Compile' button to the left and there will be a progress report in the perl window that you probably already got minimized so after you hit the button bring it up.

USEFUL TIP -- Clicking "compile, Optimize" will make your compiled files smaller and more effecient.

Now the compiler will make the 5 .ai files for the TFT version of AMAI. After the 5 files has been compiled the DOS window will ask you to press a button to continue so just press a button. after this we can now just run the installer AMAI.exe to install the newely compiled AMAI to a map of your choice and start playing with the changes you just have made.

Another method is to just navigate to the scripts folder, select TFT and run the simple edition .bat file there. This includes your updated profile but allows you to play on any map without having to install first.

Making a strategy.
AMAI has already got about 8 different strategies for every race but theoritically it should support an unlimited amount of different strategies. We start this section by starting the perl program 'AMAIStrategyManager.pl' that will bring you this menu.

What you currently see here as the left buttons indicate is all strategies for NightElf in the TFT version of AMAI.
With this strategy manager you will be able to exchange strategies with other users of AMAI by using the Insert and Extract buttons. From here you also find the editor. We start to learn how to make strategies by looking at an existing strategy. Start with selecting the human race instead by pressing the left button that now indicates 'ELF', after this the list has changed to display the human strategies. Now press the strategy named 'Rifle'.

Now press the right button 'Edit' that will open the editor with this strategy.

Strategy Function Name
This is the working name of the strategy that will be used by the program files.

Default Name
This is the name the strategy is known by in game unless there is another language version of this name in the translation tables.

Default Report
This is what a computer says when it's starting to use this strategy unless there is another translation for this matching the used language when playing.

key_building1
This is the main building used by this strategy for unit prodution and most other needs. It is used for identifying this strategy as a better choice for a computer that needs to build something that counters the enemy forces that might got alternative solutions. For example a computer that has one workshop and one barrack might consider both mass flying machines and mass riflemen as good choices to counter an enemy air force, but if the computer instead has 2 barracks and no workshop the choice will more clearly point to this strategy since it already got one of the buildings mainly needed to create riflemen.

key_building2
This is used to define a second key building that will enforce the priority for this strategy in the same way as key_building1. Should be the second most used building for this strategy.

key_upgrade1
In same way as for key buildings this is the upgrade mostly used for this strategy. The higher level this upgrade is the more the computer already got of what is to be built in this strategy. This makes the strategy look like a 'best choice' if a computer is in need of the other properties for this strategy.

key_upgrade2
Same as for key upgrade 1 but this is the second most used upgrade.

key_unit
This is the unit most used by this strategy and is used in a similiar way as key building and upgrade. The more units of this kind the computer got the more good looking is the strategies having this unit as key unit next time the computer is about to change strategy.

beginning_strat
Set this to true if this strategy is allowed to be used as a starting strategy at the beginning of a game. Set this to false if your strategy is more meant to be enhancing an already established strategy and has no good goals for tier 1.

strat_minimum_time recommended: 20 to 50
This is how long time this strategy will be used as a minimum before a new strategy change is allowed. This usually is set to an estimated time it takes for this strategy to establish itself, therefor this time is only true for tier 1. If this strategy is selected in tier 2 this time will only be 2/3 of whats entered here, if it's in tier 3 it will be only 1/3 of this time.

strategy_type
The major function of the strategy. Here are four options: ranged, melee, air and casters. The use is that allied computers will try to choose strategies of different aspects instead of going both melee for example.

Main strategy tier recommended: 1 to 3
This is in what tier this strategy operates best. For example a mass footmen strategy works best early(tier 1) in the game while a mass knight strategy works best later in the game(tier 3).

base rp recommended: 20 to 30
This is the starting priority for this strategy. The higher this value is the more likely it is that the computers are going to use this strategy no matter what.

ally bonus recommended: -18 to 18
If your strategy is good for team play you can enter a priority boost this strategy shall get if the computer selecting strategy has allied players. (it is a team game)

1on1 bonus recommended: -18 to 18
If your strategy is good for 1on1 games you can enter a positive value here.

FFA bonus recommended: -18 to 18
If the strategy fits well for FFA it really need some extra priority here, like 9 or 18.

Race bonus recommended: -18 to 18
The following 9 settings is to give this strategy positive or negative priority boosts depending on what race enemy and allied players are.
Random enemy bonus is the bonus priority this strategy gets if an enemy is random race. The following settings explain themselves good enough. Human enemy bonus is priority added if an enemy is human and so on. The last 4 settings are depending on what race any allied player might be, for example orc ally bonus is priority added if a player is orc and is allied with the computer.

Strength bonus recommended: -10 to 10
The next 11 settings are priorities on different things this strategy is good or bad to go against. For example anti air strength should be a pretty high positive value for this riflemen strategy since it's one of the best human strategies to counter enemy air units. It's also a strategy using piercing attack meaning that it's pretty good at countering any units with light or unarmored armor so it should also have positives on anti unarmored strength and anti light armor strength.
However this strategy also has down sides such as riflemen having medium armor making them very bad vs melee attackers using normal attack. This makes the riflemen strategy get a negative value on anti normal strength.

Anti air strength - How good this strategy is against enemy air units.
Anti caster strength - How good this strategy is against enemy support units.
Anti tower strength - How good this strategy is against enemy defensive buildings.
Anti piercing strength - How good this strategy is against enemy piercing attack units.
Anti normal streangth - How good this strategy is against enemy normal attack units.
Anti siege strength - How good this strategy is against enemy siege attack units.
Anti magic strength - How good this strategy is against enemy magic attack units.
Anti unarmored strength - How good this strategy is against unarmored enemy units.
Anti light armor strength - How good this strategy is against enemy light armor units.
Anti medium armor strength - How good this strategy is against enemy medium armor units.
Anti heavy armor strength - How good this strategy is against enemy heavy armor units.

Expansion time recommended: 30 to 90
The time a computer using this has to wait before it is allowed to build the first expansion. The value is in units of 5 seconds meaning that 80 tells the computer to not expand until a gametime of 80*5 seconds has passed.
The computer will not build an expansion exactly after this time has passed. It will only be allowed to build one, it will know by itself if it needs an expansion yet.

Second expansion time recommended: 100 to 200
The time a computer using this has to wait before it's allowed to build the second expansion. The value is in units of 5 seconds meaning that 80 tells the computer to not expand until a gametime of 80*5 seconds has passed.
Both these values are influenced in a small way by what profile is being used as well.

First hero bonus
If you want a certain hero to be used more often as first hero with this strategy it should be selected here. Note though that that will only have an influence if this strategy is chosen as starting strategy.

First hero bonus amount recommended: 10 to 30
How high priority boost you want to give this hero as first hero. If you want to enforce a certain hero, use a very high value.

Second hero bonus
This is the same as the previous 2 settings but for second hero.

Second hero bonus amount recommended: 10 to 30
Priority boost for the selected hero to be used as second hero.

Aggression bonus recommended: -10 to 10
The following 12 settings sets how aggressive the computer using this strategy should be in different cases.
enemy_elf add agg - Changed aggression vs enemy night elf players in tier 1, 2 and 3.
enemy_human add agg - Changed aggression vs enemy human players in tier 1, 2 and 3.
enemy_orc add agg - Changed aggression vs enemy orc players in tier 1, 2 and 3.
enemy_undead add agg - Changed aggression vs enemy undead players in tier 1, 2 and 3.

You probably wonder why most of these settings are unused for the current strategies and thats becuse we don't know what values should be here to give best result. If you feel the same for any settings you should leave them blank or ask a good player for assistance on how the strategy should be played in different cases. If you just fill in random settings the results can be worse than just blank values. Blank here does not mean leaving the fields empty but putting a 0 in the fields.


That were all settings for strategies, now lets try to learn the most advanced part of this editor, the coding of build goals.
This is about the 4 textfields to the left in the editor. The top area is for strategy initalisation code and the other three are for different tiers.

Initalisation code
This part is seldomly used but it can be used for some strategies if you want to make a really optimized build order at the start of the game like in this case for riflemen or if you want to define some harass groups for the computer using this strategy.
Harassing is a new features in AMAI 2.0 and might not be as good as real harassing but it's good enough for annoying opponents.
But first lets take a look at what we currently see in this text field and take up what it is.

ADD BLOCK STATEMENTS

call AddBlock(1, BLACKSMITH, false, 1, HOUSE, 60)
call AddBlock(1, BLACKSMITH, false, 9, PEASANT, 60)

Both lines have the same function "AddBlock" this can be used to prevent the computer from doing something before it has done something else or before a certain time has passed. In this case the first line tells this computer that it should not build more than 1 human farm (1, HOUSE,) unless it has already started to build at least 1 blacksmith(1, BLACKSMITH, false,) or if 60*5 seconds have passed since game start.(60)
The second AddBlock call tells this computer that it should not build more than 9 workers(9, PEASANT,) unless it has started to build a blacksmith(1, BLACKSMITH, false,) or 60*5 seconds have passed.(60)
If you are not very familiar with coding this might look confusing but this is how the parameters work:

call AddBlock([How many must it build or start to build], [What must it have built or started to build], [Should the first value count started to build(false) or completed build(true)], [How many is it allowed to build before it has to obey the condition stated in the 3 first parameters],[What is it it is allowed to build this many of at a maximum], [How many game seconds *5 shall pass before this block is turned off])

For example I can show this completely different block:

call AddBlock(1, HUMAN_ALTAR, true, 0, ARCANE_VAULT, 36)

This block prevents the human computer from starting to build any shop( 0, ARCANE_VAULT,) unless at least 1 altar has been completed(1, HUMAN_ALTAR, true,) or 180 game seconds have passed(36).
This block is in global strategy initalisation unreachable from this editor but it's there to prevent any computer from building the shop too early.

HARRASS GROUP

call AddHarass(2, 2, RIFLEMAN)
set distraction_group = 2

As you can see much more simple than a block. This adds 2 Riflemen(2, RIFLEMAN) to harass group 2(2).

Now with this harrass group we can do multiple tasks with it. Here the harass group has been stated as a distraction group. ( = 2) This means when the computer has at least 6 riflemen the computer will use 2 of them to do a distraction attack. This is sort of a attack to distract the enemy from the main attack the computer is doing.

There are also other types of harrass commands that can be used.

call Harass(1, HARASS_TARGET_PEONS, true, 5, 0.25, 0, true, 50, 80)

This will make the human computer using this strategy to send harass group 1(1) to attack enemy workers(HARASS_TARGET_PEONS) but it will avoid towers(true). It will flee back if it encounters enemy units of a strength that is at least 5(5) and will abort the harass and move home again if they have less than 25% HP left(0.25) or there is only 0 units left alive in the harass group(0). It will repeat this harass every 50*5 seconds(50) but not make the first harass attempt until 80*5 seconds have passed(80).

Other harass targets:
HARASS_TARGET_PEONS - Enemy workers
HARASS_TARGET_EXPANSION - Enemy expansion
HARASS_TARGET_MAIN_HALL - Enemy main hall

Code for Tier 1
Now we are finaly getting somewhere. Here is the actual build sequence of AMAI and in this box every line represents a goal AMAI will try to accomplish as long as it is in tier1. This code is usually much more simple than the blocks and harass code.
We start by looking at one of the present lines here:

call BuildUnit(10, RIFLEMAN, 48 )

The "BuildUnit" function is used to make the computer build units or buildings while the "BuildUpgr" function is for making upgrades. This specific line in "Code for Tier 1" tells this computer to build 10 riflemen(10, RIFLEMAN,) with a priority of 48(48) you might think at first. But this is not entirely true.
Because everytime you order a AMAI to build multiple units they will get a priority(48) boost of the unit amount(10 - 1) *2. This means that the first rifleman will be ordered with a priority of 48 + (9 * 2), which is 66. But since for every rifleman built there is one less rifleman ordered the priority will be 2 lower for every rifleman. This mean that the final 10th rifleman will be built with the priority of 48 that is the actual priority given in the function call.
Now you might wonder what's the reason for this. So thats what Im going to explain here.
In the old standard ways of making build orders for warcraft3 AI the same order would have been given without the priority like this:

call SetBuildUnit(10, RIFLEMAN)

But usualy you want the computer to build more than just riflmen. So we add some footmen as well like this:

call SetBuildUnit(10, RIFLEMAN)
call SetBuildUnit(10, FOOTMAN)

Now what do you think this computer does?, well if you got some experience with normal war3 AI you know that it will first build 10 riflemen then it will build 10 footmen. But if you want it to build both riflemen and footmen parallelly then in the old ways of war3 AI you will have to do like this:

call SetBuildUnit(1, RIFLEMAN)
call SetBuildUnit(1, FOOTMAN)
call SetBuildUnit(2, RIFLEMAN)
call SetBuildUnit(2, FOOTMAN)
call SetBuildUnit(3, RIFLEMAN)
call SetBuildUnit(3, FOOTMAN)
call SetBuildUnit(4, RIFLEMAN)
call SetBuildUnit(4, FOOTMAN)
call SetBuildUnit(5, RIFLEMAN)
call SetBuildUnit(5, FOOTMAN)
call SetBuildUnit(6, RIFLEMAN)
call SetBuildUnit(6, FOOTMAN)
call SetBuildUnit(7, RIFLEMAN)
call SetBuildUnit(7, FOOTMAN)
call SetBuildUnit(8, RIFLEMAN)
call SetBuildUnit(8, FOOTMAN) etc.......

As you can see it's a whole bunch of code.
Now behold the new and improved AMAI way to do this:

call BuildUnit(10, RIFLEMAN, 50)
call BuildUnit(10, FOOTMAN, 50)

Yes these 2 lines give exactly the same result as the 20 rows above thanks to that amount of additional units * 2 priority add. it simply works like this since the first rifleman got a priority of 68(50 + (10-1)*2) as I previosuly explained. as well got the first footman a priority of 68 since there is also 10 footman ordered. but since the riflemen are first the first unit built is the rifleman, then after the rifleman is built the next rifleman gets same priority -2 while the first footman still hasn't been built so it still got its priority of 68 and will be built after the rifleman. after this the computer got 1 rifleman and 1 footman and it has 9 rifleman and 9 footman more to build both now at a priority of 66.
So it's all over again, first it builds another rifleman since it's above the footman in the code and got exactly the same priority. then another footman again. So the result now looks like this in the old code style:

call SetBuildUnit(1, RIFLEMAN)
call SetBuildUnit(1, FOOTMAN)
call SetBuildUnit(2, RIFLEMAN)
call SetBuildUnit(2, FOOTMAN)

It will still continue to produce the full result of thoes 20 lines, ending with 10 riflemen and 10 footmen.

Now lets take a look at a larger part of this tier 1 code for the Riflemen strategy:

call BuildUnit(10, RIFLEMAN, 50)
call BuildUnit(1, hero[1], 80)

Here we got an order of 10 riflemen and the first hero.
So what of this is going to be built first you think? Lets check.
First we got 10 riflemen with a priority of 50, that gives the first rifleman the priority of 68(50+(10-1)+2).
And lastly we got the hero with a priority of 80.
This means that the hero gets built first. secondly it will continue with building riflemen until the rifleman priority is lower than the priority of the first footman so let's count.

1. Hero1 80prio
2. Rifleman 68prio
3. Rifleman 66prio
4. Rifleman 64prio
5. Rifleman 62prio
6. Rifleman 60prio
7. Rifleman 58prio
8. Rifleman 56prio
9. Rifleman 54prio
10. Rifleman 52prio
11. Rifleman 50 prio
DONE!

Now this computer got an army already and is fully operational. Don't mind about the needed buildings, it knows what it needs and will build it.

Another function could also be place here
This for example:

call BuildUpgr(2, UPG_RANGED, 34)

Taken from the tier 2 code this upgrade order tells the computer to upgrade the ranged unit attack to level 2(2, UPG_RANGED,) with a priority of 34(34) and since the level 2 never was ordered it will upgrade that first of course with the 2*[additional amount] rule, that means the level 1 ranged upgrade is first done with the priority of 36. Works as I said just like the build function but is only used for upgrades.The new versions of AMAI no longer require you having to put the upgrade line in. The upgrades for units will be researched when amai sees fit. Putting this line in will force AMAI to research an upgrade which can be useful as AMAI may not always automatically research upgrades as promptly as you would like.

By now you might have noticed that unit ordered first in the tier 1 code "merc_rush". This is a mercenary that will be bought if there is any mercenary camp on the map with a mercenary under the category merc_rush available.
There are several different kinds of mercs that can be ordered just by making a build order on the category name.

merc_rush - a weak but very early available mercenary of some kind.
merc_stopper - a mercenary with some kind of entangle or ensnare abillity.
merc_caster - a caster mercenary with no healing capabilities.
merc_healer - a healer merc with some kind of healing spell.
merc_melee - a stronger melee attacking mercenary.
merc_ranged - a range attacking mercenary.

In some cases the same mercenary can exist under multiple categorys but there is only 1 mercenary for each category or none.

The tier 2 and tier 3 code windows have the same kind of code as the tier 1 window but usually more since it's possible to build more units and do more upgrades in the higher tiers.

There are some other special build orders as well. In other human strategies orders calling "basic_melee". This is footmen or knights depending on what the computer can build for the amount number of food.

call basic_melee(50, 36)

This for example will build footmen or knights for the food value of 50 at the priority of 36.

My suggestion is that you take a look at different strategies for different races to see how they are made and then try to make your own strategy when you feel up to it.

Making a new strategy
Start by getting to the strategy manager and select the version and race your strategy shall be made for, then hit the button 'New' to the right.
Now a strategy by the name of New shall appear at the bottom of the list.

Now hit the edit button to start making this strategy.

Now we are going to make a simple AMAI strategy step by step and test it in game.
Start by giving it a name and report.


Next we have to make it build something. To prove how easy it is to make AMAI play with very little code i'm starting with only 2 lines in the tier 1 code.

A hero and 10 footmen should be sufficient for some creeping and early attacks on the enemy, so let's test it.
Hit the 'OK' button to save this strategy as it is. You will find yourself back at the strategy editor where this strategy still has the name "New", to fix this just restart the program or switch to another race and switch back and the name "Test" should appear instead if that was the name you gave it.
Now to lock the computer to only use this strategy so we can test it you have to select it in the list and hit the 'Lock' button to the right.
After this we need to compile it, so hit the compile button to the left.

After it has compiled just start the installer 'AMAI.exe' and install this version to a map of your choice so we can test it.
After this start Warcraft3 The Froxen Throne. (Unless it was a Reign of Chaos version you just did)
Go to Local Area Network and set up a game on the map you just installed this version of AMAI to with yourself as observer and bring up 2 human computers.

Start the game and check if everything is alright. If it works as it should both computers will tell you that they are using the test strategy you just made.

Now the game should go on with 2 human computers creeping and attacking each other while both try to keep an army of 1 hero and 10 footmen.
As you can see all the buildings and workers are built automatically. The computers buy support units as zeppelins and maybe some mercenaries automatically as well and try to do some harass attacks.

Since this strategy now is very simple the game will probably never end, both computers will just kill all creeps and then maybe don't even dare to attack each other since they got armies of equal size. This depends on what 2 profiles were picked for the 2 computers but is very likely to happen with this few units.
So get back to the editor and try to evolve your strategy a bit by adding an order to upgrade to tier 2. This is done by ordering the building name of the tier 2 hall, for human this is KEEP.

And we don't want it to get to tier 2 for nothing so let's add some code in this tier as well so the computer continues to build when it gets there.

Making the footmen level of attack and armor be upgraded to level2 as well as building a second hero and 5 riflemen should be good.
And remember to keep the footman order here if you still want the computer to keep a maximum of 10 footmen after it reaches tier 2 so it rebuilds any lost footmen.

Now just repeat the previous steps to test this updated strategy. Hit 'OK', lock it again just in case, compile it and install it.
Run a test game again and notice how the computers upgrade the hall by the time they got the first hero and 2-3 footmen. After the hall is upgraded they should make a blacksmith to make the melee unit upgrades ordered in tier2 and to be able to build the 5 riflemen also ordered.

You might notice sooner or later that the computers will also build a shop no matter if you ordered it or not, this is becuse they want some items like potions and scroll of town portal automatically and the best way to get them is to build a shop and buy them there so thats what they do.

There are some additional build functions that might come in handy when you are trying to bring your strategy to perfection.
The first is 'BuildItem' that works just like 'BuildUnit' or 'BuildUpgr' but instead it takes an item and orders the computer to get the given amount of this item for any of the heroes.

call BuildItem(2, HEALING_POTION, 40)

This orders a computer to buy 2(2) healing potions(HEALING_POTION) using any hero to buy them at the priority of 40.(40)

The second function is an advanced build function used to make your strategy a little more allround.
The name is 'SetBuildReact' and it's used to balance between 2 different unit types depending on how strong the enemy is in a certain area like this.

call SetBuildReact(20, 3, HUNTRESS, 5, ARCHER, enemy_unarmored, 4, 12, 50)

This command tells the computer to build 3(3) huntresses(HUNTRESS) and 5(5) archers(ARCHER) at all times but then spread a number of huntress and archers out on a food amount of 20(20) depending on how strong the enemy army is in the area of units with unarmored armor(enemy_unarmored).
if enemy unarmored strength is lower than 4(4) all this food becomes huntresses, if it's above 12 in strength(12) that food instead becomes archers only.
If the enemy unarmored strength is something between the 2 borders(4 and 12) the food amount is shared betweem both unit kinds.
For example if enemy unarmored strength is 8, 10 food will be huntress and 10 food will be archers.

For better detail about this command check the Reference Section

If you made it this far I don't think you should have any trouble to complete a whole strategy on your own but there are some things to have in mind when making an AMAI strategy.

1. Only make goals and keep it simple to make AMAI work optimal as it's made to play on it's own.

2. When making an AMAI strategy keep in mind that your strategy should have a special purpose and not be an all round strategy since AMAI will use many different strategies. An all round strategy is not good for AMAI since there is always another strategy that counters what the enemy got better than any allround strategy. Make a strategy that is good against for example air units and give it a high positive on anti air strength setting like 8 but at the same time the strategy is bad vs ground units and very bad vs ranged units with piercing attack so remember to give it negatives to anti normal strength like -3 and anti piercing strength like -5 so AMAI will know that this strategy is no good choise unless enemy really got lot of air units mostly.

When you created your own strategy you might want to share it on internet and download other strategies made by other players to bring your AMAI closer to perfection. Read on to the next section to find out how to do this.

NOTE: The reference section provides a reference about all the basic commands that can be used in the AMAI strategy manager. Use it if you need ideas or do not understand a command, or forgotten how to write it.