• 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.

[Solved] All Random

Status
Not open for further replies.
Level 2
Joined
May 17, 2011
Messages
10
Hello guys! I have been making a map and I am having problem with the trigger where everyone gets a random hero when host types a command. If anyone can help me I will really appreciate it. I've been looking in the tutorial section but I didn't find anything.
 
Level 2
Joined
May 17, 2011
Messages
10
Hello guys! I have been making a map and I am having problem with the trigger where everyone gets a random hero when host types a command. If anyone can help me I will really appreciate it. I've been looking in the tutorial section but I didn't find anything.
 
Level 2
Joined
May 17, 2011
Messages
10
I get some parts but the others are new to me. I don't have much knowledge with triggers.. Maybe if you have time can you do me an example with only 2 chars, so I can understand how it works :?
 
I don't have time.

... Here you go :>

  • Init
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • Set Heroes[1] = Paladin
      • Set Heroes[2] = Mountain King
  • AR
    • Events
      • A player types -ar as an exact match
    • Conditions
    • Actions
      • For each (Integer A) from 1 to NUMBER_OF_PLAYERS, do (Actions)
        • Loop - Actions
          • Unit - Create Heroes[(Random integer between 1 and 2)] for Player(Integer A) bla bla bla
That's what it should look like.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Here you go. It's just about as unspecific as you specified.

Unspecific Choosing of Random Heroes said:
JASS:
library RandomHero initializer init
globals
	// this is the array of raw-codes for the heroes you want
	public integer array HERO_ID
endglobals


// returns the integer ID of the hero to be used to create the unit
public function ChooseHeroRandom takes nothing returns integer 
	local integer index = GetRandomInt(0, 3)
	return HERO_ID[index]
endfunction


public function init takes nothing returns nothing
	// setup hero ID array
	set HERO_ID[0] = 'Hpal'	// this should be the Paladin raw-code
	set HERO_ID[1] = 'Oblm' // this should be the Blademaster raw-code
	set HERO_ID[2] = 'Hmkg' // this should be the Mountain King raw-code
	set HERO_ID[3] = 'Otch' // this should be the Tauren Chieftain raw-code
endfunction
endlibrary

- Oh no. You beat me to it.
 
Last edited:
Status
Not open for further replies.
Top