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

Hero Picking System help

Status
Not open for further replies.
Level 3
Joined
Nov 2, 2020
Messages
28
Ok i created a map with a ai choosing its own hero, But the problem is sometimes there can be two heroes at the same time and I only want to limit it to 1 type only, can somebody make a map for it? :(
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,869
Not 100% sure what you mean but here's 2 possible solutions:

To stop the AI from training 2 of the same Hero (like 2 Mountain Kings) then you need to run this action:
  • Melee Game - Limit Heroes to 1 per Hero-type (for all players)
Note that this applies to ALL players.


Or maybe you want something like this:
  • Player - Limit training of Heroes to 1 for Player 1 (Red)
This will prevent the Player from training more than 1 Hero.
 
Level 3
Joined
Nov 2, 2020
Messages
28
Heres The Trigger. But It sometimes pick the same hero. is there any way to fix this?
  • AI Spawn Unit SAFE MODE
    • Events
      • Time - Elapsed game time is 15.00 seconds
    • Conditions
    • Actions
      • Set HeroType[1] = Keeper of the Grove
      • Set HeroType[2] = Priestess of the Moon
      • Set HeroType[3] = Demon Hunter
      • Set HeroType[4] = Stealth Assasin
      • Set HeroType[5] = Paladin
      • Set HeroType[6] = Archmage
      • Set HeroType[7] = Mountain King
      • Set HeroType[8] = Alchemist
      • Set HeroType[9] = Naga Sea Witch
      • Set HeroType[10] = Tinker
      • Set HeroType[11] = Centaur Warchief
      • Set HeroType[12] = Drow Ranger
      • Set HeroType[13] = Blood Mage
      • Set HeroType[14] = Juggernaut
      • Set HeroType[15] = Far Seer
      • Set HeroType[16] = Cries of Pain
      • Set HeroType[17] = Shadow Shaman
      • Set HeroType[18] = Death Knight
      • Set HeroType[19] = Demon Witch
      • Set HeroType[20] = Dreadlord
      • Set HeroType[21] = Nerubian Crypt
      • Set HeroType[22] = Firelord
      • Set HeroType[23] = Pandaren Brewmaster
      • Set HeroType[24] = Slithereen Guard
      • Set HeroType[25] = Undead Assasin
      • Set HeroType[26] = Crystal Maiden
      • Set HeroType[27] = Pink Cat
      • Set HeroType[28] = Sea Weaver
      • Set HeroType[29] = Phantom Assasin
      • Set HeroType[30] = Dryad
      • Set HeroType[31] = Keeper of the Nature
      • Set HeroType[32] = Lich
      • Set HeroType[33] = Void Walker
      • Set HeroType[34] = Slayer
      • Set HeroType[35] = Faceless Void
      • Set HeroType[36] = Destroyer
      • Set HeroType[37] = Nightcrawler
      • Set HeroType[38] = Void Reaver
      • Set HeroType[39] = V
      • Set HeroType[40] = Queen of Pain
      • Set HeroType[41] = ExecutorTest
      • Player Group - Pick every player in AI_Players and do (Actions)
        • Loop - Actions
          • Set TOTALHEROES = -1
          • Set HEroChoosenLast[1] = (Last created unit)
          • Set TempPoint = ((Picked player) start location)
          • Unit - Create 1 HeroType[(Random integer number between 1 and 41)] for (Picked player) at TempPoint facing (Random angle) degrees
          • Player - Make (Unit-type of HEroChoosenLast[1]) Unavailable for training/construction by Player 1 (Red)
          • Player - Make (Unit-type of HEroChoosenLast[1]) Unavailable for training/construction by Player 2 (Blue)
          • Player - Make (Unit-type of HEroChoosenLast[1]) Unavailable for training/construction by Player 3 (Teal)
          • Player - Make (Unit-type of HEroChoosenLast[1]) Unavailable for training/construction by Player 4 (Purple)
          • Player - Make (Unit-type of HEroChoosenLast[1]) Unavailable for training/construction by Player 5 (Yellow)
          • Player - Make (Unit-type of HEroChoosenLast[1]) Unavailable for training/construction by Player 7 (Green)
          • Player - Make (Unit-type of HEroChoosenLast[1]) Unavailable for training/construction by Player 8 (Pink)
          • Player - Make (Unit-type of HEroChoosenLast[1]) Unavailable for training/construction by Player 9 (Gray)
          • Player - Make (Unit-type of HEroChoosenLast[1]) Unavailable for training/construction by Player 10 (Light Blue)
          • Player - Make (Unit-type of HEroChoosenLast[1]) Unavailable for training/construction by Player 11 (Dark Green)
          • Player - Limit training of (Unit-type of HEroChoosenLast[1]) to 0 for Player 1 (Red)
          • Player - Limit training of (Unit-type of HEroChoosenLast[1]) to 0 for Player 2 (Blue)
          • Player - Limit training of (Unit-type of HEroChoosenLast[1]) to 0 for Player 3 (Teal)
          • Player - Limit training of (Unit-type of HEroChoosenLast[1]) to 0 for Player 4 (Purple)
          • Player - Limit training of (Unit-type of HEroChoosenLast[1]) to 0 for Player 5 (Yellow)
          • Player - Limit training of (Unit-type of HEroChoosenLast[1]) to 0 for Player 7 (Green)
          • Player - Limit training of (Unit-type of HEroChoosenLast[1]) to 0 for Player 8 (Pink)
          • Player - Limit training of (Unit-type of HEroChoosenLast[1]) to 0 for Player 9 (Gray)
          • Player - Limit training of (Unit-type of HEroChoosenLast[1]) to 0 for Player 10 (Light Blue)
          • Player - Limit training of (Unit-type of HEroChoosenLast[1]) to 0 for Player 11 (Dark Green)
          • Trigger - Turn on (This trigger)
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Player - Set name of (Picked player) to (Name of (Last created unit))
          • Multiboard - Set the text for AI_MultiBoard item in column 1, row (Player number of (Picked player)) to (Name of (Picked player))
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,869
What you want to do is set whichever Hero is chosen to be equal to the last Hero in the Array. Then you reduce the Array Size by 1.

For example:
Hero[1] = Archmage
Hero[2] = Mountain King
Hero[3] = Paladin
Hero[4] = Blood Mage
ArrayTotal = 4

Then let's say Hero[2] is chosen which is the Mountain King:

First you Set Hero[2] = Hero[ArrayTotal]
Then you subtract 1 from ArrayTotal --> ArrayTotal = ArrayTotal - 1

Now the Array looks like this:
Hero[1] = Archmage
Hero[2] = Blood Mage
Hero[3] = Paladin
ArrayTotal = 3

So the Mountain King was chosen and pushed out of the Array.

Finally you need to adjust your trigger so that it picks a random number from 1 to ArrayTotal instead of 1 to 41.


Also, you're setting HeroChosenLast before you create the Hero. This should be Set AFTER you create the Hero, otherwise it won't be set to anything.
 
Last edited:
Status
Not open for further replies.
Top