- 4 Окт 2014
- 473
- 2
У меня не работает не стартовый уровень -6 и не работает убийств до победы,помогите пожалуйста)
if DotaPvP == nil then
DotaPvP = class({})
end
--------------------------------------------------------------------------------
-- ACTIVATE
--------------------------------------------------------------------------------
function Activate()
GameRules.DotaPvP = DotaPvP()
GameRules.DotaPvP:InitGameMode()
end
--------------------------------------------------------------------------------
-- INIT
--------------------------------------------------------------------------------
function DotaPvP:InitGameMode()
local GameMode = GameRules:GetGameModeEntity()
-- Enable the standard Dota PvP game rules
GameRules:GetGameModeEntity():SetTowerBackdoorProtectionEnabled( true )
-- Register Think
GameMode:SetContextThink( "DotaPvP:GameThink", function() return self:GameThink() end, 0.25 )
-- Register Game Events
end
--------------------------------------------------------------------------------
function DotaPvP:GameThink()
return 0.25
end
function Precache( context )
PrecacheUnitByNameSync("npc_dota_hero_lina", context)
end
print( "Dota PvP game mode loaded." )
if DotaPvP == nil then
DotaPvP = class({})
end
function Activate()
GameRules.DotaPvP = DotaPvP()
GameRules.DotaPvP:InitGameMode()
end
function DotaPvP:InitGameMode()
local GameMode = GameRules:GetGameModeEntity()
-- Enable the standard Dota PvP game rules
GameRules:SetSameHeroSelectionEnabled(true)
self.direKills = 0
self.radiantKills = 0
self.kills_to_win = 50
ListenToGameEvent("entity_killed", Dynamic_Wrap(CAddonTemplateGameMode, "OnEntityKilled"), self)
end
function DotaPvP:OnNPCSpawned(keys)
local spawnedUnit = EntIndexToHScript(keys.entindex)
if spawnedUnit:IsHero() then
local level = spawnedUnit:GetLevel()
while level < 6 do
spawnedUnit:AddExperience (2000,true)
level = spawnedUnit:GetLevel()
end
end
end
function DotaPvP:OnEntityKilled(keys)
local killedEntity = EntIndexToHScript(keys.entindex_killed)
if killedEntity:IsRealHero() then
local playerTeam = killedEntity:GetTeam()
if playerTeam == 2 then
self.direKills = self.direKills + 1
if self.direKills >= self.kills_to_win then
GameRules:SetSafeToLeave( true )
GameRules:SetGameWinner( DOTA_TEAM_BADGUYS )
end
elseif playerTeam == 3 then
self.radiantKills = self.radiantKills + 1
if self.radiantKills >= self.kills_to_win then
GameRules:SetSafeToLeave( true )
GameRules:SetGameWinner( DOTA_TEAM_GOODGUYS )
end
end
end
end
if DotaPvP == nil then
DotaPvP = class({})
end
--------------------------------------------------------------------------------
-- ACTIVATE
--------------------------------------------------------------------------------
function Activate()
GameRules.DotaPvP = DotaPvP()
GameRules.DotaPvP:InitGameMode()
end
--------------------------------------------------------------------------------
-- INIT
--------------------------------------------------------------------------------
function DotaPvP:InitGameMode()
local GameMode = GameRules:GetGameModeEntity()
-- Enable the standard Dota PvP game rules
GameRules:GetGameModeEntity():SetTowerBackdoorProtectionEnabled( true )
-- Register Think
GameMode:SetContextThink( "DotaPvP:GameThink", function() return self:GameThink() end, 0.25 )
-- Register Game Events
end
--------------------------------------------------------------------------------
function DotaPvP:GameThink()
return 0.25
end
function Precache( context )
PrecacheUnitByNameSync("npc_dota_hero_lina", context)
end
print( "Dota PvP game mode loaded." )
if DotaPvP == nil then
DotaPvP = class({})
end
function Activate()
GameRules.DotaPvP = DotaPvP()
GameRules.DotaPvP:InitGameMode()
end
function DotaPvP:InitGameMode()
local GameMode = GameRules:GetGameModeEntity()
-- Enable the standard Dota PvP game rules
GameRules:SetSameHeroSelectionEnabled(true)
self.direKills = 0
self.radiantKills = 0
self.kills_to_win = 50
ListenToGameEvent("entity_killed", Dynamic_Wrap(CAddonTemplateGameMode, "OnEntityKilled"), self)
end
function DotaPvP:OnNPCSpawned(keys)
local spawnedUnit = EntIndexToHScript(keys.entindex)
if spawnedUnit:IsHero() then
local level = spawnedUnit:GetLevel()
while level < 6 do
spawnedUnit:AddExperience (2000,true)
level = spawnedUnit:GetLevel()
end
end
end
function DotaPvP:OnEntityKilled(keys)
local killedEntity = EntIndexToHScript(keys.entindex_killed)
if killedEntity:IsRealHero() then
local playerTeam = killedEntity:GetTeam()
if playerTeam == 2 then
self.direKills = self.direKills + 1
if self.direKills >= self.kills_to_win then
GameRules:SetSafeToLeave( true )
GameRules:SetGameWinner( DOTA_TEAM_BADGUYS )
end
elseif playerTeam == 3 then
self.radiantKills = self.radiantKills + 1
if self.radiantKills >= self.kills_to_win then
GameRules:SetSafeToLeave( true )
GameRules:SetGameWinner( DOTA_TEAM_GOODGUYS )
end
end
end
end
Последнее редактирование модератором: