• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Random Hero Bug.

Not open for further replies.
Level 3
May 30, 2012
Hi, i have a Trigger "Manual Hero".
My map only have 22 heros.
but i have a problem, when players decide wait to pick random hero,

One player decide random but other decide pick hero, for example he pick Mountain King, but the random of the other player is Mountain King too.
So team have 2 same heros

This is a bug. how if exist 22 heros. can pick 2 same heros?

This is the Trigger, Told me what do plz.

View attachment Trigger.rar
Level 28
Jan 26, 2007
You can actually post triggers quite easily here on the hive (as well as show images, but just showing triggers directly is way easier).


Then just simply right-click the trigger name above "Events", select "Copy as Text" and paste it between those codes.

Time - Elapsed game time is 15.00 seconds
Trigger - Turn on ManualHeroL

This exact code becomes:

  • Time15
    • Events
      • Time - Elapsed game time is 15.00 seconds
    • Conditions
    • Actions
      • Trigger - Turn on ManualHeroL
As you can see, long triggers can also be hidden with these tags:

[hidden="Some Text"]
(Write anything here)

Very easy for showing triggers to other people without them having to open images or anything, just click the "Show"-button for the hidden-tags and then they can copy/paste any line (to point out errors for example).

So what I understand is that you can only have 1 hero at the same time on the map (no doubles).
Because the images are kind-of confusing (I don't know which images belong to which trigger), I can only tell you a method on how to achieve this.

So you've got 22 heroes, this amount is stored in the variable "RandomCount".
Every hero type is stored into the unit-type variable "HeroType" (array).
The variable "RandomHero" decides which hero has been chosen for a player.

When a unit is picked/randomed, you can do this:
  • Set HeroType[RandomHero] = HeroType[RandomCount]
  • Set RandomCount = RandomCount - 1
So if there were 22 heroes and number 8 gets chosen.
Then HeroType[8] = HeroType[22] (this means that HeroType[8], the chosen hero, can now never be randomed again as it has been overwritten).
And then the array goes from 1 to 21 (otherwise you'd have a higher chance to get the hero in the last array).
Not open for further replies.