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
 
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.
 
Thanks, I did have abit of trouble with determining leaks and how to fix them.
And yeah I could easily understand.;)
 
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
 
Why not do a loop condition so you guys don't have to do an individual "If" condition for every single player 0.o?
 
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?
 
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
 
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
  • No one is chatting at the moment.
  • The Helper The Helper:
    It is weird seeing a way more realistic users online number
  • The Helper The Helper:
    Happy Tuesday Night!
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:

      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