Created
December 12, 2018 12:57
-
-
Save pohka/6223916e237c08e887ad833c304b6a8f to your computer and use it in GitHub Desktop.
Dota custom games quick setup to skip right to the game mode 0:00
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function MyCustomGame:InitGameMode() | |
--skip all the starting game mode stages e.g picking screen, showcase, etc | |
GameRules:EnableCustomGameSetupAutoLaunch(true) | |
GameRules:SetCustomGameSetupAutoLaunchDelay(0) | |
GameRules:SetHeroSelectionTime(0) | |
GameRules:SetStrategyTime(0) | |
GameRules:SetPreGameTime(0) | |
GameRules:SetShowcaseTime(0) | |
GameRules:SetPostGameTime(5) | |
--disable some setting which are annoying then testing | |
local GameMode = GameRules:GetGameModeEntity() | |
GameMode:SetAnnouncerDisabled(true) | |
GameMode:SetKillingSpreeAnnouncerDisabled(true) | |
GameMode:SetDaynightCycleDisabled(true) | |
GameMode:DisableHudFlip(true) | |
GameMode:SetDeathOverlayDisabled(true) | |
GameMode:SetWeatherEffectsDisabled(true) | |
--disable music events | |
GameRules:SetCustomGameAllowHeroPickMusic(false) | |
GameRules:SetCustomGameAllowMusicAtGameStart(false) | |
GameRules:SetCustomGameAllowBattleMusic(false) | |
--loop through each player on every team and random a hero if they haven't picked | |
local maxPlayers = 5 | |
for teamNum = DOTA_TEAM_GOODGUYS, DOTA_TEAM_BADDGUYS do | |
for i=1, maxPlayers do | |
local playerID = PlayerResource:GetNthPlayerIDOnTeam(teamNum, i) | |
if playerID ~= nil then | |
if not PlayerResource:HasSelectedHero(playerID) then | |
local hPlayer = PlayerResource:GetPlayer(playerID) | |
if hPlayer ~= nil then | |
hPlayer:MakeRandomHeroSelection() | |
end | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment