• 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 (Spell request, i guess)

Status
Not open for further replies.
Level 6
Joined
Jun 11, 2009
Messages
151
Well in my map I am using spells to pick Heroes.


I want the spell to Random(I know how to do it) but when i created it i couldn't figure out how to make sure no other players had the random hero so there wouldn't be 2 of the same heroes. >< some one wanna help me out?

+rep
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
  • Untitled Trigger 086 Copy
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Set Unit_Type_Array_1[0] = Paladin
      • Set Unit_Type_Array_1[1] = Archmage
      • Set Unit_Type_Array_1[2] = Mountain King
      • Set Unit_Type_Array_1[3] = Blood Mage
      • Set Unit_Type_Array_1[4] = Blademaster
      • Set Unit_Type_Array_1[5] = Far Seer
      • Set Unit_Type_Array_1[6] = Tauren Chieftain
      • Set Unit_Type_Array_1[7] = Shadow Hunter
  • Untitled Trigger 001 Copy Copy
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
      • UnitTypeCounter Less than 8
    • Actions
      • Set Temp_Integer_1 = (Random integer number between 0 and 7)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Unit_Type_Array_1[Temp_Integer_1] Not equal to No unit-type
        • Then - Actions
          • Unit - Create 1 Unit_Type_Array_1[Temp_Integer_1] for Player 1 (Red) at (Center of Region 000 <gen>) facing Default building facing degrees
          • Set Unit_Type_Array_1[Temp_Integer_1] = No unit-type
          • Set UnitTypeCounter = (UnitTypeCounter + 1)
        • Else - Actions
          • Trigger - Run Untitled Trigger 001 Copy Copy <gen> (ignoring conditions)
Modify this. Fix the location leak.
 
Level 6
Joined
Nov 16, 2009
Messages
161
This setups up the random heroes.
  • Setup Random Heroes
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Melee Init --------
      • Melee Game - Use melee time of day (for all players)
      • Melee Game - Limit Heroes to 1 per Hero-type (for all players)
      • -------- Set up Random Hero Array --------
      • Set RANDOM_HERO_ARRAY[1] = Paladin
      • Set RANDOM_HERO_ARRAY[2] = Archmage
      • Set RANDOM_HERO_ARRAY[3] = Tauren Chieftan
      • Set RANDOM_HERO_ARRAY[4] = Blood Mage
      • Set RANDOM_HERO_ARRAY[5] = Blademaster
      • Set RANDOM_HERO_ARRAY[6] = Far Seer
      • Set RANDOM_HERO_ARRAY[7] = Mountain King
      • Set RANDOM_HERO_ARRAY[8] = Shadow Hunter
      • Set RANDOM_HERO_ARRAY[9] = Death Knight
      • Set RANDOM_HERO_ARRAY[10] = Lich
      • Set RANDOM_HERO_ARRAY[11] = Dread Lord
      • Set RANDOM_HERO_ARRAY[12] = Crypt Lord
      • Set RANDOM_HERO_ARRAY[13] = Keeper of the Grove
      • Set RANDOM_HERO_ARRAY[14] = Priestess of the Moon
      • Set RANDOM_HERO_ARRAY[15] = Demon Hunter
      • Set RANDOM_HERO_ARRAY[16] = Warden
      • Set NUM_HEROES = 46
This triggers to give the heroes.
  • All Random
    • Events
      • Player - Player 1 (Red) types a chat message containing -ar as An exact match
    • Conditions
    • Actions
      • Trigger - Run AR <gen> (ignoring conditions)
      • Wait 0.01 seconds
      • Trigger - Turn off (This trigger)
