-- Generated from template if CAddonTemplateGameMo de nil then CAddonT

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
-- Generated from template
if CAddonTemplateGameMode == nil then
CAddonTemplateGameMode = class({})
end
function Precache( context )
PrecacheUnitByNameSync("npc_dota_hero_zuus", context)
PrecacheUnitByNameSync("npc_dota_hero_magnataur", context)
PrecacheUnitByNameSync("npc_dota_hero_nevermore", context)
--[[
Precache things we know we'll use. Possible file types include (but not limited to):
PrecacheResource( "model", "*.vmdl", context )
PrecacheResource( "soundfile", "*.vsndevts", context )
PrecacheResource( "particle", "*.vpcf", context )
PrecacheResource( "particle_folder", "particles/folder", context )
]]
end
-- Create the game mode when we activate
function Activate()
GameRules:SetSameHeroSelectionEnabled(true)
GameRules.AddonTemplate = CAddonTemplateGameMode()
GameRules.AddonTemplate:InitGameMode()
end
function CAddonTemplateGameMode:InitGameMode()
print( "Template addon is loaded." )
GameRules:GetGameModeEntity():SetThink( "OnThink", self, "GlobalThink", 2 )
end
-- Evaluate the state of the game
function CAddonTemplateGameMode:OnThink()
if GameRules:State_Get() == DOTA_GAMERULES_STATE_GAME_IN_PROGRESS then
print( "Template addon script is running." )
elseif GameRules:State_Get() >= DOTA_GAMERULES_STATE_POST_GAME then
return nil
end
return 1
end
function CAddonTemplateGameMode:OnNPCSpawned(tbl)
local npc = EntIndexToHScript( tbl.entindex )
if npc and npc:IsRealHero() and npc:GetClassname() == "npc_dota_hero_shadow_fiend_holdout" then
-- 0-2: shadowraze; 3: necromastery; 4: dark_lord; 5: requiem
npc:GetAbilityByIndex( 4 ):SetLevel( 2 )
print( "I am work" )
end
end