require( 'timers' )
require( 'barebones' )
GLOBAL_MOBS = 4
GAME_ROUND = 0
MAX_ROUNDS = 5
ROUND_DURATION = 10
ROUND_UNITS = 2
function Precache( context )
print("[BAREBONES] Performing pre-load precache")
PrecacheResource("particle", "particles/econ/generic/generic_aoe_explosion_sphere_1/generic_aoe_explosion_sphere_1.vpcf", context)
PrecacheResource("particle_folder", "particles/test_particle", context)
PrecacheResource("model_folder", "particles/heroes/antimage", context)
PrecacheResource("model", "particles/heroes/viper/viper.vmdl", context)
PrecacheModel("models/heroes/viper/viper.vmdl", context)
PrecacheResource("soundfile", "soundevents/game_sounds_heroes/game_sounds_gyrocopter.vsndevts", context)
PrecacheUnitByNameSync("example_unit_1", context)
PrecacheItemByNameSync("example_ability", context)
PrecacheItemByNameSync("item_example_item", context)
PrecacheUnitByNameSync("npc_dota_hero_ancient_apparition", context)
PrecacheUnitByNameSync("npc_dota_hero_enigma", context)
end
function Activate()
GameRules.GameMode = GameMode()
GameRules.GameMode:InitGameMode()
end
function creep_die(keys)
GLOBAL_MOBS = GLOBAL_MOBS - 1
end
function GameMode:OnGameInProgress()
local point = Entities:FindByName( nil, "spawnerino"):GetAbsOrigin()
local waypoint = Entities:FindByName( nil, "way1")
local return_time = 10
Timers:CreateTimer(10, function()
GAME_ROUND = GAME_ROUND + 1
if GAME_ROUND == MAX_ROUNDS then
return_time = nil
end
Say(nil,"Wave №" .. GAME_ROUND, false)
if GAME_ROUND == 1 then
GLOBAL_MOBS = 4
end
for i=1, ROUND_UNITS do
local unit = CreateUnitByName( "example_unit_" .. GAME_ROUND, point + RandomVector( RandomFloat( 0, 200 ) ), true, nil, nil, DOTA_TEAM_GOODGUYS )
unit:SetInitialGoalEntity( waypoint )
local uni = CreateUnitByName( "example_unit_" .. GAME_ROUND + 1, point + RandomVector( RandomFloat( 0, 200 ) ), true, nil, nil, DOTA_TEAM_GOODGUYS )
uni:SetInitialGoalEntity( waypoint )
end
if GLOBAL_MOBS == 0 then
return return_time
end
end)
end