Random hero trigger (hopefully last Q)

Holla.

New Member
Reaction score
14
Allright this trigger has left me stumped for AGES and many of you have helped BUT yet again i ran into problems.
Heres 3 pictures of the stuff.

The trigger BRUTAL told me to use.

newtriggerproblemoriginialtrigger.jpg


Heres what brutal told me to do because i want the heroes to spawn 1 at each base or capital:

newtriggerproblemtriggerextension.jpg


And heres what i did.

To me this seems infinitly complicated to +rep to whoever helps the smallest bit.

NEWtriggerproblem.jpg


Ok, when i tested, pretty much what happend was. my event happend and then i got 11 random heroes and some were copies.

What i wanted was: 1 random hero. and no copies on entire map with 11 players.

Could someone help me i rlly want to get this trigger over n done with.

It seems too complicated for me.
 

Never_Quit

New Member
Reaction score
16
yeah i agree your triggering seems very redundant...

there is another post with a random hero selection problem going on btw

EDIT: i'll give you a trigger i made here after a while
 

Never_Quit

New Member
Reaction score
16
i cant open the map its in. i protected all of my versions of Ultimate Boar Killing Spree (and yes that was a real map I made) sorry :(
 

WolfieeifloW

WEHZ Helper
Reaction score
372
Why not PM BRUTAL and ask him ;) .

And Never_Quit, stop double posting.
You obviously know what the edit function is :eek: .
 

ZiggyMcjoney

Data editor?! AAAHHHHH!
Reaction score
95
Well, the reason you're getting 11 units is because you have your pick every player loop INSIDE the unit group loop. So the cause of that is fairly obvious.

This is what you'll want to do, underneath the setting of all those point variables of course

Code:
Pick every unit in Region for heroes avast <gen> and do:
 Loop - Actions:
   Add (Picked unit) to Random Hero Group

Pick every player in (All players) and do:
 Loop - Actions:
  Set RandomHero = Random unit from Random Hero Group
  Create 1 Unit-type of RandomHero for (Picked player) at Pointofrandomherospawning[Player number of (Picked player)]
  Remove RandomHero from Random Hero Group

Note that the pick every player loop is OUTSIDE the first pick every unit loop.

What this is intended to do is add every unit in that region to the hero group, then when it comes to creating one for each player, it will set the RandomHero variable to a random unit from that group, create a unit of that type for that player at the respective point, and then remove it from the group so a duplicate cannot occur.

I hope that works the way you want it to :p.
 

Holla.

New Member
Reaction score
14
wait how do i do this? and also i need 1 hero for every player so the remove thing i have my doughts about, can you explain in more detail please?
 

istar

New Member
Reaction score
31
how about dont use the trigger he gave and use what i gave last time, i sure thats bug-free
 

ZiggyMcjoney

Data editor?! AAAHHHHH!
Reaction score
95
Yes, and with that trigger you will have one hero for every player...

Removing it from the unit group is to simply stop duplicate heroes from appearing in your map, ie two of the same kind.

I believe that is what you want, is it not?

What else do you need explained :p

EDIT: Also, why do you remove player 8 from all the player groups?
 

Holla.

New Member
Reaction score
14
pink isn't needed
ALSO

Well, the reason you're getting 11 units is because you have your pick every player loop INSIDE the unit group loop. So the cause of that is fairly obvious.

This is what you'll want to do, underneath the setting of all those point variables of course

Code:
Pick every unit in Region for heroes avast <gen> and do:
 Loop - Actions:
   Add (Picked unit) to Random Hero Group

Pick every player in (All players) and do:
 Loop - Actions:
  Set RandomHero = Random unit from Random Hero Group
  Create 1 Unit-type of RandomHero for (Picked player) at Pointofrandomherospawning[Player number of (Picked player)]
  Remove RandomHero from Random Hero Group

Note that the pick every player loop is OUTSIDE the first pick every unit loop.

