• 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.
  • Vote for the theme of Hive's HD Modeling Contest #7! Click here to vote! - Please only vote if you plan on participating❗️

Game Mode - All Random (AR)

Status
Not open for further replies.
Level 18
Joined
May 11, 2012
Messages
2,103
This system quite fails to deliver the goal, which is give every player random hero, that is DIFFERENT from other player's hero. So 2 players don't get the same hero. Even when repicking, player can't get the same hero that another player has taken


  • Initializing Heroes
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- ====== Initializing Variables ====== --------
      • Set RandomHeroes_Max = 12
      • Set RandomMax = 12
      • Set RandomHero_Array[1] = |cff00ff00Abystic Flamelord|r (Agility)
      • Set RandomHero_Array[2] = |cff00ff00Broodmother|r (Agility)
      • Set RandomHero_Array[3] = |cffff0000Shadow|r (Strength)
      • Set RandomHero_Array[4] = |cff00ff00Demon Hunter|r (Agility)
      • Set RandomHero_Array[5] = |cff00ff00Illusionist|r (Agility)
      • Set RandomHero_Array[6] = |cff00ff00Lava Spawn|r (Agility)
      • Set RandomHero_Array[7] = |cff0000ffLightning Destroyer|r (Intelligence)
      • Set RandomHero_Array[8] = |cff00ff00Swordsman|r (Agility)
      • Set RandomHero_Array[9] = |cff0000ffNaga Siren|r (Intelligence)
      • Set RandomHero_Array[10] = |cffff0000Naga Royal Guard|r (Strength)
      • Set RandomHero_Array[11] = |cffff0000The Rapist|r (Strength)
      • Set RandomHero_Array[12] = |cffff0000The Scorpio|r (Strength)
      • For each (Integer TempInt) from 1 to RandomMax, do (Actions)
        • Loop - Actions
          • Set Random_Data[TempInt] = TempInt
      • Custom script: call DestroyTrigger(GetTriggeringTrigger())


  • All Random
    • Events
    • Conditions
      • AR Equal to True
      • SH Not equal to True
      • AP Not equal to True
    • Actions
      • For each (Integer TempInt) from 1 to 8, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Player[TempInt] controller) Equal to User
              • (Player[TempInt] slot status) Equal to Is playing
              • (Number of units in (Units owned by Player[TempInt] matching (((Matching unit) is A Hero) Equal to True))) Equal to 0
            • Then - Actions
              • Set TempPoint = (Center of Return Area <gen>)
              • Set Random_Hero = (Random integer number between 1 and RandomMax)
              • Unit - Create 1 RandomHero_Array[Random_Data[Random_Hero]] for Player[TempInt] at TempPoint facing Default building facing degrees
              • Set PlayerHero[TempInt] = (Last created unit)
              • Game - Display to (All players) the text: (((PlayerColors[TempInt] + PlayerName_NoHero[TempInt]) + |r|c00FDD017has randomed ) + (PlayerColors[2] + (Name of PlayerHero[TempInt])))
              • Hero - Create Ankh and give it to PlayerHero[TempInt]
              • Item - Set charges remaining in (Last created item) to 5
              • Hero - Create Mana Potion and give it to PlayerHero[TempInt]
              • Item - Set charges remaining in (Last created item) to 10
              • Hero - Create Health Potion and give it to PlayerHero[TempInt]
              • Item - Set charges remaining in (Last created item) to 10
              • Selection - Select PlayerHero[TempInt] for Player[TempInt]
              • Camera - Pan camera for Player[TempInt] to TempPoint over 0.00 seconds
              • Player - Limit training of Heroes to 0 for Player[TempInt]
              • Set PlayerName[TempInt] = ((PlayerColors[TempInt] + PlayerName_NoHero[TempInt]) + ( ( + ((Name of PlayerHero[TempInt]) + (PlayerColors[TempInt] + )))))
              • Player - Set name of Player[TempInt] to PlayerName[TempInt]
              • For each (Integer TempInt2) from 1 to 8, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Difficulty Equal to Hard
                    • Then - Actions
                      • Player - Add ((6000 / HumanPlayersActive) - 250) to Player[TempInt2] Current gold
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Difficulty Equal to Extreme
                        • Then - Actions
                          • Player - Add ((4000 / HumanPlayersActive) - 250) to Player[TempInt2] Current gold
                        • Else - Actions
                          • Player - Add ((8000 / HumanPlayersActive) - 250) to Player[TempInt2] Current gold
              • Set Random_Data[Random_Hero] = RandomMax
              • Set RandomMax = (RandomMax - 1)
              • Custom script: call RemoveLocation(udg_TempPoint)
            • Else - Actions
      • Trigger - Turn off (This trigger)
      • Custom script: set udg_TempPoint = null
      • Custom script: call DestroyTrigger(GetTriggeringTrigger())


  • Repick AR
    • Events
    • Conditions
      • AR Equal to True
      • AP Not equal to True
      • SH Not equal to True
    • Actions
      • For each (Integer TempInt) from 1 to 8, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Repick[TempInt] Equal to False
              • (Triggering player) Equal to Player[TempInt]
            • Then - Actions
              • Set Repick[TempInt] = True
              • Unit - Remove PlayerHero[TempInt] from the game
              • Game - Display to (All players) the text: (((PlayerColors[TempInt] + PlayerName_NoHero[TempInt]) + |r|c00FDD017has repicked ) + (PlayerColors[2] + (Name of PlayerHero[TempInt])))
              • Set TempPoint = (Center of Return Area <gen>)
              • Set Random_Hero = (Random integer number between 1 and RandomMax)
              • Unit - Create 1 RandomHero_Array[Random_Data[Random_Hero]] for Player[TempInt] at TempPoint facing Default building facing degrees
              • Set PlayerHero[TempInt] = (Last created unit)
              • Game - Display to (All players) the text: (((PlayerColors[TempInt] + PlayerName_NoHero[TempInt]) + |r|c00FDD017has repicked into ) + (PlayerColors[2] + (Name of PlayerHero[TempInt])))
              • Hero - Create Ankh and give it to PlayerHero[TempInt]
              • Item - Set charges remaining in (Last created item) to 5
              • Hero - Create Mana Potion and give it to PlayerHero[TempInt]
              • Item - Set charges remaining in (Last created item) to 10
              • Hero - Create Health Potion and give it to PlayerHero[TempInt]
              • Item - Set charges remaining in (Last created item) to 10
              • Selection - Select PlayerHero[TempInt] for Player[TempInt]
              • Camera - Pan camera for Player[TempInt] to TempPoint over 0.00 seconds
              • Player - Limit training of Heroes to 0 for Player[TempInt]
              • Set PlayerName[TempInt] = ((PlayerColors[TempInt] + PlayerName_NoHero[TempInt]) + ( ( + ((Name of PlayerHero[TempInt]) + (PlayerColors[TempInt] + )))))
              • Player - Set name of Player[TempInt] to PlayerName[TempInt]
              • Player - Add -250 to Player[TempInt] Current gold
              • Set Random_Data[Random_Hero] = RandomMax
              • Set RandomMax = (RandomMax - 1)
              • Custom script: call RemoveLocation(udg_TempPoint)
            • Else - Actions
              • Set TempPlayerGroup = (Player group(Player[TempInt]))
              • Game - Display to TempPlayerGroup the text: |c00FDD017You can't...
              • Custom script: call DestroyForce(udg_TempPlayerGroup)
              • Custom script: set udg_TempPlayerGroup = null
      • Custom script: set udg_TempPoint = null
 
