dota2地图编辑器吧 关注:1,675贴子:6,692
  • 0回复贴,共1

在lua脚本中自定义游戏模式

只看楼主收藏回复

开局随机选择英雄
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


IP属地:上海1楼2019-04-10 21:10回复