wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Tutorials > Trigger (GUI)/ AI editor Tutorials
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 11-19-2006, 05:48 AM   #1
uberfoop
User
 
uberfoop's Avatar
 
Join Date: Jul 2005
Posts: 207

Submissions (1)

uberfoop will become famous soon enough (29)

AI tournament - 2nd place

Default Tutorial: The WC3 AI Editor

Notification:
Firstly, if you are looking at this tutorial to create anything other then a simple campaign/melee AI to make a computer army control it's units like other standard computer armies, you should probably stop reading now. Search up a good single-hero AI tut such as this, made by Conan of TheHelper.net (Was Anub'Arak here)



The AI editor is a fairly simple tool, although it can be confusing to new mappers because of its layout. The game uses .ai files to command units, but ai editor files (before being converted to game-readable .ai files by the editor) are stored as .wai.

This tutorial is split up to do a surface covering of the important aspects of each of the different tabs in the editor:
Code:
I. General
II. Heroes
III. Building
IV: Attacking
V. Test Configuration
VI. Finishing Up
Each section gives a brief explaination of each part of its Tab.


I. General Tab

The 'General' Tab is, as its name implies, very general. Parts of the general tab, starting from the top left:

-Name: The name of the AI that the game uses. If the box below that says 'set player name' is checked, whatever army in-game that uses this AI will have the name you enter here be their player name.

-Race: This is obviously important; an orc AI can only make orc units. If you want to be free in that sense, you can pick 'custom'. This opens up other options so you can create custom races AI's. However, to use custom units in an AI, you need to open up the object editor where the custom units are, use the 'export all object data' under the 'file' menu, and import the data into the AI editor using the custom data area on the bottom of the general tab.

-The 'option' section which contains the 17 checkboxes:
Quote:
Set Player Name: Makes the AI player in-game use the name you gave it in the name box
Melee: If checked, the AI will be more alliance-strike-oriented. If unchecked, the AI is good at ignoring what allies are doing to own the enemy.
Defend Users: If checked, an AI will try to help person-controlled players who are being attacked.
Random Paths: If checked, the AI will choose where to go more randomly.
Target Heroes: Checking this makes the AI focus heavily on enemy heroes.
Repair Structures: Allows the AI to repair damaged structures when needed.
Heroes Flee: Causes damaged or heroes incapable of hurting the enemy to try and retreat themselves from combat.
Units Flee: Same as above, but with non-hero units
Groups Flee: Allows an army to retreat from battle if it thinks it's at a disadvantage. Without this option checked, AI armies will still fight even if their units are getting wrecked up. Units and heroes can still flee temporarily individually if those options are checked.
Have No Mercy: The AI version of a maphack. With this checked, the AI will try to nail enemies when they're weak.
Ignore Injured: Causes units with less than 50% health to be exempt from joining attack groups. These units will chill at their base as a defensive-only force until their health gets back up past 50%.
Remove Injured: Causes the AI to send injured units to places to heal if the unit is already in a raiding party.
Take Items: The AI will pick up items from the ground.
Buy Items: The AI can buy items from stores.
Slow Harvesting: Sticks the biggest resource handicap ever on the AI; They can only harvest 1 resource at a time if this is checked.
Allow Home Changes: The main base of an AI is where it attacks from and retreats to; This option allows the AI to choose a new location for this mid-game.
Smart Artillery: The AI will focus siege-damage attacks on buildings if this is checked.

-The custom data section: The uses of the import option are explained 8 lines above on this page. Export will export whatever custom data you've already imported. Clear will delete it from the AI.

-Conditions: This is nothing but a big scary white box that does absolutely nothing by itself. You can set up conditions in here for use in the 'building' and 'attacking' tabs. This is explained in tut sections III and IV. Note that you don't actually NEED to write your conditions here to use them in a different part of the editor; any option where you can use conditions has an option to either use a condition specified in this menu OR create a new one right there. However, when you have a condition that will go through multiple uses for a part of the AI's system, it's good to write it in here for use elsewhere.

II. Heroes Tab

This tab controls what heroes the AI will build by default and abilities it learns on those heroes.
Parts of the heroes tab:

