local polPhase = 1 local polPos = null local spearPos = null local polShield = false local star = null local position = null local phase2Count = 0 local constellationPhase = 0 local starPos = null local canSummon = true local spear = null local spearCarrier = null local enraged = false local polaris = null local spearTimer = 0 //how do callbacks even work local EventsID = UniqueString() getroottable()[EventsID] <- { OnGameEvent_scorestats_accumulated_update = function(params) { delete getroottable()[EventsID] } OnGameEvent_teamplay_flag_event = function(params) { if(PlayerInstanceFromIndex(params.player).GetTeam() == 2) { if(params.eventtype == 1) // event 1 = pick up { spearCarrier = params.player ClientPrint(params.player,4,"\x07You have picked up a Stellar Bomb! If you are still holding it in 30 seconds you will die!") AddThinkToEnt(PlayerInstanceFromIndex(params.player),"spearThink") } if(params.eventtype == 4) // event 4 = drop { ClientPrint(params.player,4,"") spearPos = null spearCarrier = null spearTimer = 0 AddThinkToEnt(PlayerInstanceFromIndex(params.player), null) NetProps.SetPropString(PlayerInstanceFromIndex(params.player),"m_iszScriptThinkFunction","") } } } } local EventsTable = getroottable()[EventsID] foreach (name, callback in EventsTable) EventsTable[name] = callback.bindenv(this) __CollectGameEventCallbacks(EventsTable) // ClientPrint(null,3,"\x079ccddc:3") // printl("Checking for bosses ...") for (local i = 1; i <= Constants.Server.MAX_PLAYERS; i++) { local player = PlayerInstanceFromIndex(i) if(player == null) continue if(!IsPlayerABot(player)) continue if(player.HasBotTag("boss")) { // printl("player: "+i+" is a boss") AddThinkToEnt(player,"PolarisThink") polaris = player } } local polarisGlow = SpawnEntityFromTable("tf_glow" { target = "gamerules" GlowColor = "200 255 255 255", targetname = "polarisGlow", startdisabled = 0, Mode = 0 }) NetProps.SetPropEntity(polarisGlow, "m_hTarget", polaris) local starGlow = SpawnEntityFromTable("tf_glow" { target = "gamerules" GlowColor = "200 255 255 155", targetname = "starGlow", startdisabled = 0, Mode = 0 }) ::spearThink <- function() { if(GetRoundState() == 4){ // ClientPrint(null,3,"\x079ccddcflag is being held") if(spearCarrier != null) { if(spearTimer >=4) { ClientPrint(PlayerInstanceFromIndex(spearCarrier),4,(30-spearTimer)+" Seconds left") } if(spearTimer >=30) { ClientPrint(PlayerInstanceFromIndex(spearCarrier),4,"") PlayerInstanceFromIndex(spearCarrier).TakeDamage(9999,1,PlayerInstanceFromIndex(spearCarrier)) } spearTimer++ return 1 } else{ spearTimer = 0 spearCarrier = null spearPos = null AddThinkToEnt(self, null) NetProps.SetPropString(self,"m_iszScriptThinkFunction","") } } else{ spearTimer = 0 spearCarrier = null spearPos = null AddThinkToEnt(self, null) NetProps.SetPropString(self,"m_iszScriptThinkFunction","") } } ::starThink <- function() { if(GetRoundState() == 4){ // printl("star is thinking real hard :3") if(self.IsAlive()){ starPos = self.GetOrigin() return -1 } else{ spear = SpawnEntityFromTable("item_teamflag", { flag_model = "models/props_td/atom_bomb.mdl", // angles = Vector(270,0,0), origin = Vector(starPos.x,starPos.y,starPos.z), GameType = 1, ReturnTime = 9999, TeamNum = 2, trail_effect = 3, Name = "starBomb" }) local bombGlow = SpawnEntityFromTable("tf_glow" { target = "gamerules" GlowColor = "255 0 0 155", targetname = "bombGlow", startdisabled = 0, Mode = 0 }) NetProps.SetPropEntity(bombGlow, "m_hTarget", spear) SendGlobalGameEvent("show_annotation", { text = "A Stellar Bomb has dropped! Deliver it to Polaris while weakened!", lifetime = 5, worldPosX = starPos.x, worldPosY = starPos.y, worldPosZ = starPos.z+50, play_sound = "misc/null.wav", id = 1 }) NetProps.SetPropEntity(starGlow, "m_hTarget", "gamerules") AddThinkToEnt(self, null) NetProps.SetPropString(self,"m_iszScriptThinkFunction","") } } else{ NetProps.SetPropEntity(starGlow, "m_hTarget", "gamerules") AddThinkToEnt(self, null) NetProps.SetPropString(self,"m_iszScriptThinkFunction","") } } ::activateStarGlow <- function() { NetProps.SetPropEntity(starGlow, "m_hTarget", star) SendGlobalGameEvent("teamplay_broadcast_audio", { team = -1, sound = "mvm/mvm_tele_activate.wav" }) } ::teleAnim <- function() { star.AddCondEx(130,10,self) star.AddCondEx(51,10,self) ClientPrint(null,3,"\x079f9cdcA \x07e087f4Constellation Robot\x079f9cdc is invading! Killing it will drop a Stellar Bomb!") DispatchParticleEffect("teleported_mvm_bot",position,star.GetAngles()) EntFireByHandle(star,"RunScriptCode","activateStarGlow()",9,null,null) local prop = SpawnEntityFromTable("prop_dynamic", { model = "models/props_halloween/hwn_tent_pole01.mdl", origin = position, rendermode = 10, modelscale = 0.25, disableshadows = 1, // solid = 2 }) local particle = SpawnEntityFromTable("trigger_particle", { particle_name = "utaunt_twinkling_goldsilver_parent", attachment_type = 1, spawnflags = 64 }) EntFireByHandle(particle, "StartTouch", "!activator", 1, prop, prop) EntFireByHandle(particle, "Kill", "", 1, null, null) //EntFireByHandle(star,"DispatchEffect","ParticleEffectStop",3,null,null) EntFireByHandle(prop, "Kill", "", 9, null, null) } ::getStar <- function(startag) { for (local i = 1; i <= Constants.Server.MAX_PLAYERS; i++) { local player = PlayerInstanceFromIndex(i) if(player == null) continue if(!IsPlayerABot(player)) continue if(player.HasBotTag(startag)) { return player } } } // get dummy local dummy = getStar("Dummy") // initial stellar bomb spawn spear = SpawnEntityFromTable("item_teamflag", { flag_model = "models/props_td/atom_bomb.mdl", // angles = Vector(270,0,0), origin = Vector(1900, -625, -415), GameType = 1, ReturnTime = 9999, TeamNum = 2, trail_effect = 3, Name = "starBomb" }) local bombGlow = SpawnEntityFromTable("tf_glow" { target = "gamerules" GlowColor = "255 0 0 155", targetname = "bombGlow", startdisabled = 0, Mode = 0 }) NetProps.SetPropEntity(bombGlow, "m_hTarget", spear) SendGlobalGameEvent("show_annotation", { text = "This is a Stellar Bomb, deliver it to Polaris while weakened!", lifetime = 8, worldPosX = 1900, worldPosY = -625, worldPosZ = -350, play_sound = "misc/null.wav", id = 1, }) ::PolarisThink <- function() { if(GetRoundState() == 4) { if(polPhase == 1){ polPos = self.GetOrigin() if(self.GetHealth()<61600){ polPhase=2 ClientPrint(null,3,"\x07e087f4Polaris \x079f9cdchas been weakened for 15 seconds") // weapons/drg_pomson_drain_01.wav SendGlobalGameEvent("teamplay_broadcast_audio", { team = -1, sound = "weapons/drg_pomson_drain_01.wav" }) EntFire("change_attributes_relay", "Trigger") self.DropFlag(true) self.AddCondEx(130,-1,self) self.AddCondEx(51,-1,self) EntFire("polarisGlow","SetGlowColor","225 155 255 255") } else{ // check and update fake hp bar if(-1*((5000-dummy.GetHealth())-(66600-self.GetHealth()))= -2230 && polPos.x <= -760 && polPos.y >= 730 && polPos.y <= 2100) { if(constellationPhase < 8) { polPhase = 3 enraged = true ClientPrint(null,3,"\x07e087f4Polaris \x079f9cdchas enraged!") if(constellationPhase == 0) { self.SetHealth(66600) } if(constellationPhase == 2) { self.SetHealth(57520) } if(constellationPhase == 4) { self.SetHealth(48840) } if(constellationPhase == 6) { self.SetHealth(39960) } } } } } if(polPhase == 2){ if(phase2Count >= 70){ EntFire("change_attributes_relay_default", "Trigger") polPhase = 1 phase2Count = 0 canSummon = true self.SetUseBossHealthBar(false) self.RemoveCondEx(130,true) self.RemoveCondEx(51,true) self.SetHealth(66600) EntFire("polarisGlow","SetGlowColor","200 255 255 255") ClientPrint(null,3,"\x07e087f4Polaris \x079f9cdchas returned to full strength") } else{ // check if spear is in range if(canSummon){ if(spearCarrier != null) { spearPos = PlayerInstanceFromIndex(spearCarrier).GetOrigin() } if(polPos != null) { if(spearPos != null) { if(abs(polPos.x-spearPos.x) <= 200 && abs(polPos.y-spearPos.y) <= 200 && abs(polPos.x-spearPos.x) <= 200){ canSummon = false // also delete flag spearPos = null spearTimer = 0 SendGlobalGameEvent("teamplay_broadcast_audio", { team = -1, sound = "player/spy_shield_break.wav" }) ClientPrint(PlayerInstanceFromIndex(spearCarrier),4,"") AddThinkToEnt(PlayerInstanceFromIndex(spearCarrier), null) NetProps.SetPropString(PlayerInstanceFromIndex(spearCarrier),"m_iszScriptThinkFunction","") EntFireByHandle(bombGlow, "Disable", "",0.15, null, null) // kill bomb glow?????? or turn it off temporarily EntFireByHandle(spear, "Kill", "",0.15, null, null) self.SetUseBossHealthBar(true) EntFireByHandle(self,"RunScriptCode","self.SetUseBossHealthBar(false)",(70-phase2Count)/5,null,null) if(constellationPhase == 0){ constellationPhase = 1 self.SetHealth(57520) } if(constellationPhase == 2){ constellationPhase = 3 self.SetHealth(48840) } if(constellationPhase == 4){ constellationPhase = 5 self.SetHealth(39960) } if(constellationPhase == 6){ constellationPhase = 7 self.SetHealth(31080) } if(constellationPhase == 8){ // Final phase self.SetHealth(22200) polPhase = 3 // :3 ClientPrint(null,3,"\x07e087f4Polaris's \x079f9cdcshields are down for good!") EntFire("polarisGlow","SetGlowColor","200 255 255 255") self.RemoveCondEx(130,true) self.RemoveCondEx(51,true) } } } } } // summon constellations if(constellationPhase == 1){ // Spawn Capricorn //1519 -750 -500 star = getStar("Capricorn") position = Vector(1519,-750,-500) teleAnim() EntFireByHandle(star,"RunScriptCode","self.SetOrigin(Vector(1519,-750,-500))",9,null,null) EntFireByHandle(star,"RunScriptCode","self.SetUseBossHealthBar(true)",9,null,null) EntFire("spawnMiniBoss","Enable","",9) EntFire("spawnMiniBoss","Disable","",15) AddThinkToEnt(star,"starThink") constellationPhase = 2 } if(constellationPhase == 3){ // Spawn Saggittarius // 1862 1705 -420 star = getStar("Saggittarius") position = Vector(1862, 1705, -420) teleAnim() EntFireByHandle(star,"RunScriptCode","self.SetOrigin(Vector(1862, 1705, -420))",9,null,null) EntFireByHandle(star,"RunScriptCode","self.SetUseBossHealthBar(true)",9,null,null) EntFire("spawnMiniBoss","Enable","",9) EntFire("spawnMiniBoss","Disable","",15) AddThinkToEnt(star,"starThink") constellationPhase = 4 } if(constellationPhase == 5){ // Spawn Scorpio // 1054 1674 -200 star = getStar("Scorpio") position = Vector(1054, 1674, -200) teleAnim() EntFireByHandle(star,"RunScriptCode","self.SetOrigin(Vector(1054, 1674, -200))",9,null,null) EntFireByHandle(star,"RunScriptCode","self.SetUseBossHealthBar(true)",9,null,null) EntFire("spawnMiniBoss","Enable","",9) EntFire("spawnMiniBoss","Disable","",15) AddThinkToEnt(star,"starThink") constellationPhase = 6 } if(constellationPhase == 7){ // Spawn Libra // -445 2520 -200 star = getStar("Libra") position = Vector(-445, 2520, -200) teleAnim() EntFireByHandle(star,"RunScriptCode","self.SetOrigin(Vector(-445, 2520, -200))",10,null,null) EntFireByHandle(star,"RunScriptCode","self.SetUseBossHealthBar(true)",10,null,null) EntFire("spawnMiniBoss","Enable","",9) EntFire("spawnMiniBoss","Disable","",15) AddThinkToEnt(star,"starThink") constellationPhase = 8 } phase2Count++ return 0.15 } } if(polPhase == 3){ dummy.TakeDamage(9999,1,dummy) self.SetUseBossHealthBar(true) // mvm/mvm_warning.wav" SendGlobalGameEvent("teamplay_broadcast_audio", { team = -1, sound = "mvm/mvm_warning.wav" }) EntFire("change_attributes_relay2", "Trigger") if(enraged) { // Capricorn -750 3170 -120 star = getStar("Capricorn") if(star != null) { if(star.IsAlive()) { star.SetOrigin(Vector(-750, 3170, -120)) } } // Saggittarius -480 150 -150 star = getStar("Saggittarius") if(star != null) { if(star.IsAlive()) { star.SetOrigin(Vector(-480, 150, -150)) } } // Scorpio -1675 2940 -230 star = getStar("Scorpio") if(star != null) { if(star.IsAlive()) { star.SetOrigin(Vector(-1675, 2940, -230)) } } // Libra -130 950 50 star = getStar("Libra") if(star != null) { if(star.IsAlive()) { star.SetOrigin(Vector(-130, 950, 50)) } } } polPhase = 4 } } else { // printl(":3") AddThinkToEnt(self, null) NetProps.SetPropString(self,"m_iszScriptThinkFunction","") } return -1 }