Level 21
Joined
Nov 4, 2013
Messages
2,017
You should use an array Boolean of value 12 (let's say its name is HeroPicked). Whenever a hero is picked, you set HeroPicked[Random_Hero] to True. Then, you apply an If/Then/Else (multiple functions) just below Set Random_Hero = (Random integer number between 1 and RandomMax) where you check that if HeroPicked[Random_Hero] Equal to True then run (this trigger) and skip remaining actions.
In case of a repick, then put the first command of the For each (Integer TempInt) from 1 to 8, do (Actions)) to be HeroPicked[Temp_Int] Equal to False. Then, you just implement the same things I said above and it should work hopefully.
Advise me if you have problems.
 
hi, show you mine all random actions, sorry for jass, its basic, im sure you get it

  • Settings
    • Events
    • Conditions
    • Actions
      • -------- -------- set heros array -
      • Set HeroRandom[1] = Anarki (1)
      • Set HeroRandom[2] = Biker (2)
      • Set HeroRandom[3] = Chronos (3)
      • Set HeroRandom[4] = Crash (4)
      • Set HeroRandom[5] = Giant (5)
      • Set HeroRandom[6] = Major (6)
      • Set HeroRandom[7] = Sarge (7)
      • Set HeroRandom[8] = Talos (8)
      • Set HeroRandom[9] = TankJunior (9)
  • //etc..... to 30
    • Set HerosQuantityA = 30
