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!
I am trying to tinker with the Blizzard AI for melee map. Is there any way to make the AI go the same first hero every game (ie, Archmange for Human, Death Knight for UD)?
I'm not familiar with AI, but @Nowow could probably answer this. I would bet that if you manually disable all other heroes for that computer player it would work. Just remember to re-enable the other heroes for the AI players after the AI has trained their first hero.
Player Group - Pick every player in (All players) and do (Actions)
Loop - Actions
If (All conditions are true) then do (Then actions) else do (Else actions)
If - Conditions
(Picked Player) controller equal to Computer
Race of (Picked Player) equal to Human
Then - Actions
Player - Make Paladin Unavailable for training/construction by (Picked player)
Player - Make Mountain King Unavailable for training/construction by (Picked player)
Player - Make Blood Mage Unavailable for training/construction by (Picked player)
Else - Actions
If (All conditions are true) then do (Then actions) else do (Else actions)
If - Conditions
(Picked Player) controller equal to Computer
Race of (Picked Player) equal to Undead
Then - Actions
Player - Make Lich Unavailable for training/construction by (Picked player)
Player - Make Dreadlord Unavailable for training/construction by (Picked player)
Player - Make Crypt Lord Blood Mage Unavailable for training/construction by (Picked player)
I bet you would prevent AI from making any heroes that way (unless it randomly picks the hero order which only enabled hero is the first one). Just open up the AI editor, go to the heroes tab and set the chance of hero order you want to 100 percent.
Clearly setting an order in the AI editor is better, but I don't see any reason what you stated would be the case. The melee AI builds things it has access to and doesn't build things it doesn't. Enabling/disabling training units is like not meeting the requirements; the AI knows it can build a Tauren Totem when it has a Stronghold but not before. Melee AI is incentivized to build a hero; if you take away the other options it will do what it's left with reliably.
I just tested your method just to make sure, and as expected its not working. Because the way AI chooses hero is it generates a set of random integers and determines the order of trained heroes from a fixed array by using these random integers. I think if all you need is change order of trained heroes, easiest way (that I know) is to import a custom common.ai file with changed PickMeleeHero function. It is included in attached map, all you need to do is import that common.ai to your melee map and change its path to common.ai in import editor. You can also further edit PickMeleeHero function if you want different your ai to train different heroes for different races.
Melee AI decides in what order to choose heroes at the start of the map, using the function called PickMeleeHero, called directly from the script. If you want to make sure to always choose the same heroes, find the melee AI script file you need, and replace PickMeleeHero with a function like:
JASS:
function PredefinedPickHeroes takes nothing returns nothing
set hero_id = 'u001' //unit is for first hero here
set hero_id2 = 'u002' // same for 2nd hero
set hero_id3 = 'u003' // 3rd
return hero_id
endfunction
Note that this will work for only one race. If you want it to work for all races change the function to take a race type argument, and choose heroes accordingly. You can see how it works for PickMeleeHero in this page.
Incidentally, @Pyrogasm 's solution would work for normal units, but doesn't work for heroes, because the AI doesn't detect if the unit it wants to train is actually being trained. Also, the AI awaits for a hero to actually finish training to start creeping, so disabling the ability to train the first hero will make sure the AI is stuck forever.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.