Hero Selection not working

I am trying to test a few changes using barebone on the standard dota map but I cant seem to lock in a hero. Just wondering if anyone else has this issue im new to development with dota 2 so I am still figuring things out.

Comments

  • Posts: 858

    Gotta wait 60 seconds

    MAKE CUSTOM GAMES GREAT AGAIN

    Finished-
    kv checker - https://arhowk.github.io
    panorama video series - https://moddota.com/forums/discussion/2021/inclusive-panorama-tutorial-quest-box

    My pet project This Cursed World/Crestfallen (name pending)
    https://moddota.com/forums/discussion/986/this-cursed-world-rpg#latest

  • Since the Dark Moon update it looks like the hero selection HUD is getting displayed during the Custom Game Setup state (which makes it so you can't see any game setup HUDs either...). So you have to wait 30 seconds for the autolaunch to take you to the Hero Selection state.

    If you set the autolaunch delay to 0 you can skip the Game Setup state and go to straight to Hero Selection

    GameRules:SetCustomGameSetupAutoLaunchDelay(0)
    

    https://developer.valvesoftware.com/wiki/Dota_2_Workshop_Tools/Custom_Game_Setup#Auto_launch

  • Posts: 102

    @devilesk It's working, thanks, I was having this problem too

  • Posts: 273

    And how do you change team now without custom game setup state?

  • Posts: 102

    @Darkonius I don't, I just typed it into my addon_game_mode.lua

    GameRules:SetCustomGameSetupAutoLaunchDelay(0)
    
  • edited January 2017 Posts: 12

    I'm having trouble getting it to work actually

    EDIT: Figured it out, Barebones was overwriting it.

  • edited January 2017 Posts: 9

    @Darkonius Well currently I'm doing

    GameMode:SetCustomGameForceHero("npc_dota_hero_abaddon")

    which allows me to see the HUD in custom game setup state. The tradeoff is the hero selection state is skipped. But with some effort you can probably just recreate your own hero selection HUD as part of the custom game setup state.

    I'm doing it a lazy way and just added a dropdown with all the heroes and having it call SetCustomGameForceHero each time the dropdown is changed. As long as that function is called during the custom game setup state (or earlier) it should use that hero. I initially call it during the custom game init so the hero selection HUD doesn't show up at all. If you wait until it changes to custom game setup to first call it then you'll briefly see the hero selection HUD and then it will disappear.

    I think the only issue is that everyone is going to end up with that hero. I don't know if there's another function you can use instead to give them different heroes. You might have to just save each player's individual selections and use ReplaceHeroWith once the game starts.

  • edited January 2017 Posts: 273

    @devilesk You probably miseunderstood my question, but yet you answered partially, weird ...

    The problem is: When some custom game has more teams (2,3,5,10...), when you enter that custom game mode you are automatically assigned to the first empty team. For Example: If you are the only player entering the custom game, you are assigned to the first team (DOTA_TEAM_GOODGUYS or DOTA_TEAM_CUSTOM_1) and you can't change that. For dota like custom game, you can't chose Dire team, you are assigned to Radiant.

    And you are telling me that you can access custom game setup only if you force a hero with SetCustomGameForceHero during that game state? And I have to make custom hero selection because Valve fucked up with Dark Moon?

    Edit: https://github.com/ModDota/BugTracker/issues/67

  • And you are telling me that you can access custom game setup only if you force a hero with SetCustomGameForceHero during that game state? And I have to make custom hero selection because Valve fucked up with Dark Moon?

    @Darkonius Yes, that's what I was saying in my previous comment. But that's no longer the case. The comment in that github issue you linked by Yahnich suggests a much better workaround. I replied to it with my own implementation based on that idea. https://github.com/ModDota/BugTracker/issues/67#issuecomment-275948310

  • Posts: 273

    @devilesk

    Thanks. That's the simplest workaround.