-Heroes used: Interestingly enough, and sadly, it's impossible to make an AI with this editor that is capable of picking between more then 3 heroes, or capable of using more than 10 ability levels. If you want the AI to never get heroes, you can just set all 3 boxes to 'none'. If you only want the AI to get 1 hero type, just fill in the 1st box. If you want the AI to pick between 2 hero types, fill in 2 boxes. If you want an AI army that can pick between 3 hero types, fill in all three.

-Training order: Self explanitory. It just lists all the possible combinations of hero choosing order, and you set which ones you want to occur and how often. For example, if you only want 1 of the orders to ever happen, just set that order to 100%.

-Skill Selection: The tab brings down your lists per hero, and the box on the left below is for choosing what the ability skilling order you want that hero to get is. The boxes to the right are for if you want the hero to level abilities up differently depending on when then hero is picked.


III. Building Tab

This is a very important tab. It not only controls build order, but how many workers do what. Parts of it:

Base Building: This option is only useable if you set race to 'custom' in Tab 1. It's very simple, just set it to the AI's town-hall style building and it'll work fine.

Mine Building: This is only used for custom AI's and only for the Undead style of gold mining where you build the building over the mine. Don't ask why night elf gold mining doesnt use this too, I honestly have no idea. Again, if you're using that style of gold mining, set it to the building your race uses. Otherwise, if it harvests gold normal, leave this as 'none'.

-Build Priorities: This is the build order of your AI, and controls all construction and unit training. It's also the first part where you use conditions. There really isn't that much to say about this, but it is of vital importance. The things closer to the list top are to be built sooner than things near the bottom. Also, Conditions: When you set a condition to one of these, if the condition isnt true when the priority list reaches it, it ignores that object totally until the condition is true. Another thing to be noted is that the AI doesn't understand techtrees, and has some evil 'features' that will screw stuff up. If you have the system queued to make a thing, and it doesn't have the tech requirements for that thing, it will build whatever was last on the list, forever. So if you have a farm on the list right above a gryphon aviary, and the AI doesn't have the tech requirements for the aviary, it will build farms forever.

-Gold worker: Custom race only option. Set it to the worker unit of your race that you want to mine gold.

-Lumber Worker: Custom race only option again. Pretty much same as gold worker option.

-Harvest Priorities: Workers will not do resource gathering without this. A good idea is to have 5 set to gold at each mine your AI might have. This list also has conditions so the AI will ignore harvesting priorities if the condition isnt set. For example, rather then just setting 5 gold workers to work on mine #2, add a condition to check that your AI actualy has 2 gold mines (eg 'number of mines owned greater than or equal to 2'). This chart, as with the other in this AI editor tab, take some practice to coordinate things properly.


IV. Attacking Tab

This is the final tab that controls what the AI will be like in-game. It controls how the computer uses military units. I'm going to go over this tab a little differently then others because theres some things about it that are actualy important and some things that aren't, and I'm basically going to go over the standard way of setting it up, which most people use. There are many ways to set it up, but in general (like, 99% of the time. No joke), people do it like this:

-Attack groups: Make 2 attack groups. Call 1 minimum units and call the other 'main attack group' or something like that. Unit settings for the group currently selected can be found in the white box to the right. Minimum should contain the fewest units that you ever want your AI to leave base with. Basically, the units that the AI will initialy creep with and whatnot. This should contain the hero and at least several of the army's basic units. A good setup for a human AI might be:
first hero...quantity all...conditions none
footman...quantity 2...conditions nonw.
The other attack group should contain everything that you ever want the AI to attack with. Basically, list the first hero and every single attack unit that exists in your building priorities that you want to leave base. If you want that 1 mortar team your AI will make to stay and defend the base, dont list mortar teams in the main attack group. However, even if you leave a unit to defend base, if an enemy aggros the base that unit may run around in retaliation strikes.

-Attack waves: Using the standard method, just make 1 attack wave, and make the group it uses be the 'main attack group' thing. Thats all you need to do.

-Minimum Forces: Set it to your 'minimum' group

-Initial Delay: This is almost always 0. Yes that sounds very untutorial like, but thats what is almost always done with this value, and it always works properly like that in a basic sense.

