• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Solved] All Random

Status
Not open for further replies.

SpizZ

S

SpizZ

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.
 
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.
 
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.
 
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.
Back
Top