How can I create a Random Hero Chooser?

Level 2
Joined
May 30, 2008
Messages
7
Ok, I'm makeing a map in WE.

As you guys probably have seen in the Tool Palette, the are two buttons "Random Unit" and "Random Building" to choose a random unit or building to appear where you put it.

So... I would like to know how can I make one of those buttons but for Heros. To be "Random Hero".

I would really apreciate your help guys. :ogre_haosis:
 

Dr Super Good

Spell Reviewer
Level 59
Joined
Jan 18, 2005
Messages
26,660
You can not.

You can however script a system to do that. Just make an array list of hero types and use a random index to get a random hero type from that. Then it is a mater of creating it where ever you want. Repeate for every random hero you need.

You may wish to increase level, give items and learn spells of them after doing this.
 

Chaosy

Tutorial Reviewer
Level 39
Joined
Jun 9, 2011
Messages
13,110
  • hero setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Hero[1] = Paladin
      • Set Hero[2] = Archmage
      • Set Hero[3] = Mountain King
      • Set Hero[4] = Blood Mage
      • Set Number_of_heros = 4
  • random hero trigger
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to random_hero_item
    • Actions
      • Item - Remove (Item being manipulated)
      • Set temp_point = (Position of (Triggering unit))
      • Unit - Create 1 Hero[(Random integer number between 1 and Number_of_heros)] for (Owner of (Triggering unit)) at temp_point facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_temp_point)
 
Level 4
Joined
Nov 24, 2010
Messages
61
  • hero setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Hero[1] = Paladin
      • Set Hero[2] = Archmage
      • Set Hero[3] = Mountain King
      • Set Hero[4] = Blood Mage
      • Set Number_of_heros = 4
  • random hero trigger
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to random_hero_item
    • Actions
      • Item - Remove (Item being manipulated)
      • Set temp_point = (Position of (Triggering unit))
      • Unit - Create 1 Hero[(Random integer number between 1 and Number_of_heros)] for (Owner of (Triggering unit)) at temp_point facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_temp_point)

The item should be rune and use trigger as spell trigger.
However I prefer a Locust Unit sold as Random Button.
 
Top