Exclusive heroes for each player

Level 5
Joined
Jan 23, 2025
Messages
40
Hi! I need help with the following:

Players 1 and Player 2 can choose heroes in a tavern.

The tavern has 8 heroes. I want Player 1 to only have 4 heroes available to choose from, while Player 2 has a different selection of heroes. Thk!


For example, the tavern has these heroes:

AM TC
MK SH
BM FS
PALA DK

Player 1 can choose: AM, TC, PALA and DK
Plyer 2 can choose: MK, SH, BM, FS
 
You can leave all 8 heroes in the tavern and at map start change unit availability for each player to make specific heroes unavailable for them.
It is trigger action 'Player - Set Training/Construction Availability Of Unit'

Below trigger disables specific heroes for Player 1 (Red):
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player - Make Mountain King Unavailable for training/construction by Player 1 (Red)
      • Player - Make Shadow Hunter Unavailable for training/construction by Player 1 (Red)
      • Player - Make Blademaster Unavailable for training/construction by Player 1 (Red)
      • Player - Make Far Seer Unavailable for training/construction by Player 1 (Red)
 
Cool trick. But I want this in a different manner.

Is it possible to do this for the case of computer players so that they only train exclusive heroes in melee games?

Like computers with Orc race only training Tauren Chieftain, Shadow Hunter, and Blademaster, while Far Seer is skipped.
 
You can leave all 8 heroes in the tavern and at map start change unit availability for each player to make specific heroes unavailable for them.
It is trigger action 'Player - Set Training/Construction Availability Of Unit'

Below trigger disables specific heroes for Player 1 (Red):
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player - Make Mountain King Unavailable for training/construction by Player 1 (Red)
      • Player - Make Shadow Hunter Unavailable for training/construction by Player 1 (Red)
      • Player - Make Blademaster Unavailable for training/construction by Player 1 (Red)
      • Player - Make Far Seer Unavailable for training/construction by Player 1 (Red)
Thank you! Thank you for your time.
 
Not without custom AI scripts. Melee ai scripts call Doc - PickMeleeHero which determines which heroes are picked and in what order. You would need modified AI script that uses different logic for picking heroes.
Thanks. Actually, there's an old thread regarding this: How to make original AI choose a specific first hero
Specifically this comment:
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.

So, if you want to make AI hero train exclusive heroes every game based on the correct order, just replace this snippet in PickMeleeHero section:
JASS:
    set first  = GetRandomInt(1,last)
    set second = GetRandomInt(1,last-1)
    set third  = GetRandomInt(1,last-2)

With this one:
JASS:
    set first  = 1
    set second = 2
    set third  = 3

For the case of Human AI, that custom script will only will build an Archmage, Mountain King, and Paladin (in the following order) during that game. The value can be changed.

The PickMeleeHero function also contains the snippet where you can allow AI to train different heroes for different races, like allowing it to train neutral heroes.
 
Back
Top