Help? Creating AI for Campaign?

Status
Not open for further replies.
Level 4
Joined
Aug 26, 2015
Messages
71
Hello. I need help creating AI for my Campaign. This tutorial: How to make a Campaign AI seems to be made for custom games and not for campaigns.
Some people say using JassCraft, while others use GUI AI Editor and others use Triggers.

What is the best method?
 

Shar Dundred

Community Moderator
Level 73
Joined
May 6, 2009
Messages
5,921
JASS AI created with JassCraft is definitely the best method to create custom AI.

The tutorial you linked is, afaik, the best tutorial out there, currently.
Wanted to create a tutorial myself, but never really got to do it...

Anyway, in order to learn how to create JASS AI, I'd suggest using the MPQ Master
to open the war3.mpq/war3x.mpq and analyze the AI used by the campaign AI.
 
Level 4
Joined
Aug 26, 2015
Messages
71
JASS AI created with JassCraft is definitely the best method to create custom AI.

The tutorial you linked is, afaik, the best tutorial out there, currently.
Wanted to create a tutorial myself, but never really got to do it...

Anyway, in order to learn how to create JASS AI, I'd suggest using the MPQ Master
to open the war3.mpq/war3x.mpq and analyze the AI used by the campaign AI.

aF0O59n.png


Hi. Could you help me with this? Is it necessary to put spaces when you are going to add a command like "call .... "? The original campaign put spaces.
 
Level 4
Joined
Aug 26, 2015
Messages
71
You mean the spaces before the call command?
They are not really neccessary, but they allow a better overview.

The one after the call is, of course, very much needed.

Yeah. I meant the spaces before the call command. Thanks.
Could you help me with this problems, please?

1. On Warcraft 3 Original Campaign AI uses call SetBuildUnitEx( 0,0,1, TOWN_HALL ) call SetBuildUnitEx( 0,0,1, BLACKSMITH ) ... whatever structure. What does this functions do? I don't really understand them.

2. I noticed that, on Warcraft 3 Original Campaign AI, they don't start producing the units for sending to attack until some time. Does " call SuicideOnPlayerEx(M8,M8,M7,user)" set the time before they start producing the units?

For now I only have these questions hehehe. Thanks for your help man I really appreciate it :D
 

Shar Dundred

Community Moderator
Level 73
Joined
May 6, 2009
Messages
5,921
1) The "Ex" marks that the campaign difficulty has impacts on the AI behaviour. It means this:
On easy and normal, AI won't build Town Hall and Blacksmith (also not rebuild it), in hard it will.

2) By putting the units into the attacking group, AI will also build them for said attacks.
And yes, this function sets the time and the player to be attacked.
 
Level 4
Joined
Aug 26, 2015
Messages
71
1) The "Ex" marks that the campaign difficulty has impacts on the AI behaviour. It means this:
On easy and normal, AI won't build Town Hall and Blacksmith (also not rebuild it), in hard it will.

2) By putting the units into the attacking group, AI will also build them for said attacks.
And yes, this function sets the time and the player to be attacked.

Ohhh ok. So , in my case, they will rebuild them because the buildings are already created. Thanks! :p

If I need more help I'll let you know. Now I'll try to create my script to test.

I have a last question. On this:
d9LOGgK.png
, how do I "upload" my future AI script like they do?
 
Level 4
Joined
Aug 26, 2015
Messages
71
You're welcome.

Just use the Import Editor to add the. ai file, save the Map, use the action you already used on your picture and done.

Ok :D Done!

I have another question (I hope I'm not being annoying, I'm just learning this new commands :p), What does "SetReplacements" do? In the tutorial it says that it replaces "n" times the units that die, but in the Original Campaign is set: call SetReplacements(2,2,4) and when I kill a rifleman (on normal) the barracks doesnt train 2 riflemen, it only trains 1 rifleman. What does this function do then?
 

Shar Dundred

Community Moderator
Level 73
Joined
May 6, 2009
Messages
5,921
It replaces dying units (if you created a CampaignDefenderEx function for said unit) AND sends the newly trained units to the position of the killed unit.
The number sets the number of times the AI will send units to the position of killed units. Once these are exceeded, the AI will still train the units but won't send them to said position.
 
Level 4
Joined
Aug 26, 2015
Messages
71
It replaces dying units (if you created a CampaignDefenderEx function for said unit) AND sends the newly trained units to the position of the killed unit.
The number sets the number of times the AI will send units to the position of killed units. Once these are exceeded, the AI will still train the units but won't send them to said position.

So ... if the Campaign AI have set "call SetReplacements(2,2,4)" , they'll replace 2 times the call CampaignDefenderEx( 1,1,1, RIFLEMAN ) :S? When I kill a Rifleman on that episode, their barracks doesn't 2 riflemen... Is that a bug or I have misread something?
 

Shar Dundred

Community Moderator
Level 73
Joined
May 6, 2009
Messages
5,921
Let's presume:
- You set the call SetReplacements(2,2,4)
- You placed a unit on the map and start the game
- AI trains the unit one time
- You play on normal or easy

This is what happens:
-->The unit is getting killed
-->The AI will train a new unit and send it to the position of the dying unit. Only ONE unit
-->The unit is getting killed again
-->The unit will be replaced again
-->The unit on that position gets killed a third time
-->It won't be replaced anymore on normal or easy
-->On hard, it would continue like this for two more times
 
Status
Not open for further replies.
Top