• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Random Hero Pick System

Status
Not open for further replies.
Level 6
Joined
Jul 13, 2007
Messages
173
Hello Everyone!:grin: i got a bit of trouble here. in my map i want so that you can Pick a random hero either by game mode all random, or by buying a random unit. i have been trying to make this, but yeah it didnt turn out to well. can anyone here lead me to a tutorial or system on this site or another? or post the code for such a system here. all help will be appreciated.
 
Level 5
Joined
Apr 8, 2008
Messages
88
As DarkAngelAzazel allready said, you first should create a unit variable that stores every possible hero.

  • Set the Values
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Heroes[1] = Paladin
      • Set Heroes[2] = Archmage
      • Set Heroes[3] = Mountain King
      • Set Heroes[4] = Blood Mage
-AR command

  • With command
    • Events
      • Player - Player 1 (Red) types a chat message containing -AR as An exact match
    • Conditions
      • Has_Heroes Equal to 0
    • Actions
      • Set Has_Heroes = 1
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Heroes[(Random integer number between 1 and 4)] for (Picked player) at ((Picked player) start location) facing Default building facing degrees
When you buy a "random unit"

Then you have to create a dummy unit that you buy, but when it enters the map it gets removed while it spawns a random hero for that player.

  • when you buy one
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • Unit - Remove (Triggering unit) from the game
      • Unit - Create 1 Heroes[(Random integer number between 1 and 4)] for (Owner of (Triggering unit)) at ((Owner of (Triggering unit)) start location) facing Default building facing degrees
I made so the heroes are created at the startlocation of the players, but you can change that if you'd like to :thumbs_up:
 
Status
Not open for further replies.
Top