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.
  • 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