looking for a flawless random hero trigger

canons200

New Member
Reaction score
50
as topic shown, i am looking for a flawless random hero trigger(1 hero for whole game, no repeatable), i have tried the Hero Taverns By SD_Ryoko. But it is not suitable because it can random 2 same hero.

i am looking for a random trigger which can only random 1 hero for the whole game.

any help is appreciated ^^
EDIT
new problem, refer to post 10
Trigger:
  • Random Hero Copy
    • Events
      • Player - Player 1 (Red) types a chat message containing -random as An exact match
      • Player - Player 2 (Blue) types a chat message containing -random as An exact match
      • Player - Player 3 (Teal) types a chat message containing -random as An exact match
      • Player - Player 4 (Purple) types a chat message containing -random as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -random as An exact match
      • Player - Player 6 (Orange) types a chat message containing -random as An exact match
      • Player - Player 7 (Green) types a chat message containing -random as An exact match
      • Player - Player 8 (Pink) types a chat message containing -random as An exact match
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True))) Equal to 0
        • Then - Actions
          • Set RandomInteger = (Random integer number between 1 and TotalRandomHero)
          • Unit - Create 1 RandomHero[RandomInteger] for (Triggering player) at P_ReturnRegion facing Default building facing degrees
          • Set U_LastCreatedHero[(Player number of (Triggering player))] = (Last created unit)
          • Set RandomHero[RandomInteger] = RandomHero[TotalRandomHero]
          • Set TotalRandomHero = (TotalRandomHero - 1)
          • Player Group - Pick every player in (All players) and do (Actions)
            • Loop - Actions
              • Player - Make (Unit-type of U_LastCreatedHero[(Player number of (Triggering player))]) Unavailable for training/construction by (Picked player)
          • Game - Display to (All players) the text: (((S_Player_Colours[(Player number of (Triggering player))] + ((Name of (Owner of U_LastCreatedHero[(Player number of (Triggering player))])) + |r)) + has random ) + (Name of U_LastCreatedHero[(Player number of (Triggering player))]))
          • Game - Display to (All players) the text: (((S_Player_Colours[(Player number of (Triggering player))] + ((Name of (Owner of U_LastCreatedHero[(Player number of (Triggering player))])) + |r)) + has obtained extra 100 gold as random hero.) + <Empty String>)
          • Selection - Clear selection
          • Selection - Select U_LastCreatedHero[(Player number of (Triggering player))] for (Triggering player)
          • Camera - Pan camera for (Triggering player) to P_ReturnRegion over 0.20 seconds
          • Player - Add 100 to (Triggering player) Current gold
        • Else - Actions

Trigger:
  • Hero Pick
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to True
    • Actions
      • Unit - Remove (Buying unit) from the game
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Make (Unit-type of (Sold unit)) Unavailable for training/construction by (Picked player)
      • Game - Display to (All players) the text: (((S_Player_Colours[(Player number of (Owner of (Sold unit)))] + ((Name of (Owner of (Sold unit))) + |r)) + has chosen ) + (Name of (Sold unit)))
      • Set TotalRandomHero = (TotalRandomHero - 1)
      • Selection - Clear selection
      • Selection - Select (Sold unit) for (Owner of (Sold unit))
      • Unit - Move (Sold unit) instantly to P_ReturnRegion, facing Default building facing degrees
      • Camera - Pan camera for (Owner of (Sold unit)) to P_ReturnRegion over 0.20 seconds
 

SouLEDGE

Damn you advanced calculus
Reaction score
75
Hmm, I'm a bit out of practice but here goes:

1) Add all the available types of heroes to a group.
2) Choose one random hero type from that group
3) Create it (for one the players)
4) Then remove it from the group
5) Rinse and repeat for however many players you have:thup:
 

TomTTT

New Member
Reaction score
44
i'm not sure i got the point.
You want a trigger that when a unit buys a random hero from a hero tavern, make sure you won't be able to random again?
 

canons200

New Member
Reaction score
50
to SouLEDGE
seem understand and also seem don't understand

to TomTTT
yup, only an unique hero per map regardless how he picks or random the hero, in the map, would be having 2 same hero.
 

