• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

The AI Editor

Level 9
Joined
Jul 18, 2005
Messages
319
This tutorial is about the different parts of the .wai AI editor, how to configure conditions, the condition explaination. and also it will give a explaination about the functions. (How I'm going to write it is by the left)

How to configure conditions
To configure conditions right click where you want to configure it and bam there the option!

The Conditions
Well this part is currently being written so all things might not be there

Base Conditions

Boolean Condition: Condtion then ture or flase. Similar to the Trigger Editor one.

Integer Condition: Condition then the amount. Similar to the Trigger Editor one.

And Condition: Condition 1 and Condition 2. Both required to activate the string assigned to. Similar to the Trigger Editor one.

Or Condition: Condition 1 or Condition 2. Any required to activate the string assigned to. Similar to the Trigger Editor one.

Boolean Condition Triggers
Most of these are pretty straight forward only the ones that are tricky I'll give an explaination for.

Preset - Current game is single player

Hero - Attack Captian is at Home: It means that the leader of an attack group is at base.

Hero - Attack Captian is Retreating

Hero - Attack Captian is at Goal

Hero - Attack Group is Complete

Hero - Attack Group is Empty

Hero - Captian is in Combat: Any captian (Attack or Defense) is in combat.

Misc - Creeps exist anywhere

Town - Town is under attack

Town - Town has mine: You have to put down the town number not an other trigger.

Town - Town has Hall: You have to put down the town number not an other trigger.

Town - Expansion Spot Needed


Integer Condition Triggers
Most of these are pretty straight forward only the ones that are tricky I'll give an explaination for.

Preset - Maxium number of inventory slots (6)

Preset - Maxium number of players (12)

Preset - Maxium number of player slots(16)

Arithmetric: Okay this is the combonation Integer Trigger and operator (+,-,x,/) and an other Integer Trigger. Simlilar to the Trigger editor one.

Note that Commands are sent from the trigger editor

Commands - Commands Waiting

Commands - Last command sent: You can either remove or leave the last sent command.

Commands - Last command data: You can either remove or leave the last sent command data.

Hero -Attack Group Size

Hero - Attack Group Health Level

Hero - Attack Group Mana Level

Misc - Current Attack Wave

Misc - Melee Diffuculty Level

Resources - Current Gold Amount

Resources - Current Lumber Amount

Resources - Total unmined Gold Owned

Resources - Food used

Resources - Food Produced

Resources - Food Produced by unit type: The unit must produe food.

Town - Number of Mines owned

Town - Town with Mine: Using Town id.

Town - Next expansion town: Using Town id.

Unit - Total units of type:Owns an certian amount of an unit type.

Unit - Total units of type - Completed Only: Owns an certian amount of an unit type completed.

Unit - Total units of type - By Town: Owns an certian amount of an unit type completed or uncompleted in an town.

Unit - Gold cost of Unit Type

Unit - Lumber Cost of Unit Type

Unit - Build time of Unit

Upgrade - Current Upgrade level

Upgrade - Gold cost of upgrade

Upgrade - Lumber cost of upgrade


The First Page
On the first page there will be a AI name, race selector, behaviors, import custom data, and where to add conditions.

AI%20conditions.JPG

Name:This sets the name of your AI. (Check the box "Set Player Name" for this to work if your map has fixed player names.)

Races: You can pick between Human, Orc, Undead and Night Elf. If you are using an custom race there is an Custom option for that. (For Custom import your Object Data from your map.)

Behaviors: These are the Behaviors.

Set Player Name: This shows the name of your AI even if it has a set player name on the map.
Melee: This states if it is an melee AI.
Defend Users: The AI will protect other players if they are attacked.
Random Paths: The AI will pick paths in a more random fashon.
Target Heroes: The AI will target enemy heroes more.
Repair Structures: The AI will repair strcutures.
Heroes Flee: The AI will retreat its hero if they are in a crictical condition.
Units Flee: The AI will retreat its units if they are in a crictical condition.
Groups Flee: The AI will retreat attacking groups if their are in a disadvantage.
Have no Mercy: The AI will attack if the enemy has weaken units or at a disadvantage.
Ignore Injured: The AI will ignore units under 50% when assembling attack forces.
Remove Injuries: The AI will send injured units back to base or somewhere where it could heal.
Take Items: Heroes will pick up useful items.
Buy Items: Heroes will buy useful items.
Slow Harvesting: Workers will harvest 1 gold or 1 lumber depending on their mining type.
Allow Home Changes: The AI will pick new locations for an home base and retreating locations.
Smart Artillery: The Ai siege units will seige enemy bases when possible.

Custom Object Data Import/Export: This option allows you to Import and Export custom object data. The file type is .w3o.

Conditions: This allows you to create conditions for building orders and attacking groups. It alsos allows you to edit and delete them as well.

The Second Page
This allows you to pick the heroes that your AI uses, the chance of getting them, and skill seletion.

AI%20heroes.JPG

Hero Selection: Allows you to pick the heroes your hero uses.

Chances: The many combinations of the hero order compiled into chances. There are 6 chances for different hero orders.

Skill Selection: The skill selection order for your hero. This allows you to select what skills they learn.

The Thrid Page
This page allows you to pick what is their town hall, thier mine building, harvesters, building order, and harvest priorities

AI%20group.JPG

Town Hall, Mine building, Harvesters: This allows you to pick thier Town Hall, Mine Building, and Harvesters.

Building Order: The order of construction of your AI. Conditions are used here. The first building should be your town hall then your starting units.

Harvest Priorities: These Prioirities is how much harvesters are to mine in its Towns.

The Fourth Page
This page allows you to add attack groups, order attack waves, and target priorities.

AI%20order.JPG

Attack Groups: This allows you to order the attack groups of the AI allowing you to order thier conditions and how much they send of each unit.

Attack Waves: This makes the Attack Groups to be ordered in waves with a delay time, to add multiple waves of the same group add it again. Also it allows you to pick its minium forces, delay time before the first wave and repeat the attack wave.

Attack Priorities: These priorities will order the AI which in want to do the top one will be its first priority, conditions will also be configued and minium units and maxium units to be used as well top enable flyers to join.

The Last Page
Lastly this page where you can observe your AI but if it has custom object data this cannot be done since it was designed for Melee AI observing.

AI%20test.JPG

Game Speed: Adjusts the game speed for observing your AI.

Game Options: Allows you to disable fog of war and victory/defeat conditions.

Map File: Sets the melee map for testing.

Players: Sets the User (you) as an observer or you can play against your AI, at least 1 computer player must use your AI for testing if you want to see if you done everything correctly.


Now I hope you got an better understanding of the .wai editor!'

Other AI editing links
Might help for those interested in triggering an AI via triggers, more advance detailed guide on the AI Editor or editing the .ai file directly.
http://wc3campaigns.net/showthread.php?t=79638 (Arena: Trigger AI)
http://wc3campaigns.net/showthread.php?t=87999 (Campaign AI)
http://wc3campaigns.net/showthread.php?t=89199 (AI Editor)
http://wc3campaigns.net/showthread.php?t=92915 (Incomplete but still good, AI Editor)

-Av3n
 
Last edited:
Level 9
Joined
Jul 18, 2005
Messages
319
Well the A.I editor...
I'll but it this way. The .ai file can be maulipulated for custom maps such as hero defenses, custom melee. Simple maps like that. Arenas and AoS's you'll have to controll the A.I with triggers as well because the ai might nt behave how would you wan it to behave.

-Av3n
 
Level 3
Joined
Sep 30, 2007
Messages
9
Hero Selection

I have been using the AI editor for a custom melee but....
How would I fix the total number of hero's to 4
I can get the AI to get 4 heros but....
I cant choose the skills on the fourth hero how do i?
 
Level 2
Joined
Sep 5, 2007
Messages
14
AI Heros

you can make AI just for or a set of heros heros, if youi remove the starting units for the player (townhall,builders etc) you can add the hero you want in a attack group of its own, you might have to use triggers to initialize the attack wave but if you put the waves on with a wait time the hero will keep attacking after retreating for healing or defending users etc. i have tryed my own AI for a set of heros to go creeping even tho the AI doesnt have a base they retreat to a healing point then gop kill more creeps learning there abilities by themselves.:thumbs_up:
 

CyberDuelX16

C

CyberDuelX16

Finally! Ages have i been looking how to make this almost freaking impossible to make custom AI for my map! I have made a custom Town AI for my map and can anyone help me to test it if it can work Online by hosting it? Such a pitty i cant host, thank you for this tutorial!
 
Level 4
Joined
Jul 23, 2008
Messages
99
I want to ask something. Are AI functions/conditions (such as Hero Retreat and Slow Gathering) can be used in custom AI?
 
Level 13
Joined
May 11, 2008
Messages
1,198
i want to learn the making ai for a tag style map...but now i'm not in a hurry, and by the way, don't know if anyone mentioned it, but some of your spelling in the tutorial is really bad, please fix it! like captain and true and false, you put captian over and over again, and ture and flase.
 
Level 9
Joined
Jul 18, 2005
Messages
319
Yeah I'm too lazy to change it, no one has really mind about the spelling errors.

For making an ai for a tag map you'll have to use "triggered AI" and not wc3 one, because the wc3 one is designed for melee. Though you can import a .ai script customized with both common.j and common.ai (Not sure about this one) functions to run on a computer player.

-Av3n
 
Level 1
Joined
Nov 17, 2008
Messages
5
I've made a custom melee map, also made an AI in the editor. My AI builds up a base, gets units, then does nothing but harvest. There's 2 things about it that buggers me.
1: Why doesn't the AI build more than ~15-20 units? I've made it so that all the units they're supposed to build costs 0 food, and all the right buildings are in place...
2: Whatever I do, they won't attack. Me or eachother. I use the standard Undead race, so that shouldn't be a problem. What do I do? Attack waves? Priorities?
Please...
 
Level 9
Joined
Jul 18, 2005
Messages
319
Attack waves... You forgot to add attack waves.

Maybe perhaps you should see how 'fast' the AI gathers, or perhaps its your attack group which is 20 units.

Overall _it_ should work if your custom melee map uses the _warcraft 3 mechanics_

-Av3n
 
Level 1
Joined
Nov 17, 2008
Messages
5
Yeah, but when i try to add more attack waves, it just crashes when i try to import it into the map...
I've never understood how attack waves works, really.
How many attack waves should i have? I currently just use the "all units"group, is it necessary to have more of 'em?
 
Last edited:
Level 9
Joined
Jul 18, 2005
Messages
319
Not really, but you should check if you got the right unit types in the all units group.

I suggest you look at the AIs that blizzard included in warcraft. (Gruntmaster + Wyrm Moger (However the last word is spelt)). To see how it works, it has been years since I worked with the WE AI Editor

-Av3n
 

DEA

DEA

Level 2
Joined
Aug 6, 2008
Messages
8
I have problem with AI path. All is working just fine, but I hate when Wave are attacking first what they see and then are returning to base. Why they are not continue the path and fighting to the end of the wave, but kill first enemy at path and going home?
 

DEA

DEA

Level 2
Joined
Aug 6, 2008
Messages
8
Do you have Group Flees option turned on? Try disabling that and turn on Units Flee and Heroes Flee option instead and see what happens.

-Av3n

Nothing happen! May please me tell how you're doing AI for Custom map. I tried use flees, but too nothing happen (usually I dont use flees at all). I dont know or I'm wrong in "Attacking" or in "General".
 
Level 4
Joined
Feb 23, 2008
Messages
102
i made a custom map and i want an AI in it, how do i get it in it, cuz it says only melee map so is there a way or no..?
 
I noticed in basic trigger GUI:
AI - Send Player 1 (Red) the AI Command (string, integer)

I was wondering if anyone knows/has a list of "commands", or knowledge on how to use this. (or maybe a jass workaround) to control an AI's attack destination
(Ive heard it was a dummy unit, they follow around, and if its a unit it must have a rawcode, and be programmable?)
 
Level 1
Joined
Sep 24, 2015
Messages
4
I can't get my custom Murloc and Mur'gul races to build expansion towns. They just end up going on a potentially-infinite loop of building another town hall in the main base.
 
Top