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

Trigger Help

Status
Not open for further replies.
Level 2
Joined
Jul 29, 2009
Messages
12
I need Help With a trigger: So i am making an arena which has a few confusing triggers, I have everything except a failsafe too ensure that the random hero(that is picked to go into the arena) isn't picked twice. So basically this is what i got for the random pick:
  • if (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • if - Conditions
      • (Owner of (Dying unit)) Equal to player 12 (Brown)
      • Randomhero Equal to 12
    • Then - Actions
      • Unit - Move (Dying unit) instantly to (Random point in Arena <gen>)
    • Else - Actions
      • Do nothing
I made it so it kills the heroes and they basically re spawn in the arena.
What would i do to make it so it wouldn't pick the same (Dying hero) twice
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
Create a pool of heroes (group, array, go nuts as long as it holds units). Every time you pick a random hero from it you simply remove a hero from it. Thus the next time a hero is picked it can not be the same hero as picked last time due to them being remove from it. Just remember to add the heroes back to the pool when appropiate.

I advise the use of an array, as getting random elements is far more efficent than if you were to use a group.
 
Status
Not open for further replies.
Top