x is integer
i gui player nr
yoo loop thru all players
JASS:
    set x = GetRandomInt(1, udg_HerosQuantityA)
    set udg_Hero[i] = CreateUnitAtLoc(pla, udg_HeroRandom[x], udg_Point_CentreAlliance, 0.00)
    set udg_HeroRandom[x] = udg_HeroRandom[udg_HerosQuantityA]
    set udg_HerosQuantityA = udg_HerosQuantityA - 1
 
Level 18
Joined
May 11, 2012
Messages
2,103
You should use an array Boolean of value 12 (let's say its name is HeroPicked). Whenever a hero is picked, you set HeroPicked[Random_Hero] to True. Then, you apply an If/Then/Else (multiple functions) just below Set Random_Hero = (Random integer number between 1 and RandomMax) where you check that if HeroPicked[Random_Hero] Equal to True then run (this trigger) and skip remaining actions.
In case of a repick, then put the first command of the For each (Integer TempInt) from 1 to 8, do (Actions)) to be HeroPicked[Temp_Int] Equal to False. Then, you just implement the same things I said above and it should work hopefully.
Advise me if you have problems.

I didn't really understand completely what you mean.. Mind making test triggers?
 
Hello BloodDrunk,

you could use different ways and approaches for this issue.
I will show it with the example of an array data list.

Init:
  • Set HeroList[1] = Hero1
  • Set HeroList[2] = Hero2
  • Set HeroList[3] = Hero3
  • ...
  • Set HeroList[12] = Hero12
  • Set HeroAmount = 12
^Here you basicly initialisize the unit[array] and set the correct size as amount.

Pick:
  • Set P = MyPlayer
  • Set I = PlayerNumerOf(P)
  • Set TempInt = RandomNumberBetween(1 and HeroAmount)
  • Unit - Create HeroList[TempInt] for P
  • Set Hero[I] = LastCreatedUnit()
  • Set HeroList[TempInt] = HeroList[HeroAmount]
  • Set HeroAmount = HeroAmount - 1
^Here we get a random hero of the list, and then we move the
last element (HeroList[HeroAmount]) to the position of the picked hero, to overwrite it.
Now, as the used hero was overwritten by the last hero, it can't be chosen again.
Also you can refer to the hero by the variable Hero[PlayerNumerOfPlayer].

Repick:
  • Set HeroAmount = HeroAmount + 1
  • Set HeroList[HeroAmount] = UnitTypeOf(Hero[PlayerNumberOfPlayer])
  • Unit - Remove Hero[PlayerNumberOfPlayer] from game
^Actually this is not the whole repick method, but only the re-adding to list method.
After having it done you simly can use the "Pick" method again to pick a random hero.

I hope I have thought of everything and you can get an idea of how to do it.
If there are some aspects unclear or you would want to have something explained again, feel welcome to ask.:)
 
Status
Not open for further replies.
Top