All Random Hero Trigger Help!

Warraven

New Member
Reaction score
1
Hello, I am in the making of a Small PVP Arena type map. I have started on making an -ar (All Random) mode where ofcourse the players are randomed their hero. Now I have done most of the trigger, well pretty much all of it and I have tested it a few times and to me it doesn't seem to be working, whether it's my trigger or just bad luck but I don't know.
Well here's the thing, my map plays out like this;
-Game loads
-Players pick whether they are Good or Evil
-Host picks modes (-arffa (All random free for all))
-Players screens are sent to a small room where all the heros are.
-One by one the players heros are randomed so there are no duplicate heros to screw up spell triggers.
-Once heros are picked the game starts.
Now, it screws up when the Players are given their heros because when I tested it, as I said it may have been bad luck but I kept randoming the Ancient Crypt Fiend (See the code).
Well enough of my babbling here is my trigger (There is no event because the action is initated from another trigger):
Trigger:
  • Dispurse Heros
    • Events
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in Heros Good <gen>) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A Hero) Equal to True
            • Then - Actions
              • Unit Group - Add (Picked unit) to HerosGood
            • Else - Actions
              • Do nothing
      • Unit Group - Pick every unit in (Units in Heros Evil <gen>) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A Hero) Equal to True
            • Then - Actions
              • Unit Group - Add (Picked unit) to HerosEvil
            • Else - Actions
              • Do nothing
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across Picking Area <gen>
          • Camera - Set the camera bounds for (Picked player) to Picking <gen>
      • Game - Display to (All players) the text: (|cffffcc00Game:|r + Now randoming the heros.)
      • Wait 2.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 1 (Red) controller) Equal to User
          • (Player 1 (Red) slot status) Equal to Is playing
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • PlayerAlliance[1] Equal to True
            • Then - Actions
              • Unit - Create 1 (Unit-type of (Random unit from HerosGood)) for Player 1 (Red) at (Center of PlayerStart[1]) facing Default building facing degrees
              • Unit Group - Remove (Picked unit) from HerosGood
              • Game - Display to (All players) the text: (|cffffcc00Game:|r + ((Name of (Triggering player)) + ( has been randomed + ((Name of (Last created unit)) + !))))
              • Unit Group - Pick every unit in (Units in Heros Good <gen>) and do (Actions)
                • Loop - Actions
                  • Unit - Change color of (Picked unit) to Red
            • Else - Actions
              • <b>Unit Group - Pick every unit in (Units in Heros Evil &lt;gen&gt;) and do (Actions)
                • Loop - Actions
                  • Unit - Change color of (Picked unit) to Red
              • Unit - Create 1 (Unit-type of (Random unit from HerosEvil)) for Player 1 (Red) at (Center of PlayerStart[1]) facing Default building facing degrees
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Last created unit)) Equal to Sacred Chieftain
                • Then - Actions
                  • Unit Group - Remove Sacred Chieftain 0014 &lt;gen&gt; from HerosEvil
                  • Unit - Kill Sacred Chieftain 0014 &lt;gen&gt;
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Last created unit)) Equal to Voodoo Troll
                    • Then - Actions
                      • Unit Group - Remove Voodoo Troll 0015 &lt;gen&gt; from HerosEvil
                      • Unit - Kill Voodoo Troll 0015 &lt;gen&gt;
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Unit-type of (Last created unit)) Equal to Vampire
                        • Then - Actions
                          • Unit Group - Remove Vampire 0016 &lt;gen&gt; from HerosEvil
                          • Unit - Kill Vampire 0016 &lt;gen&gt;
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Unit-type of (Last created unit)) Equal to Ancient Cryptfiend
                            • Then - Actions
                              • Unit Group - Remove Ancient Cryptfiend 0017 &lt;gen&gt; from HerosEvil
                              • Unit - Kill Ancient Cryptfiend 0017 &lt;gen&gt;
                            • Else - Actions
                              • Do nothing
              • Game - Display to (All players) the text: (|cffffcc00Game:|r + ((Name of (Owner of (Last created unit))) + ( has been randomed + ((Name of (Last created unit)) + !))))
        • Else - Actions
          • Game - Display to (All players) the text: (|cffffcc00Game:|r + ((Name of Player 1 (Red)) + is not playing.))</b>


