Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print ('[ZOMBIEARENA] ZombieArena.lua')
- DISABLE_FOG_OF_WAR_ENTIRELY = false
- UNSEEN_FOG_ENABLED = false
- XP_PER_LEVEL_TABLE = {
- 0, -- 1
- 100, -- 2
- 200, -- 3
- 300, -- 4
- 400, -- 5
- 500, -- 6
- 600, -- 7
- 700, -- 8
- 800, -- 9
- 900, -- 10
- 1000, -- 11
- 1500, -- 12
- 2000, -- 13
- 2500, -- 14
- 3000, -- 15
- 3500, -- 16
- 4000, -- 17
- 4500, -- 18
- 5000, -- 19
- 6000, -- 20
- 7000, -- 21
- 8000, -- 22
- 9000, -- 23
- 10000, -- 24
- 15000, -- 25
- 20000, -- 26
- 25000, -- 27
- 30000, -- 28
- 35000, -- 29
- 40000, -- 30
- 45000, -- 31
- 50000, -- 32
- 55000, -- 33
- 60000, -- 34
- 65000, -- 35
- 70000, -- 36
- 75000, -- 37
- 80000, -- 38
- 85000, -- 39
- 90000, -- 40
- 95000, -- 41
- 100000, -- 42
- 110000, -- 43
- 120000, -- 44
- 130000, -- 45
- 140000, -- 46
- 150000, -- 47
- 160000, -- 48
- 170000, -- 49
- 200000, -- 50
- }
- function ZombieArena:InitGameMode()
- print( "[ZOMBIEARENA] Loading gamemode..." )
- -- Setup rules
- GameRules:SetHeroRespawnEnabled( true )
- GameRules:SetUseUniversalShopMode( false )
- GameRules:SetSameHeroSelectionEnabled( true )
- GameRules:SetHeroSelectionTime( 0 )
- GameRules:SetPreGameTime( 30 )
- GameRules:SetPostGameTime( 0 )
- GameRules:SetTreeRegrowTime( 1000.0 )
- GameRules:SetUseCustomHeroXPValues ( true )
- GameRules:SetGoldPerTick(0)
- GameRules:SetUseBaseGoldBountyOnHeroes( false ) -- Need to check legacy values
- GameRules:SetHeroMinimapIconScale( 1 )
- GameRules:SetCreepMinimapIconScale( 1 )
- GameRules:SetRuneMinimapIconScale( 1 )
- GameRules:SetFirstBloodActive( false )
- GameRules:SetHideKillMessageHeaders( true )
- GameRules:EnableCustomGameSetupAutoLaunch( false )
- -- Set game mode rules
- GameMode = GameRules:GetGameModeEntity()
- GameMode:SetRecommendedItemsDisabled( true )
- GameMode:SetBuybackEnabled( false )
- GameMode:SetTopBarTeamValuesOverride ( true )
- GameMode:SetTopBarTeamValuesVisible( true )
- GameMode:SetUseCustomHeroLevels ( true )
- GameMode:SetUnseenFogOfWarEnabled( UNSEEN_FOG_ENABLED )
- GameMode:SetTowerBackdoorProtectionEnabled( false )
- GameMode:SetGoldSoundDisabled( true )
- GameMode:SetRemoveIllusionsOnDeath( true )
- GameMode:SetAnnouncerDisabled( true )
- GameMode:SetLoseGoldOnDeath( false )
- GameMode:SetCustomXPRequiredToReachNextLevel( XP_PER_LEVEL_TABLE )
- GameMode:SetFogOfWarDisabled( DISABLE_FOG_OF_WAR_ENTIRELY )
- GameMode:SetCustomHeroMaxLevel ( 50 )
- -- Team Configuartion
- if GetMapName() == "zombiejungle_map1" then
- GameRules:SetCustomGameTeamMaxPlayers( DOTA_TEAM_GOODGUYS, 5 )
- GameRules:SetCustomGameTeamMaxPlayers( DOTA_TEAM_BADGUYS, -1 )
- end
- -- Event Hooks
- ListenToGameEvent('player_connect_full', Dynamic_Wrap(ZombieArena, 'OnConnectFull'), self)
- ListenToGameEvent('npc_spawned', Dynamic_Wrap(ZombieArena, 'OnNPCSpawned'), self)
- ListenToGameEvent('dota_player_pick_hero', Dynamic_Wrap(ZombieArena, 'OnPlayerPickHero'), self)
- ListenToGameEvent('game_rules_state_change', Dynamic_Wrap(ZombieArena, 'BeginWaves'), self)
- -- Full units file to get the custom values
- GameRules.AbilityKV = LoadKeyValues("scripts/npc/npc_abilities_custom.txt")
- GameRules.UnitKV = LoadKeyValues("scripts/npc/npc_units_custom.txt")
- GameRules.HeroKV = LoadKeyValues("scripts/npc/npc_heroes_custom.txt")
- GameRules.ItemKV = LoadKeyValues("scripts/npc/npc_items_custom.txt")
- print( "[ZOMBIEARENA] Loading gamemode completed!")
- end
- function ZombieArena:OnConnectFull(keys)
- print ('[ZOMBIEARENA] OnConnectFull')
- end
- function ZombieArena:OnFirstPlayerLoaded()
- print("[ZOMBIEARENA] First Player has loaded")
- end
- function ZombieArena:OnAllPlayersLoaded()
- print("[ZOMBIEARENA] All Players have loaded into the game")
- end
- function ZombieArena:OnHeroInGame( hero )
- local hero_name = hero:GetUnitName()
- print("[ZOMBIEARENA] OnHeroInGame "..hero_name)
- Attributes:ModifyBonuses(hero)
- end
- function ZombieArena:InitializePlayer( hero )
- local player = hero:GetPlayerOwner()
- local playerID = hero:GetPlayerID()
- print("[ZOMBIEARENA] Initializing main hero entity for player "..playerID)
- Players:Init(playerID, hero)
- end
- -- An NPC has spawned somewhere in game. This includes heroes
- function ZombieArena:OnNPCSpawned(keys)
- --print("[DOTACRAFT] NPC Spawned")
- --DeepPrintTable(keys)
- local npc = EntIndexToHScript(keys.entindex)
- if npc:IsHero() then
- npc.strBonus = 0
- npc.intBonus = 0
- npc.agilityBonus = 0
- npc.attackspeedBonus = 0
- end
- if npc:IsRealHero() and npc.bFirstSpawned == nil then
- npc.bFirstSpawned = true
- ZombieArena:OnHeroInGame(npc)
- end
- end
- -- A player picked a hero
- function ZombieArena:OnPlayerPickHero(keys)
- print ('[ZOMBIEARENA] OnPlayerPickHero')
- local hero = EntIndexToHScript(keys.heroindex)
- local player = EntIndexToHScript(keys.player)
- local playerID = hero:GetPlayerID()
- -- Remove invulnerability from GoldenIdol
- local GoldenIdol = Entities:FindByName(nil, "building_gold_idol")
- GoldenIdol:SetControllableByPlayer(playerID, false)
- GoldenIdol:RemoveModifierByName("modifier_invulnerable")
- end
- function ZombieArena:BeginWaves( keys )
- print(GameRules:State_Get())
- if GameRules:State_Get() == 7 then
- local ZombieTower_high = Entities:FindByName(nil, "npc_zombie_spawner1")
- local ZombieTower_low = Entities:FindByName(nil, "npc_zombie_spawner2")
- local ZTh_location = ZombieTower_high:GetAbsOrigin()
- local ZTl_location = ZombieTower_low:GetAbsOrigin()
- local waitingForNextRound = 1
- for round_num = 1,3 do
- local messageinfo_round = {
- message = 'Round '..round_num,
- dur = 5000,
- bool = true
- }
- FireGameEvent("show_center_message", messageinfo_round)
- --spawn a generic zombie
- if round_num == 1 then
- local ZombieTower_high = CreateUnitByName("Undead Warrior", ZTh_location, true, hero, hero, DOTA_TEAM_BADGUYS)
- else if round_num == 2 then
- local ZombieTower_low = CreateUnitByName("Strong Warrior", ZTl_location, true, hero, hero, DOTA_TEAM_BADGUYS)
- else if round_num == 3 then
- local ZombieTower_high = CreateUnitByName("Undead Warrior", ZTh_location, true, hero, hero, DOTA_TEAM_BADGUYS)
- local ZombieTower_low = CreateUnitByName("Strong Warrior", ZTl_location, true, hero, hero, DOTA_TEAM_BADGUYS)
- end
- while waitingForNextRound == 1
- do
- local remaining_undead = Entities:FindAllByName('Undead Warrior')
- local remaining_strong = Entities:FindAllByName('Strong Warrior')
- local remaining_nzombies = table.getn(remaining_undead) + table.getn(remaining_strong)
- print('Remaining Zombies: '..remaining_nzombies)
- if remaining_nzombies == 0 then
- print('Next Round: '..round_num + 1)
- break end
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement