• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Random Hero Trigger

Status
Not open for further replies.
Level 13
Joined
Mar 24, 2013
Messages
1,105
So, a while ago I asked for some help on a random hero trigger, and I used to form this one, but it still does not work as I intend it too. I want it to Random a Hero for all the players but I don't want anyone to be able to have the same hero. So what am I doing wrong? Thanks!

  • GameStart
    • Events
      • Player - Player 1 (Red) types a chat message containing -start as An exact match
    • Conditions
    • Actions
      • Set HeroTypeCount = 13
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) controller) Equal to User
              • ((Picked player) slot status) Equal to Is playing
            • Then - Actions
              • Player Group - Add (Picked player) to PlayerGroup
              • Set HeroType[1] = Half-Dragon
              • Set HeroType[2] = Lost Soul
              • Set HeroType[3] = Twilight Huntress
              • Set HeroType[4] = Sinister Seal
              • Set HeroType[5] = Ballista
              • Set HeroType[6] = Demolisher
              • Set HeroType[7] = Nature's Voice
              • Set HeroType[8] = Slicer
              • Set HeroType[9] = Keeper of the Grave
              • Set HeroType[10] = Pauer
              • Set HeroType[11] = Morg
              • Set HeroType[12] = Flying Bomber
              • Set HeroType[13] = MotherOfAll
              • Set RandomHeroInt = (Random integer number between 1 and HeroTypeCount)
              • Unit - Create 1 HeroType[RandomHeroInt] for (Picked player) at (Random point in Arena2 <gen>) facing Default building facing degrees
              • Hero - Set (Last created unit) Hero-level to 7, Hide level-up graphics
              • Unit - Make (Last created unit) Invulnerable
              • Selection - Add (Last created unit) to selection for (Picked player)
              • Camera - Pan camera for (Picked player) to (Position of (Last created unit)) over 1.00 seconds
              • Unit Group - Add (Last created unit) to RandomHero
              • Set HeroType[RandomHeroInt] = HeroType[HeroTypeCount]
              • Set HeroTypeCount = (HeroTypeCount - 1)
              • Countdown Timer - Start ArenaStartTimer as a One-shot timer that will expire in 1.00 seconds
              • Trigger - Turn on Arena start <gen>
              • Trigger - Turn off (This trigger)
            • Else - Actions
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
HeroType uses normal numbers not HeroTypeCount variable and needs to be outside the loop on top of everything else.

Your trigger currently will always go through all 13 hero variables no matter what.

I also suggest that you use unit-group with all the heroes inside, as you won't need to save them in variables and probably bug the pick.
 
Status
Not open for further replies.
Top