Various Hero Selection Systems and How They Work
In this tutorial I'm going explain many of the methods for hero selection.
Index-
1 · Next / Previous Hero Viewing
2 · Dialog Menu Selection
3 · Using a Unit and Circles of Power
4 · Hero Taverns
5 · Clicking and Doubleclicking
6 · Random Hero
1 - Next / Previous Hero Viewing
Difficulty:
Moderate
Note: This is not a good idea if you have more than 8-12 heroes.
This is not a very common method of hero selection. In fact, I've only ever seen it used in the Blizzard map Azeroth Grand Prix. I used it myself in one of my maps.
Essentially what this system entails is having a unit that has several abilities; Next, Previous, and an ability with the icon of the Hero. When you click Next, it locks your camera to the next hero in line, and when you click Previous it locks your camera to the previous hero. Then when you click the ability with the Hero's icon, it selects that hero.
Variables:
- HeroSelector - Unit Array Variable - Size 12
- HeroSelectAbil - Ability Array Variable - Size 12
(Initial Value set to your first hero)
- L - Point Variable
Abilities:
- You will need an ability for every hero. The ability should be named after the hero and should have the same icon as the hero.
- Next - Should be based off an ability easily modified to do nothing.
- Previous - Should be based off an ability easily modified to do nothing, but should not be based off the same ability as "Next."
Units:
- You will need one of each of your heroes (preferably in a line) owned by Neutral Passive.
- You will need one Hero Selector unit for each player. Should have the Abilities Next, Previous, and the ability corresponding to the first hero.
Triggers:

View Previous

Actions
[trigger] Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Previous [/code]
Runs this trigger when an ability is cast, but only if it is the "Previous" Ability.

Unit - Remove HeroSelectAbil[(Player number of (Owner of (Triggering unit)))] from (Triggering unit)
Removes the ability that is assigned to HeroSelectAbil for that player.

If - Conditions


HeroSelectAbil[(Player number of (Owner of (Triggering unit)))] Equal to Dwarves

Then - Actions
This checks if the HeroSelectAbil variable is set to the Dwarves ability. If it is, it sets it to the Panda ability, Locks the camera to the Panda unit, and adds the Panda ability to the unit.

Skip remaining actions
This is in there to make sure that it doesn't continue the function.
The rest of the trigger is repetitive, and does not need to be explained.

View Next
As you can tell, the Next trigger is just the same as the Previous trigger, in reverse.

Pick Cart
This trigger creates the unit corresponding to the clicked ability.

Conditions
Checks if the triggering unit is the Hero Selection unit and if the cast Ability is any of the abilities corresponding to the heroes.

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Checks if the ability being cast is the ability corresponding to the Bonez hero. If it is, it creates 1 Bonez at a random point in the Team1Spawn region.
Note: "Set L = ..." and "call RemoveLocation(udg_L)" are used to avoid a memory leak in this trigger.
Last but not least you'll want to have a trigger that sets the Hero Selectors.

HeroSelectors
This sets the HeroSelector variables according to their arrays. "HeroSelector[1]" is set to Red's Hero Selector unit, "HeroSelector[2]" is set to Blue's, etc..
2 - Dialog Button Selection
Difficulty:
Easy
This is a fairly easy to create and very easy to comprehend method. It only requires two triggers, and only a few variables.
Variables:
- Dialog_Var - Dialog Variable
- Hero1_Var - Dialog Button Variable
- Hero2_Var - Dialog Button Variable
- You must create a Dialog Button Variable for each of the Dialog Buttons.
Triggers:

Dialog

Dialog - Change the title of Dialog_Var to Pick your Hero
Changes the title of the Dialog_Var variable to "Pick your Hero." This is what will be displayed at the top of the menu.

Dialog - Create a dialog button for Dialog_Var labelled Hero 1


Set Hero1_Var = (Last created dialog Button)
Puts a dialog button on the menu labeled "Hero 1" This is what will be displayed on the button itself. Then it sets the Hero1_Var variable to the button that was just created. You need to set the variable so that you can reference it later.
Now you need this trigger to register when a button is clicked, and what button it was:

ClickedButton

If - Conditions


(Clicked dialog button) Equal to Hero1_Var

Then - Actions


Unit - Create 1 Mountain King for (Triggering player) at (Center of (Playable map area)) facing Default building facing degrees
Creates a Mountain King if the clicked button was the Hero1_Var button.