And this will give the heroes.
  • AR
    • Events
    • Conditions
    • Actions
      • Game - Display to (All players) for 21.00 seconds the text: ...
      • Wait 0.05 seconds
      • Unit - Create 1 RANDOM_HERO_ARRAY[(Random integer number between 1 and NUM_HEROES)] for Player 1 (Red) at (Player 1 (Red) start location) facing Default building facing degrees
      • If ((Player 1 (Red) slot status) Equal to Is playing) then do (Hero - Create Scroll of Town Portal and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 1 (Red) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 1 (Red) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • Player - Add -1900 to Player 1 (Red) Current gold
      • Wait 0.05 seconds
      • If ((Player 2 (Blue) slot status) Equal to Is playing) then do (Unit - Create 1 RANDOM_HERO_ARRAY[(Random integer number between 1 and NUM_HEROES)] for Player 2 (Blue) at (Player 2 (Blue) start location) facing Default building facing degrees) else do (Do nothing)
      • If ((Player 2 (Blue) slot status) Equal to Is playing) then do (Hero - Create Scroll of Town Portal and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 2 (Blue) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 2 (Blue) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • Player - Add -1900 to Player 2 (Blue) Current gold
      • Wait 0.05 seconds
      • If ((Player 3 (Teal) slot status) Equal to Is playing) then do (Unit - Create 1 RANDOM_HERO_ARRAY[(Random integer number between 1 and NUM_HEROES)] for Player 3 (Teal) at (Player 3 (Teal) start location) facing Default building facing degrees) else do (Do nothing)
      • If ((Player 3 (Teal) slot status) Equal to Is playing) then do (Hero - Create Scroll of Town Portal and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 3 (Teal) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 3 (Teal) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • Player - Add -1900 to Player 3 (Teal) Current gold
      • Wait 0.05 seconds
      • If ((Player 4 (Purple) slot status) Equal to Is playing) then do (Unit - Create 1 RANDOM_HERO_ARRAY[(Random integer number between 1 and NUM_HEROES)] for Player 4 (Purple) at (Player 4 (Purple) start location) facing Default building facing degrees) else do (Do nothing)
      • If ((Player 4 (Purple) slot status) Equal to Is playing) then do (Hero - Create Scroll of Town Portal and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 4 (Purple) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 4 (Purple) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • Player - Add -1900 to Player 4 (Purple) Current gold
      • Wait 0.05 seconds
      • If ((Player 5 (Yellow) slot status) Equal to Is playing) then do (Unit - Create 1 RANDOM_HERO_ARRAY[(Random integer number between 1 and NUM_HEROES)] for Player 5 (Yellow) at (Player 5 (Yellow) start location) facing Default building facing degrees) else do (Do nothing)
      • If ((Player 5 (Yellow) slot status) Equal to Is playing) then do (Hero - Create Scroll of Town Portal and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 5 (Yellow) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 5 (Yellow) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • Player - Add -1900 to Player 5 (Yellow) Current gold
      • Wait 0.05 seconds
      • If ((Player 6 (Orange) slot status) Equal to Is playing) then do (Unit - Create 1 RANDOM_HERO_ARRAY[(Random integer number between 1 and NUM_HEROES)] for Player 6 (Orange) at (Player 6 (Orange) start location) facing Default building facing degrees) else do (Do nothing)
      • If ((Player 6 (Orange) slot status) Equal to Is playing) then do (Hero - Create Scroll of Town Portal and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 6 (Orange) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 6 (Orange) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • Player - Add -1900 to Player 6 (Orange) Current gold
      • Wait 0.05 seconds
      • If ((Player 7 (Green) slot status) Equal to Is playing) then do (Unit - Create 1 RANDOM_HERO_ARRAY[(Random integer number between 1 and NUM_HEROES)] for Player 7 (Green) at (Player 7 (Green) start location) facing Default building facing degrees) else do (Do nothing)
      • If ((Player 7 (Green) slot status) Equal to Is playing) then do (Hero - Create Scroll of Town Portal and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 7 (Green) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 7 (Green) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • Player - Add -1900 to Player 7 (Green) Current gold
      • Wait 0.05 seconds
      • If ((Player 8 (Pink) slot status) Equal to Is playing) then do (Unit - Create 1 RANDOM_HERO_ARRAY[(Random integer number between 1 and NUM_HEROES)] for Player 8 (Pink) at (Player 8 (Pink) start location) facing Default building facing degrees) else do (Do nothing)
      • If ((Player 8 (Pink) slot status) Equal to Is playing) then do (Hero - Create Scroll of Town Portal and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 8 (Pink) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 8 (Pink) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • Player - Add -1900 to Player 8 (Pink) Current gold
      • Wait 0.05 seconds
      • If ((Player 9 (Gray) slot status) Equal to Is playing) then do (Unit - Create 1 RANDOM_HERO_ARRAY[(Random integer number between 1 and NUM_HEROES)] for Player 9 (Gray) at (Player 9 (Gray) start location) facing Default building facing degrees) else do (Do nothing)
      • If ((Player 9 (Gray) slot status) Equal to Is playing) then do (Hero - Create Scroll of Town Portal and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 9 (Gray) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 9 (Gray) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • Player - Add -1900 to Player 9 (Gray) Current gold
      • Wait 0.05 seconds
      • If ((Player 10 (Light Blue) slot status) Equal to Is playing) then do (Unit - Create 1 RANDOM_HERO_ARRAY[(Random integer number between 1 and NUM_HEROES)] for Player 10 (Light Blue) at (Player 10 (Light Blue) start location) facing Default building facing degrees) else do (Do nothing)
      • If ((Player 10 (Light Blue) slot status) Equal to Is playing) then do (Hero - Create Scroll of Town Portal and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 10 (Light Blue) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 10 (Light Blue) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • Player - Add 1900 to Player 10 (Light Blue) Current gold
      • Wait 0.05 seconds
      • If ((Player 11 (Dark Green) slot status) Equal to Is playing) then do (Unit - Create 1 RANDOM_HERO_ARRAY[(Random integer number between 1 and NUM_HEROES)] for Player 11 (Dark Green) at (Player 11 (Dark Green) start location) facing Default building facing degrees) else do (Do nothing)
      • If ((Player 11 (Dark Green) slot status) Equal to Is playing) then do (Hero - Create Scroll of Town Portal and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 11 (Dark Green) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 11 (Dark Green) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • Player - Add -1900 to Player 11 (Dark Green) Current gold
      • Wait 0.05 seconds
      • If ((Player 12 (Brown) slot status) Equal to Is playing) then do (Unit - Create 1 RANDOM_HERO_ARRAY[(Random integer number between 1 and NUM_HEROES)] for Player 12 (Brown) at (Player 12 (Brown) start location) facing Default building facing degrees) else do (Do nothing)
      • If ((Player 12 (Brown) slot status) Equal to Is playing) then do (Hero - Create Scroll of Town Portal and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 12 (Brown) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • If ((Player 12 (Brown) slot status) Equal to Is playing) then do (Hero - Create Clarity Potion and give it to (Last created unit)) else do (Do nothing)
      • Player - Add -1900 to Player 12 (Brown) Current gold
      • Trigger - Turn off (This trigger)
 
Status
Not open for further replies.
Top