Sorry about the long code, but I actually did chop about 4x that off because it is just repeated for each player. Now the error occures around here:
Trigger:
  • Else - Actions
    • <b>Unit Group - Pick every unit in (Units in Heros Evil &lt;gen&gt;) and do (Actions)
      • Loop - Actions
        • Unit - Change color of (Picked unit) to Red
    • Unit - Create 1 (Unit-type of (Random unit from HerosEvil)) for Player 1 (Red) at (Center of PlayerStart[1]) facing Default building facing degrees
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Unit-type of (Last created unit)) Equal to Sacred Chieftain
      • Then - Actions
        • Unit Group - Remove Sacred Chieftain 0014 &lt;gen&gt; from HerosEvil
        • Unit - Kill Sacred Chieftain 0014 &lt;gen&gt;
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Last created unit)) Equal to Voodoo Troll
          • Then - Actions
            • Unit Group - Remove Voodoo Troll 0015 &lt;gen&gt; from HerosEvil
            • Unit - Kill Voodoo Troll 0015 &lt;gen&gt;
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Unit-type of (Last created unit)) Equal to Vampire
              • Then - Actions
                • Unit Group - Remove Vampire 0016 &lt;gen&gt; from HerosEvil
                • Unit - Kill Vampire 0016 &lt;gen&gt;
              • Else - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Unit-type of (Last created unit)) Equal to Ancient Cryptfiend
                  • Then - Actions
                    • Unit Group - Remove Ancient Cryptfiend 0017 &lt;gen&gt; from HerosEvil
                    • Unit - Kill Ancient Cryptfiend 0017 &lt;gen&gt;
                  • Else - Actions
                    • Do nothing</b>

Because what I think is happening is that the last hero being removed is being given to the player.
But I dunno.

Thanks in advance to who ever helps me, I will credit them on the map.
By the way if this takes awhile to figure out it's all cool I can just make the spells and items while we figure it out.
Thanks! :D
 

Laiev

Hey Listen!!
Reaction score
188
Wow..

I don't know how do make it work but I can help you with somethings...

First.. remove all
Trigger:
  • Do nothing


Why? Because the default action what warcraft do, is do nothing, so you dont need write it to trigger read one more line.

Second...
Trigger:
  • Unit Group - Pick every unit in (Units in Heros Good &lt;gen&gt;) and do (Actions)
pick every unit in (Units in heroes good <gen>) < leak.
Fix:
Trigger:
  • Set UnitGroupVariable = units in Heros good &lt;gen&gt;
    • Unit Group - Pick every unit in UnitGroupVariable and do (Actions)
    • ~~~~~~~~~~~~~~~~~~~~~~
    • Custom Script: call DestroyGroup (udg_UnitGroupVariable)


the custom script is to destroy the unit group, do it when the trigger end, or when u dont need the unit group anymore.

Thirt...
Trigger:
  • Unit - Create 1 (Unit-type of (Random unit from HerosGood)) for Player 1 (Red) at (Center of PlayerStart[1]) facing Default building facing degrees

Same in second
Unit - Create 1 (Unit-type of (Random unit from HerosGood)) for Player 1 (Red) at (Center of PlayerStart[1]) facing Default building facing degrees point make leak
Fix:
Trigger:
  • Set YourLocation = (Center of PlayerStart[1]) facing Default building facing
    • Unit - Create 1 (Unit-type of (Random unit from HerosGood)) for Player 1 (Red) at YourLocation
    • Custom Script: call RemoveLocation (udg_YourLocation)


Sorry for my bad english :D but I think you understand, if not, tell.

EDIT: In your first trigger, you got 6 leaks and in the second u got 2. I just teach you how to find and remove both with examples using your trigger.
 

Warraven

New Member
Reaction score
1
Thanks, I did have abit of trouble with determining leaks and how to fix them.
And yeah I could easily understand.;)
 

TheTriggerer

New Member
Reaction score
0
i made an allrandom trigger that is easyer than yours and much more effective you dont need that region with heroes :D

Trigger:
  • Allrandom
    • Events
      • Player - Player 1 (Red) types a chat message containing -ar as An exact match
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HaveHero[1] Equal to 0
          • (Player 1 (Red) slot status) Equal to Is playing
          • (Player 1 (Red) controller) Equal to User
        • Then - Actions
          • For each (Integer A) from 1 to 100, do (Actions)
            • Loop - Actions
              • Set RandomNumber[1] = (Random integer number between 1 and 4)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                • Then - Actions
                  • Set HaveHero[1] = 1
                  • Unit - Create 1 RandomHero[RandomNumber[1]] for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
                • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HaveHero[2] Equal to 0
          • (Player 2 (Blue) slot status) Equal to Is playing
          • (Player 2 (Blue) controller) Equal to User
        • Then - Actions
          • For each (Integer A) from 1 to 100, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RandomNumber[2] Not equal to RandomNumber[1]
                • Then - Actions
                  • Set HaveHero[2] = 1
                  • Unit - Create 1 RandomHero[RandomNumber[2]] for Player 2 (Blue) at (Center of (Playable map area)) facing Default building facing degrees
                • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HaveHero[3] Equal to 0
          • (Player 3 (Teal) slot status) Equal to Is playing
          • (Player 3 (Teal) controller) Equal to User
        • Then - Actions
          • For each (Integer A) from 1 to 100, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RandomNumber[3] Not equal to RandomNumber[1]
                  • RandomNumber[3] Not equal to RandomNumber[2]
                • Then - Actions
                  • Set HaveHero[3] = 1
                  • Unit - Create 1 RandomHero[RandomNumber[3]] for Player 3 (Teal) at (Center of (Playable map area)) facing Default building facing degrees
                • Else - Actions
        • Else - Actions

