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
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top