canons200

New Member
Reaction score
50
to exide
sorry, i just tested your map by simply turn off the check hero condition and keep spawning -random to check whether same hero can be random or not. But the result is same as Hero taverns by SD_Ryoko. which can random 2 or more for the same hero.

to SouLEDGE
i get what you mean now, but yet how can i add unit-type to unit group? (unit-type to unit group, not unit to unit group)
 

tommerbob

Minecraft. :D
Reaction score
110
1. Preplace 1 of each hero on the map (make them hidden from players view)
2. Add all heroes to a unit group
3. When the random event takes place, select 1 random unit from the unit group for each player
4. Create a unit type of that unit for the respective player
5. Remove that unit from the unit group, remove unit from game
6. Once all players have their respective hero, destroy unit group
8. Done.
 

vypur85

Hibernate
Reaction score
803
Code:
Event
 Map Init
Condition
Action
 Set IntegerMaxHeroNumber = 4
 Set YourHeroType[1] = ...
 Set YourHeroType[2] = ...
 Set YourHeroType[3] = ...
 Set YourHeroType[4] = ...

Code:
Event
 [I]However you wanna choose hero[/I]
Condition
 [I]Depends on you[/I]
Actions
 Set Integer = Random number between 1 and IntegerMaxHeroNumber
 Unit - Create 1 YourHeroType[Integer] for....
 Set YourHeroType[Integer] = YourHeroType[IntegerMaxHeroNumber]
 Set IntegerMaxHeroNumber = IntegerMaxHeroNumber - 1

Try the above?
 

canons200

New Member
Reaction score
50
to tommerbob
i am using tavern to save space, at such preplace all hero don't work for me, unless i remove the tavern and change to the method you said.

to vypur85
huh, weird, i last time tried your listed method and i remembered fail, but now i try........it work as my desired.

Thank you for those who spent their time in this post, i finally found the solution(by vypur85). Rep added for those who trying to help me as my appreciated to you. Topic closed.
 

canons200

New Member
Reaction score
50
after 24 hours ++
i finally know why the method provided by vypur85 fail as i said before, the reason is that, if all hero picked via random command, it is working fine, BUT if someone choose 1 hero(any hero) then the random command is fail, which mean can hv 2 same hero (1 via choose and another 1 via random)

i think it is trigger problem, so i post it up here, and hope anyone can help me to point out the solution or improvement. The trigger is at first post after the world EDIT.
 

vypur85

Hibernate
Reaction score
803
Code:
    Events
        Unit - A unit Sells a unit
    Conditions
        ((Sold unit) is A Hero) Equal to True
    Actions
        Unit - Remove (Buying unit) from the game
        Player Group - Pick every player in (All players) and do (Actions)
            Loop - Actions
                Player - Make (Unit-type of (Sold unit)) Unavailable for training/construction by (Picked player)
        Game - Display to (All players) the text: (((S_Player_Colours[(Player number of (Owner of (Sold unit)))] + ((Name of (Owner of (Sold unit))) + |r)) +  has chosen ) + (Name of (Sold unit)))

[B]        For each (Integer A) from 1 to TotalRandomHero, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Unit-type of (Sold unit)) Equal to RandomHero[Integer A]
                    Then - Actions
                        Set RandomHero[Integer A] = RandomHero[TotalRandomHero]
                    Else - Actions
        Set TotalRandomHero = (TotalRandomHero - 1)[/B]

        Selection - Clear selection
        Selection - Select (Sold unit) for (Owner of (Sold unit))
        Unit - Move (Sold unit) instantly to P_ReturnRegion, facing Default building facing degrees
        Camera - Pan camera for (Owner of (Sold unit)) to P_ReturnRegion over 0.20 seconds

Try adding the bolded lines. Not tested. Just something out of my mind...
 

canons200

New Member
Reaction score
50
to tommerbob
why don't i checked the dota template map? tested before i make the first post, it not works as desired.

to vypur85
Miracle, this is working perfectly (tested for 10 times, no problem at all). Thank you vypur85, you save my day.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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