-Repeats waves: We only have 2 attack groups, and 1 of them is the general 'attack' group, so this should be 1.

-Target priorities: This is very difficult to explain in a tutorial and regardless of skill with the AI editor will require testing of the AI to work it how you want in a map. The things at the top of the list, as long as the conditions you give it are met and the AI is ready to do that thing, will be top priority. Note that in a standard map the default arrangement works pretty well, in case you don't want to mess around with it and test it for a campaign map with several ai players and whatnot.
WARNING: DELETING THE CREEP CAMP PRIORITIES MAY RESULT IN AN AI ARMY SITTING THERE DOING NOTHING

V. Test Configuration

This tab is for testing the AI vs yourself or other AI. If you want it to fight with/against other AI scripts you made, you can select ai type custom in the ai column and import a .ai file.

VI. Finishing Up

There are 2 ways to save an AI for use:
1. Adding it to the map directly. To do this, when you're done with your ai, have the map you want to add it to open and go to the ai editors 'file' options and select 'add to map'. The ai is now attached to the mao directly and can be accessed from the map editor at any time by opening the ai editor and closing any other ai's.

2. Go to 'file' and select 'export script' to save it as a wc3-readable ai file (.ai). Now you have a .ai file which can be imported into a map or campaign and run using the trigger action AI-start campaign AI script.



Note: .ai files can be opened in notepad and directly edited in JASS. There is a tutorial available on how to create and/or edit AI files using JASS:
JASS AI tut by Moyack
__________________
Quote:
Originally Posted by darkwulfv
.03 is one 300th of a second.

Last edited by PitzerMike : 12-15-2006 at 04:30 PM.
uberfoop is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 11-20-2006, 08:13 AM   #2
Av3n
Roar!
 
Av3n's Avatar


Project Leader: TBR
Project Member: PoC
 
Join Date: May 2006
Posts: 1,854

Submissions (7)

Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)

Hero #4 extra-official winner2008 Spell olympics - Fire - BronzeHero Contest #3 - 3rd Place

Default Making An Simple Melee AI

Here are some additions to the tutorial and a demo map from Av3n:

The First Tab ~ General Stuff
Okay the boring General Stuff for each section.

Name: Raiders AI
Race: Orc
Set Player Name: checked
Melee: checked
Defend Users: unchecked
Random Paths: unchecked
Target Heroes: checked
Repair Structures: checked
Heroes Flee: checked
Units Flee: checked
Groups Flee: unchecked
Have No Mercy: checked
Ignore Injured: unchecked
Remove Injuries: checked
Take Items: checked
Buy Items: checked
Slow Harvesting: unchecked
Allow Home Changes: unchecked
Smart Artillery: checked

Conditions
Start Expansion (Integer Contdition) : (Total Unmined Gold Owned) Equal to 5000

Here is an screenshot of what I've done:

Click image for larger version

Name:	General Tab.JPG
Views:	579
Size:	70.1 KB
ID:	16133

The Second Tab ~ Heroes
The Two Heroes Im going to use are the Shadow hunter and Tauren Chieftan.
Put on any abilities you want any order, I don't care.

Here is an screenshot of what I've done (For the abilites and training order.)

Click image for larger version

Name:	Heroes Tab.JPG
Views:	467
Size:	36.5 KB
ID:	16134

The Third Tab ~ Building
The training order Im going to list the tier 1 stuff, the workers and thats all. (You can find everything else in the demo map.)

The exact listing for Tier 1 (Bold equals buildings, Italic equals upgrades.)
Great Hall x1
Peon x6
Altar of Storms x1
Peon x1
Orc Burrow x1
Peon x2
Hero - First (In my case it would be Shadow Hunter)
Orc Burrow x1
Barracks x1
Grunt x3
War Mill x1
Troll Headhunter x1
Orc Burrow x1
Steel Melee Weapons x1
Grunt x1
Then so on...

Workers:
5 on gold (main)
4 on lumber (main)
3 on gold (expansion 1)
1 on lumber (expansion 1)

Here is an screenshot of what I did (including some of tier 2 and tier 3 if you can see it).

Click image for larger version

Name:	Building Tab.JPG
Views:	502
Size:	109.9 KB
ID:	16135

