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

Random Button

Status
Not open for further replies.
Your standard random selection trigger.

Create an integer array and fill it with the hero types available.
Then just choose a random index from it and ceate that hero type.

That easy.

For finite choice of heroes, simply remove them from the array.

ive noticed one thing when i did like this... if i in the first map choose random FIRST of all players, and i get for example blademaster, i will get blademaster if i pick random first too the next time i play,
or if i use the random integer to just set a integer variable to a number, it will be the same number every game i play...
 
Your standard random selection trigger.

Create an integer array and fill it with the hero types available.
Then just choose a random index from it and ceate that hero type.

That easy.

For finite choice of heroes, simply remove them from the array.

I want to do this for units, not heroes.

Also, how do I form it into a trigger (GUI) after I create the variable?
 
ive noticed one thing when i did like this... if i in the first map choose random FIRST of all players, and i get for example blademaster, i will get blademaster if i pick random first too the next time i play,
or if i use the random integer to just set a integer variable to a number, it will be the same number every game i play...

To prevent that, simply test the map, quit the game, save the map, close WE, open WE, open your map, test again.
 
OFFTOPIC WARNING: didnt work, in my map i was using random spawn places for all players when he choosed his hero, like this
event:
A unit enters Herochosen <gen>
condition:
Triggering unit is a hero equal to true
actions:
Set temppoint = random point in playable map area
Move entering unit to temppoint
call Removelocation( temppoint )


I tested alone and the first hero i created was going into a river unable to move (sadly enough but it doesnt matter now) and the second one almost in the middle of the map. the next time i tested it (the next day so i restarted) the first one spawned in the river again and the second one in the middle
 
There's an option in the editor called "Used Fixed Random Seed". I'm not entirely sure, but I was always told to turn this option off, and I've never encountered this 'same value from a random generator' problem since I turned it off.

It's in the Editor Preferences I think.
 
Status
Not open for further replies.
Back
Top