First off, you have to create two variables and a dummy unit.
Hero = Unit-Type Variable (select array and put 20)
HeroNumbers = Integer (set initial value to 20)
Dummy = Nothing special. Just create a wisp (for example) with no shadow and incredibly small, so that it's undetectable. It doesn't play much in these triggers anyway.
Now, let's make the triggers. You require two triggers in the next step.
Events:
Map Initializion
Conditions:
(None or you'll have to choose)
Actions:
Set Variable: Set Hero(1) to Archmage
Set Variable: Set Hero(2) to Paladin
Set Variable: Set Hero(3) to Mountain King
Trigger 2:
Events:
Generic Unit Event: A unit
Sells a unit
Conditions:
Unit-Type Comparison:
(Unit-Type of (Sold Unit)) Equal to Random Hero
Actions:
Create Units Facing Angle:
Create 1 Hero[(Random integer between 1 and HeroNumbers)] for
(Owner of (Sold Unit)) at
Location
Unit - Remove: Remove
(Sold Unit) from the game.
Etc. If you need more or less than 20 heroes, you can always change the array of Hero and the initial value of HeroNumbers to other value.
Good luck and have fun