The Fourth Tab ~ Attacking
Attack Groups and priorities, Im only going to the Creep Group and adding the attack waves and priorities.

Creep Group
Hero - First
Hero - Second
Grunt 2-4
Troll Headhunter 2-3
Troll Berserker 2-3

Waves
Set all time stuff to zero then add Creep Group to the wave section.

Priorities
1.Creep Camp (0-9)
2.Common Alliance Target
3.Enemy - Expansion
4.Purchase Goblin Zeppelin
5.Enemy - Major Assault
6.New Expansion Location

Here is an screenshot of what I've done.

Click image for larger version

Name:	Attacking Tab.JPG
Views:	442
Size:	96.8 KB
ID:	16136

Final Note
Well this is the end of the tutorial, look inside the demo map and play against my Raiders AI(Hopefully you can beat it cause it is very easy), check the Raiders AI by exporting the Raiders AI from the map.

Happy melee AI designing!

-Av3n
Attached Files
File Type: w3x (2)EchoIsles Raiders.w3x (154.4 KB, 383 views)
__________________

Thanks to FatherTime for the sig
.:
Current ProjectsSubmissions
Power of CorruptionMy Terrain
The Black RoadMy Resources
Strikeforce
Twitter

Last edited by PitzerMike : 12-30-2006 at 01:27 PM.
Av3n is offline   Reply With Quote
Old 12-15-2006, 04:28 PM   #3
PitzerMike
Alcopops
 
PitzerMike's Avatar


Tools & Tutorials Moderator
 
Join Date: Jan 2003
Posts: 2,794

Submissions (12)

PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)PitzerMike is a splendid one to behold (643)

Approved Map: Pitzer's Minesweeper

Default

Ok, I've now merged in Av3n's tutorial.
__________________
Zoom (requires log in)

Last edited by PitzerMike : 12-30-2006 at 01:28 PM.
PitzerMike is offline   Reply With Quote
Old 10-27-2007, 04:52 AM   #4
Hoernchen
User
 
Join Date: Mar 2007
Posts: 47

Hoernchen is on a distinguished road (10)

Default

i made an ai for my map, and it builds good all the buildings, but its weird when it comes to upgrades....

1. Village
2. Builder
3. Barracks
4. Spear Barracks
5. Vodoo Lounge
6. Hunter Tent
7. Vodoo Lounge (if food >= 8)
8. Wolf Cave (...)
9. Spear Barracks (...)
10. Wolf Cave (...)
11. Vodoo Lounge (if food >= 12)
12. Barracks (...)
13. Berserker Barracks [is upgrade of barracks]
14. Greater Vodoo Lounge [is upgrade of vodoo lounge]
15. Survivor Tent [is upgrade of Hunter Tent]
16. Greater Vodoo Lounge (if food >= 8) [is upgrade of vodoo lounge]
17. Beast Cave (if food >= 8) [is upgrade of Wolf Cave]
.....and so on

Now the AI builds all the non-upgrade buildings really fast and good, but when it comes to upgrading it gets lazy, and doesn't upgrade??? It sometimes upgrades one or two buildings and thats it, altough it has enough food and gold to upgrade on.....

why?
__________________
Current Project:
Advanced Wars Arena
Hoernchen is offline   Reply With Quote
Old 10-27-2007, 05:28 AM   #5
Av3n
Roar!
 
Av3n's Avatar


Project Leader: TBR
Project Member: PoC
 
Join Date: May 2006
Posts: 1,854

Submissions (7)

Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)

Hero #4 extra-official winner2008 Spell olympics - Fire - BronzeHero Contest #3 - 3rd Place

Default

It should work correctly though... Try using resource checking conditions instead of food. Try tht

-Av3n
__________________

Thanks to FatherTime for the sig
.:
Current ProjectsSubmissions
Power of CorruptionMy Terrain
The Black RoadMy Resources
Strikeforce
Twitter
Av3n is offline   Reply With Quote
Old 10-27-2007, 07:46 AM   #6
Hoernchen
User
 
Join Date: Mar 2007
Posts: 47

Hoernchen is on a distinguished road (10)

Default

