HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

AI

10-18-2006, 04:42 AM#1
D40-88
How can I open the ".ai" files with the World Editor? I've extracted these files by the main MPQ war3 file and also tried opening with AI Editor within World Editor, but none of the options allow me to open the ".ai" files.
10-18-2006, 07:33 AM#2
SentryIII
Notepad?
10-18-2006, 04:52 PM#3
D40-88
Thanks.

What are the various lines in the .ai file mean?
Eg.

//*** WAVE 1 ***
call InitAssaultGroup()
call CampaignAttackerEx( 6, 6, 8, NAGA_REAVER )
call CampaignAttackerEx( 1, 1, 2, NAGA_MYRMIDON )
call CampaignAttackerEx( 0, 0, 1, NAGA_VASHJ )
call SuicideOnPlayerEx(M4,M4,M1,targ)
10-18-2006, 05:29 PM#4
The)TideHunter(
Its a language called Jass, Wc3's language.
If you want to find out more about Jass, check tutorials

But looking at the first few:

Collapse JASS:
call InitAssaultGroup()
call CampaignAttackerEx( 6, 6, 8, NAGA_REAVER )
call CampaignAttackerEx( 1, 1, 2, NAGA_MYRMIDON )
call CampaignAttackerEx( 0, 0, 1, NAGA_VASHJ )
call SuicideOnPlayerEx(M4,M4,M1,targ)

Line 1 = Initialise an assault group
Line 2 = Set an attack = Naga Reaver
etc
Line 5 = Attack player targ.
10-18-2006, 05:38 PM#5
moyack
I've made an AI campaign tutorial, check it out here. There, I explain almost everything you probably need to know about Basic AI in WC3.
10-18-2006, 07:55 PM#6
D40-88
Sweet, thanks guys.

3 more questions:
How do I find out about the unit codes of each specific unit? Where "exactly" do I look?
What I mean yb unit code is eg. call CampaignAttackerEx( 6, 6, 8, NAGA_REAVER )
The "NAGA_REAVER". I need to know the name for each unit for JASS.

What is the command for get the AI to repair structures once they're damaged? I know it says in insane AI, it repairs, but I want one where it repairs no matter the difficulty.

If I'm using a custom map I've created with custom triggers, how do I enable the player to be able to choose the difficulty of the game?
10-18-2006, 09:08 PM#7
The)TideHunter(
NAGA_REAVER will be declared as a global somewhere, the rawcode will be as it is in the object editor.
If you search with Jasscraft, i get:
constant integer NAGA_REAVER = 'nnmg' // footman
And others:

Collapse JASS:
    constant integer NAGA_ALTAR         = 'nnad'        // altar
    constant integer NAGA_CORAL         = 'nnfm'        // farm
    constant integer NAGA_COUATL        =  NAGA_SERPENT // weak air
    constant integer NAGA_DRAGON        = 'nsnp'        // old names
    constant integer NAGA_GUARDIAN      = 'nntg'        // tower
    constant integer NAGA_HYDRA         = 'nhyc'
    constant integer NAGA_MYRMIDON      = 'nmyr'        // knight
    constant integer NAGA_ROYAL         = 'nnrg'        // royal guard
    constant integer NAGA_SERPENT       = 'nwgs'
    constant integer NAGA_SHRINE        = 'nnsa'        // sirens & couatls
    constant integer NAGA_SIREN         =  NAGA_WITCH   // caster
    constant integer NAGA_SLAVE         = 'nmpe'        // peon
    constant integer NAGA_SNAP_DRAGON   =  NAGA_DRAGON  // weak ranged
    constant integer NAGA_SORCERESS     = 'Nngs'
    constant integer NAGA_SPAWNING      = 'nnsg'        // myrm, snap dragon, hydra
    constant integer NAGA_TEMPLE        = 'nntt'        // town hall
    constant integer NAGA_TURTLE        =  NAGA_HYDRA   // siege
    constant integer NAGA_VASHJ         = 'Hvsh'
    constant integer NAGA_WITCH         = 'nnsw'
10-18-2006, 11:09 PM#8
D40-88
Quote:
Originally Posted by The)TideHunter(
NAGA_REAVER will be declared as a global somewhere, the rawcode will be as it is in the object editor.
If you search with Jasscraft, i get:
constant integer NAGA_REAVER = 'nnmg' // footman
And others:

Collapse JASS:
    constant integer NAGA_ALTAR         = 'nnad'        // altar
    constant integer NAGA_CORAL         = 'nnfm'        // farm
    constant integer NAGA_COUATL        =  NAGA_SERPENT // weak air
    constant integer NAGA_DRAGON        = 'nsnp'        // old names
    constant integer NAGA_GUARDIAN      = 'nntg'        // tower
    constant integer NAGA_HYDRA         = 'nhyc'
    constant integer NAGA_MYRMIDON      = 'nmyr'        // knight
    constant integer NAGA_ROYAL         = 'nnrg'        // royal guard
    constant integer NAGA_SERPENT       = 'nwgs'
    constant integer NAGA_SHRINE        = 'nnsa'        // sirens & couatls
    constant integer NAGA_SIREN         =  NAGA_WITCH   // caster
    constant integer NAGA_SLAVE         = 'nmpe'        // peon
    constant integer NAGA_SNAP_DRAGON   =  NAGA_DRAGON  // weak ranged
    constant integer NAGA_SORCERESS     = 'Nngs'
    constant integer NAGA_SPAWNING      = 'nnsg'        // myrm, snap dragon, hydra
    constant integer NAGA_TEMPLE        = 'nntt'        // town hall
    constant integer NAGA_TURTLE        =  NAGA_HYDRA   // siege
    constant integer NAGA_VASHJ         = 'Hvsh'
    constant integer NAGA_WITCH         = 'nnsw'

Where is is in the Object Editor? I can't find it?

And do I use NAGA_REAVER or 'nnmg' in the CampaignAttackerEx command?
10-18-2006, 11:18 PM#9
Alevice
Are you using RoC (wc3 vanilla) or TFT (wc3 expansion)?

The later has new features added to the world editor, like a fully featured object editor, substituting the somewhat limited unit editor.

Quote:
And do I use NAGA_REAVER or 'nnmg' in the CampaignAttackerEx command?

Either should be fine.

EDIT: Doh, Nagas are part of TFT :P
10-19-2006, 12:33 AM#10
D40-88
Thanks.
I figured out the Unit ID part.

Anyone have answers for my other 2 questions:?
What is the command for get the AI to repair structures once they're damaged? I know it says in insane AI, it repairs, but I want one where it repairs no matter the difficulty.

If I'm using a custom map I've created with custom triggers, how do I enable the player to be able to choose the difficulty of the game?
10-19-2006, 03:11 AM#11
moyack
Quote:
Originally Posted by D40-88
What is the command for get the AI to repair structures once they're damaged? I know it says in insane AI, it repairs, but I want one where it repairs no matter the difficulty.

If I'm using a custom map I've created with custom triggers, how do I enable the player to be able to choose the difficulty of the game?

Actually there's not a command, it's more an option function called call SetPeonsRepair( boolean ) which if it's set to true, it will make worker units repair the damaged buildings automatically.

About the difficulty, it can't be changed when the game is running, it's set before you begin to run your map. Unless....... you trigger everything, I mean, create triggers that save a variable which contain the difficulty level, and according to that create more or less AI units and make them behave accordingly.
10-19-2006, 03:31 AM#12
D40-88
Quote:
Originally Posted by moyack
Actually there's not a command, it's more an option function called call SetPeonsRepair( boolean ) which if it's set to true, it will make worker units repair the damaged buildings automatically.

About the difficulty, it can't be changed when the game is running, it's set before you begin to run your map. Unless....... you trigger everything, I mean, create triggers that save a variable which contain the difficulty level, and according to that create more or less AI units and make them behave accordingly.

I thought the SetPeonsRepair only makes the AI repair damaged mechanical units as I've read in the tutorial???
10-19-2006, 03:35 AM#13
moyack
Quote:
Originally Posted by D40-88
I thought the SetPeonsRepair only makes the AI repair damaged mechanical units as I've read in the tutorial???
Buildings are considered mechanical, check it out in the object editor :)
10-19-2006, 07:19 PM#14
D40-88
Thanks a lot everyone.

I've tested it out and it works, however, there seems to be some bugs in the attack waves.
1: Sometimes the AI makes only half of what I asked before attacking. Eg. 6 Coualti + 1 Royal Guard >>> Becomes 3 Coualti + 1 Royal Guard
2: After a while, the AI changes the defending units. Eg. Initially, defending is 1 Siren + 1 Coualti + 1 Reaver >>> After a while becomes 1 Turtle + 1 Siren + Hero. So technically the defending units become harder!!!
Anyone know how to fix these 2 problems?
10-19-2006, 10:08 PM#15
moyack
Hmmm.... The first situation can be solved calculating how long the Ai takes to train all the assault units. The function SuicideOnPlayer() waits n seconds to attack, so if the AI couldn't finish to train the assault units, it will attack with the units that it was able to train in the time you specify. If you give more time, you'll see that the assault group will be more complete.

About the second question: it's strange :/ I suggest that you post your whole AI script.