开局随机选择英雄
function Main:init_game_mode()
ListenToGameEvent("game_rules_state_change", Dynamic_Wrap(Main, "game_start"), self)
end
function Main:game_start()
if GameRules:State_Get() == DOTA_GAMERULES_STATE_HERO_SELECTION then
for playerid = 0, (PlayerResource:GetTeamPlayerCount()) do
local hPlayer = PlayerResource:GetPlayer( playerid )
if hPlayer then
hPlayer:MakeRandomHeroSelection()
end
end
end
end
function Main:init_game_mode()
ListenToGameEvent("game_rules_state_change", Dynamic_Wrap(Main, "game_start"), self)
end
function Main:game_start()
if GameRules:State_Get() == DOTA_GAMERULES_STATE_HERO_SELECTION then
for playerid = 0, (PlayerResource:GetTeamPlayerCount()) do
local hPlayer = PlayerResource:GetPlayer( playerid )
if hPlayer then
hPlayer:MakeRandomHeroSelection()
end
end
end
end