• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How to make a Campaign AI

Level 19
Joined
Apr 25, 2006
Messages
1,309
AI - Send Player 2 (Blue) the AI Command (0, 0)
Custom script: call DestroyTrigger( GetTriggeringTrigger() )

Why is there (0,0) command? Why not only 0 if this is what the AI receives when the trigger is run?
What does destroytrigger do?

Is there a way to make the campaign AI build expansions?? Any other useful commands or something for campagn AIs?
 
Level 15
Joined
Feb 15, 2006
Messages
851
AI - Send Player 2 (Blue) the AI Command (0, 0)
Custom script: call DestroyTrigger( GetTriggeringTrigger() )

Why is there (0,0) command? Why not only 0 if this is what the AI receives when the trigger is run?
What does destroytrigger do?
This trigger is used as a communication between the AI and the trigger part, and the main purpose of this is to control what the AI can do according to the events in the map. About the values, there are not default data, you set your values as you need in the AI code.

Why is there (0,0) command?? I think Blizzard did this because they can send pair of data to the AI (coordinates for instance), but you can use this feature to make an order table, something like this:

Command valueData valueAction
10Attack Player(0) (Player 1 in GUI)
11Attack Player(1) (Player 2 in GUI)
1...And so on with attack
24Train 4 specific units for the assault group

As you can see, you can give a good usage of this command, and make the AI react better according to the situation, and you can do this by triggers.

Is there a way to make the campaign AI build expansions?? Any other useful commands or something for campagn AIs?
Yes, there is one command for that: StartExpansion(qty, Hall) where qty is the number of expansions you need and Hall is the building rawcode. I haven't tested this function, but according with the data inside that command, it selects a worker and start the expansion if needed. If you want to see more functions, check the common AI file, or use JASSCRAFT and browse the common.ai commands. Other good way to learn about these functions is to make an AI, export it as a *.ai file and check how the code is.
 
Top