What this is intended to do is add every unit in that region to the hero group, then when it comes to creating one for each player, it will set the RandomHero variable to a random unit from that group, create a unit of that type for that player at the respective point, and then remove it from the group so a duplicate cannot occur.

I hope that works the way you want it to :p.

my two problems were, 1, how to make loop outside.
2: if you remove RandomHero from the group it would mean you only get 1 random hero for one race wouldn't it? cause it would stop all the other 10 random heroes from creating
 

ZiggyMcjoney

Data editor?! AAAHHHHH!
Reaction score
95
pink isn't needed
ALSO



my two problems were, 1, how to make loop outside.
2: if you remove RandomHero from the group it would mean you only get 1 random hero for one race wouldn't it? cause it would stop all the other 10 random heroes from creating

1. Instead of putting the second loop inside the first one, just put it under it.

2. Why would it stop the other 10 random heroes from creating?

When it removes RandomHero from the unit group, that one unit that was created is removed from the group. When the loop goes around next time, the units it can select from the unit group will still all be there, EXCEPT for the ones that have already been selected, cause they will have been removed from the unit group.

Make sense? :p

EDIT: Also, instead of doing TWO all player loops, do:
(All players) matching (Matching player) Not equal to Player 8 (Pink)"
 

BRUTAL

I'm working
Reaction score
118
of course its not working, you forgot to add some stuff and changed it around :p
okay in your trigger when the Pick everyunit in.. , starts do this
Code:
Actions
    Unit Group - Pick every unit in (Whatever your region is) and do (Actions)
        Loop - Actions
            Unit Group - Add (Picked unit) to unitgroup
    *Player Group - Remove Player 8 (Pink) from (All players)
    *Player Group - Pick every player in (All players) and do (Actions)
        Loop - Actions
            Set randomhero = (Random unit from unitgroup)
            Unit - Create 1 (Unit-type of randomhero) for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
            [B]Unit Group - Remove randomhero from unitgroup[/B] < IMPORTANT

* = outside the unitgroup loop, since you merged them.
for the create unit, do exactly what you did cause thats fine, you just had the playergroup loops inside the unitgroup loop, and forgot to remove randomhero from the unitgroup toassure that there is no doubles
 

Holla.

New Member
Reaction score
14
Ok this is confusing as hell so im just gonna post a pic of the trigger as it looks now and ask you all to just tell me the slightest alteration i can make for it to work. Sorry im finding it difficult to keep up and terraining is more my thing. My triggerist left though.
Anyways the pic:

untitledtrigger.jpg


sorry im making this take so long im hopeless i know.
+rep to all though, you guys own at being patient.
 

BRUTAL

I'm working
Reaction score
118
that should work.
have you tested it?

you dont have to screenshot your triggers by the way, just copy and paste it in
Code:
tags or
Trigger:

read more here http://www.thehelper.net/forums/showthread.php?t=116053

also, for the playergroup actions in yourtrigger you could make it shorter by doing;
Trigger:
  • Player Group - Pick every player in (All players) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Picked player) Not equal to Player 8 (Pink)
        • Then - Actions
          • Set randomhero = (Random unit from unitgroup)
          • Unit - Create 1 (Unit-type of randomhero) for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
          • Unit Group - Remove randomhero from unitgroup
        • Else - Actions

less actions, and dont need a playergroup variable
as stated by ziggy
 

Holla.

New Member
Reaction score
14
i... i think it works.. although brown didn't get a hero wonder why?
If it doesn't matter that much i really would like to just leave it lol, ive had enough of this trigger.
 

ZiggyMcjoney

Data editor?! AAAHHHHH!
Reaction score
95
Brown probably did not get a hero because of your point variables.

You still have a variable with the array of [8], but player 8 is not actually getting a hero.

So when you're setting those point variables, change 8 to 9, 9 to 10, 10 to 11 and 11 to 12.

Hope that fixes it for you :p
 

Holla.

New Member
Reaction score
14
thx, changed it. it might.

Thx to brutal, you and Is something for all your wonderous help.

Also wolfie.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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