- Joined
- Jun 7, 2016
- Messages
- 21
i currently have both a custom race and a custom AI, may i know how to i use a custom AI for a Campaign
i am new at this, just started with AI editing.
i am new at this, just started with AI editing.
You need to export the AI script in the AI editor and import that script into your map. Then you can use
to start the AI for a player
AI - Start campaign AI script for Player 2 (Blue): importedAIscript
You should use Map Initialization as event, as your event will fire multiple times.
"n00M:nbal" //this is a string
'n00M' //this is a raw code
function main takes nothing returns nothing
call CampaignAI (<"u004:unp2">, function hero_levels)
call ConfigureAI()
local integer cmd // <==Only set it if you are going to use the option 2
... // Your building code here
// Option 1
call WaitForSignal() // <== Just waits until the map sends a command
A few things I noticed:
the player is player 2, but player 1 is set as victim in the ai script.
you have several triggers with the event map initialization, that are connected and need to run in a certain order to work:
Burning Legion AI Attack has to run after Name, because it uses the variable that is set in Name
you can usein Name to run Burning Legion AI Attack and remove the event from Burning Legion AI Attack.
Trigger - Run Burning Legion AI Attack <gen> (checking conditions)
the raw codes in your ai script are wrong:
Doomguard: you use "n00M:nbal", but you need to use 'n00M'. Raw codes consist of 4 characters and are marked with these ' '
With a syntax highlighter it looks like this:
The hero abilities also need to be surrounded by ' ' and not " ".JASS:"n00M:nbal" //this is a string 'n00M' //this is a raw code
There are syntax errors in your AI script:
local variables may only be declared at the top of the function, so no "set", "call", "if" or any other similar keyword before all localsJASS:function main takes nothing returns nothing call CampaignAI (<"u004:unp2">, function hero_levels) call ConfigureAI() local integer cmd // <==Only set it if you are going to use the option 2 ... // Your building code here // Option 1 call WaitForSignal() // <== Just waits until the map sends a command
the ... before the // will also cause a syntax error. Either remove them or put them behind the //
I can't say for sure, that the AI will work, if you fix these, but you are getting it closer to work.