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 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).
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: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
PickMeleeHero
in this page.Why don't you test it? That does not affect the default race AIs of the game.Umm I'm no expert on custom melee AI, but isn't this like what the entire "hero" section is about when you make one?
View attachment 327449