and for this you need some variables too right :D

Trigger:
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set RandomHero[1] = Paladin
      • Set RandomHero[2] = Archmage
      • Set RandomHero[3] = Mountain King
      • Set RandomHero[4] = Blood Mage


The variable types are:
RandomHero is Unittype variable with 1 array for each player
HaveHero is an Intrigger with 1 array for each player
RandomNumber is an Intrigger with 1 array for each player

and dont forget to add memory leaks in the end to remove all variables ;D
 

dragonhord

Knowledge is true opinion. - Plato
Reaction score
82
Why not do a loop condition so you guys don't have to do an individual "If" condition for every single player 0.o?
 

Warraven

New Member
Reaction score
1
i made an allrandom trigger that is easyer than yours and much more effective you dont need that region with heroes :D

Trigger:
  • Allrandom
    • Events
      • Player - Player 1 (Red) types a chat message containing -ar as An exact match
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HaveHero[1] Equal to 0
          • (Player 1 (Red) slot status) Equal to Is playing
          • (Player 1 (Red) controller) Equal to User
        • Then - Actions
          • For each (Integer A) from 1 to 100, do (Actions)
            • Loop - Actions
              • Set RandomNumber[1] = (Random integer number between 1 and 4)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                • Then - Actions
                  • Set HaveHero[1] = 1
                  • Unit - Create 1 RandomHero[RandomNumber[1]] for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
                • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HaveHero[2] Equal to 0
          • (Player 2 (Blue) slot status) Equal to Is playing
          • (Player 2 (Blue) controller) Equal to User
        • Then - Actions
          • For each (Integer A) from 1 to 100, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RandomNumber[2] Not equal to RandomNumber[1]
                • Then - Actions
                  • Set HaveHero[2] = 1
                  • Unit - Create 1 RandomHero[RandomNumber[2]] for Player 2 (Blue) at (Center of (Playable map area)) facing Default building facing degrees
                • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HaveHero[3] Equal to 0
          • (Player 3 (Teal) slot status) Equal to Is playing
          • (Player 3 (Teal) controller) Equal to User
        • Then - Actions
          • For each (Integer A) from 1 to 100, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RandomNumber[3] Not equal to RandomNumber[1]
                  • RandomNumber[3] Not equal to RandomNumber[2]
                • Then - Actions
                  • Set HaveHero[3] = 1
                  • Unit - Create 1 RandomHero[RandomNumber[3]] for Player 3 (Teal) at (Center of (Playable map area)) facing Default building facing degrees
                • Else - Actions
        • Else - Actions

and for this you need some variables too right :D

Trigger:
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set RandomHero[1] = Paladin
      • Set RandomHero[2] = Archmage
      • Set RandomHero[3] = Mountain King
      • Set RandomHero[4] = Blood Mage


The variable types are:
RandomHero is Unittype variable with 1 array for each player
HaveHero is an Intrigger with 1 array for each player
RandomNumber is an Intrigger with 1 array for each player

and dont forget to add memory leaks in the end to remove all variables ;D

Thanks, but I wrote mine to fit with my map, does this make it so there is only one hero of each type, as in no duplicates?
 

dragonhord

Knowledge is true opinion. - Plato
Reaction score
82
If you're looking for no duplicates you might want to check out how the DotA template does it... I use the DotA Templates random and it doesn't produce duplicates.. It's also a lot more efficient...
hey i wrote it because its easy ;D and it works :D and i dont know how to loop :D show me how :D:D:D:D:D please
Trigger:
  • For Loop Integer A from 1 to 12 do actions
    • Loop Actions -
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • * If - Conditions
        • o HaveHero[Integer A] Equal to 0
        • o (Player (Integer A) slot status) Equal to Is playing
        • o (Player (Integer A) controller) Equal to User
      • * Then - Actions
        • o For each (Integer A) from 1 to 100, do (Actions)
          • + Loop - Actions
            • # Set RandomNumber[Integer A] = (Random integer number between 1 and 4)
            • # If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • * If - Conditions
              • * Then - Actions
                • o Set HaveHero[Integer A] = 1
                • o Unit - Create 1 RandomHero[RandomNumber[1]] for Player(Integer A) at (Center of (Playable map area)) facing Default building facing degrees
              • * Else - Actions
That's just a Player Number where it says Player(Integer A)... So when it asks for your player... And you put player one... Go to the drop down menu beneath it and look for Player Number... This is stating for each integer from 1-12... Or in this case players red through brown, to do these actions for each player... it's a lot nicer/easier to do it this way then doing one for each player :D
 

Exide

I am amazingly focused right now!
Reaction score
448

Warraven

New Member
Reaction score
1
Thanks everyone for the help and suggestions, I will check out the dota template if I don't get much help there I will go to your thread Exide. Thanks!
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top