the problem is every building is supposed to cost 1 food (its not food in game)
__________________
Current Project:
Advanced Wars Arena
Hoernchen is offline   Reply With Quote
Old 10-27-2007, 05:32 PM   #7
moyack
Evil Emoticon
 
moyack's Avatar


Respected User
Project Leader: PoC
 
Join Date: Jan 2006
Posts: 3,279

Submissions (17)

moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)moyack is a splendid one to behold (666)

AI Tournament #2 - 2nd PlaceHero Contest - Second place

Send a message via MSN to moyack
Default

I think you put the upgrades as the last thing to do for the AI. Could you post a screenshot showing how you have the building pirorities??
moyack is offline   Reply With Quote
Old 12-05-2007, 11:13 PM   #8
Hoernchen
User
 
Join Date: Mar 2007
Posts: 47

Hoernchen is on a distinguished road (10)

Default

I'm sorry for replying so damn late, but I totally forgot about this post.
I made screen shots of the AI-Editor and highlighted spots, so you know where it recommenced.
The conditions are:

Prehistoric - Total Number of Village units bigger than 0
Medieval - Total Number of Castle .... 0
Industrial - Total Number of Capitol ... 0
Medieval and Default - Medieval and food >= 12
Medieval and High - Medieval and food >= 16
Prehistoric and Default - Prehistoric and food >= 8
Prehistoric and High - Prehistoric and food >= 12
Catapults - Medieval and Melee Difficulty level >= 2
CatapultsNot - Medieval and Melee Difficulty level < 2


For further understanding:
Food is given to players per trigger and increases with every Age by 4
Ages advance all 5/10/15/20/30 mins depending on settings
When a new age begins, all old buildings will be replaced by a trigger to match new age
Attached Images
File Type: jpg AI1.jpg (154.4 KB, 120 views)
File Type: jpg AI2.jpg (155.5 KB, 64 views)
File Type: jpg AI3.jpg (154.2 KB, 64 views)
__________________
Current Project:
Advanced Wars Arena

Last edited by Hoernchen : 12-05-2007 at 11:15 PM.
Hoernchen is offline   Reply With Quote
Old 12-07-2007, 02:04 AM   #9
Av3n
Roar!
 
Av3n's Avatar


Project Leader: TBR
Project Member: PoC
 
Join Date: May 2006
Posts: 1,854

Submissions (7)

Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)Av3n is a jewel in the rough (240)

Hero #4 extra-official winner2008 Spell olympics - Fire - BronzeHero Contest #3 - 3rd Place

Default

I haven't got an clear look yet. But try make different AI's for each age and run them when the age changes. Also the AI might pause it self because of the order

-Av3n
__________________

Thanks to FatherTime for the sig
.:
Current ProjectsSubmissions
Power of CorruptionMy Terrain
The Black RoadMy Resources
Strikeforce
Twitter
Av3n is offline   Reply With Quote
Old 12-07-2007, 03:58 AM   #10
Hoernchen
User
 
Join Date: Mar 2007
Posts: 47

Hoernchen is on a distinguished road (10)

Default

i already tried running different AIs but somehow loading a new AI over the old one screws him up and makes him useless. also he doesnt even build properly for the 1st age, he only upgrades like 1 or 2 buildings when i tell him to upgrade 10
__________________
Current Project:
Advanced Wars Arena
Hoernchen is offline   Reply With Quote
Old 12-11-2007, 07:20 AM   #11
guillesime
User
 
Join Date: Dec 2007
Posts: 2

guillesime has little to show at this moment (0)

Default

what be cause that the structures donīt train units?, have food and lumber
guillesime is offline   Reply With Quote
Old 11-25-2009, 11:43 AM   #12
leric
User
 
Join Date: Nov 2009
Posts: 80

leric has little to show at this moment (0)

Default

I have a problem here. I've tried both ways of finishing up the AI but it seems like the custom made AI won't take over. I've tried triggering it at map initialization after or before the default startAI action then create a - Start Melee AI - choose the .ai file that is imported. If the custom AI take over, it will change its name. But it doesn't seem to work (only worked on test AI). Any idea?

Nevermind, problem solved after found an unprotected map.

Last edited by leric : 11-25-2009 at 02:03 PM.
leric is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 01:19 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services