[Trigger] All Random Hero Picker

Level 3
Joined
Dec 20, 2008
Messages
19
Hello! Ive been trying to make a map, that you can have an option where you can hit a button and it will random a hero for you, Ive been looking through other threads and i cant seem to make one >_<, ive made one that when you click it, makes a random hero, but it doesnt work well because every time a unit aquires an item it spawned a hero. It worked like this
  • Heros blue
    • Events
      • Unit - A unit owned by Player 2 (Blue) Acquires an item
    • Conditions
      • (Picked item) Equal to (Item carried by (Buying unit) of type Random Hero)
    • Actions
      • Unit - Create 1 Random_Heros[(Random integer number between 1 and 93)] for Player 2 (Blue) at (Center of Random Hero 1 <gen>) facing Default building facing degrees
But whenever i picked up an item it would spawn an item, even though i conditioned it. My random hero code is this.

  • Human Random
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Random_Heros[1] = Paladin
      • Set Random_Heros[2] = Archmage
      • Set Random_Heros[3] = Mountain King
      • Set Random_Heros[4] = Blood Mage
      • Set Random_Heros[5] = Keeper of the Grove
      • Set Random_Heros[6] = Priestess of the Moon
      • Set Random_Heros[7] = Demon Hunter
      • Set Random_Heros[8] = Warden
Goes on for 93 heros

The random seed check is also unchecked.
I am confused on is not working....

Im trying to make an all random hero selector, that spawns a hero each time you buy it.
I also made an Item named "Random Hero"
I am also using regular WE if that helps
And here are my Variables:
Random_Heros = Unit-Type Array (1)

And these triggers made it whenever you aquire an item, you get a hero, how do i stop this? Plz help +rep for help, ty
 
Level 2
Joined
Mar 30, 2009
Messages
30
Shendoo is right. Don't take it the wrong way but i want to show you what you did XD

this is ok :
Unit - A unit owned by Player 2 (Blue) Acquires an item

but this
(Picked item) Equal to (Item carried by (Buying unit) of type Random Hero)

Picked item refers to item that is picked by pick every item action.

so you are basically comparing item that you did not pick with item that is (not necessarily ) carried by hero (who probably is buying that item without having another)

hope it explains so you don't do it again ;)
 
Level 13
Joined
Oct 27, 2008
Messages
1,176
Well heres some Things you can do instead (depends on if you fully want the item or not)
Without Item like most games
Here to go just change the unit created and add in the extra events for any other players you have and a place for them to spawn
Random Hero
  • Random Hero
    • Events
      • Player - Player 1 (Red) types a chat message containing Hero as An exact match
    • Conditions
      • Hero[(Player number of (Triggering player))] Equal to False
    • Actions
      • Unit - Create 1 Footman for (Triggering player) at (Center of (Playable map area)) facing Default building facing degrees
      • Set Hero[(Player number of (Triggering player))] = True
I was even nice enough to make a quick repick trigger for you :D
  • Repick
    • Events
      • Player - Player 1 (Red) types a chat message containing repick as An exact match
    • Conditions
      • Hero[(Player number of (Triggering player))] Equal to True
    • Actions
      • Set Hero[(Player number of (Triggering player))] = False
      • Trigger - Run Random Hero <gen> (checking conditions)
you just need a Variable
Boolean = False
Boolean Array = # of players



Just change the Item in the Condition and the Unit being made
  • Untitled Trigger 001
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item being manipulated) Equal to (Item carried by (Last created unit) of type Tome of Experience)
    • Actions
      • Item - Remove (Item being manipulated)
      • Unit - Create 1 Footman for (Owner of (Item being manipulated)) at (Center of (Playable map area)) facing Default building facing degrees
 
Top