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.

      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