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

Random Hero Bug.

Status
Not open for further replies.
Level 3
Joined
May 30, 2012
Messages
29
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
Joined
Jan 26, 2007
Messages
4,789
You can actually post triggers quite easily here on the hive (as well as show images, but just showing triggers directly is way easier).

Write:
[trigger]

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


[trigger]Time15
Events
Time - Elapsed game time is 15.00 seconds
Conditions
Actions
Trigger - Turn on ManualHeroL
[/trigger]

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)
[/hidden]

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).
 
Status
Not open for further replies.
Top