--Created by Wacev local scout_health = 1600-125 local soldier_health = 3800-200 local pyro_health = 3500-175 local demo_health = 3000-175 local heavy_health = 5000-300 local engie_health = 2000-125 local medic_health = 2500-150 local sniper_health = 1600-125 local spy_health = 2400-125 local wavestarted = false local alerted = false local drone_state_tbl = { [1] = "Follow Player Mode: Enabled", [2] = "Find and Follow Enemy Mode: Enabled", [3] = "Hover Mode: Enabled" } local drone_state_mini_tbl = { [1] = { [1] = "Follow Player", [2] = 1.05, }, [2] = { [1] = "Follow Enemy", [2] = 1.05 }, [3] = { [1] = "Hover", [2] = 1.15 } } local boss_phase = 1 local boss = nil local boss_delay = CurTime() local boss_attack_tbl = { -- phase 1 { { attack = "Attack_1", duration = 20, Icon = "soldier_barrage_homing_nys_giant" }, { attack = "Attack_2", duration = 20, Icon = "soldier_bazooka_homing_nys_giant" }, { attack = "Attack_3", duration = 12, Icon = "soldier_rocketrain_homing_nys_giant" }, { attack = "Attack_4", duration = 15, Icon = "soldier_rocketwall_giant" }, { attack = "Attack_5", duration = 15, Icon = "soldier_rocketrain" }, { attack = "Attack_6", duration = 15, Icon = "soldier_hyper_lite" } }, -- phase 2 { { attack = "Attack_1", duration = 20, Icon = "soldier_barrage_homing_nys_giant" }, { attack = "Attack_8", duration = 20, Icon = "soldier_bazooka_homing_nys_giant" }, { attack = "Attack_3", duration = 12, Icon = "soldier_rocketrain_homing_nys_giant" }, { attack = "Attack_4", duration = 15, Icon = "soldier_rocketwall_giant" }, { attack = "Attack_10", duration = 15, Icon = "soldier_rocketrain" }, { attack = "Attack_6", duration = 15, Icon = "soldier_hyper_lite" }, { attack = "Attack_7", duration = 20, Icon = "soldier_rocketrain_homing_hyper_giant" }, { attack = "Attack_9", duration = 20, Icon = "soldier_barrage_homing_nys_giant" } }, -- phase 3 { { attack = "Attack_1", duration = 10, Icon = "soldier_barrage_homing_nys_giant" }, { attack = "Attack_14", duration = 10, Icon = "soldier_bazooka_homing_nys_giant" }, { attack = "Attack_12", duration = 7.5, Icon = "soldier_rocketrain_hyper_giant" }, { attack = "Attack_7", duration = 10, Icon = "soldier_rocketrain_homing_hyper_giant" }, { attack = "Attack_13", duration = 10, Icon = "soldier_barrage_homing_hyper" }, { attack = "Attack_11", duration = 1.1, Icon = "soldier_rocketrain_heat" } } } CEntity.IsInvis = function(self) if (not IsValidPlayer(self)) then return end if (self:InCond(TF_COND_STEALTHED) or self:InCond(TF_COND_STEALTHED_BLINK) or self:InCond(TF_COND_STEALTHED_USER_BUFF) or self:InCond(TF_COND_STEALTHED_USER_BUFF_FADING)) then return true end return false end CEntity.FindAllInLineOfSight = function( self ) local tbl = {} for _, ent in pairs( ents.GetAllPlayers() ) do if IsValidAlivePlayer( ent ) and ( ent ~= self ) and ( ent:OnTeam( 3 ) ) and ( not ent:IsInvis() ) then local Trace = util.Trace({ start = self:GetEyePos(), endpos = ent:GetEyePos(), mask = MASK_OPAQUE, filter = ents.GetAllPlayers() }) if not Trace.Hit then table.insert( tbl, ent ) end end end --PrintTable(tbl) return tbl end function OnWaveStart(wave) wavestarted = true end function OnWaveInit(wave) wavestarted = false alerted = false boss = nil boss_phase = 1 boss_attack_tbl = { -- phase 1 { { attack = "Attack_1", duration = 20, Icon = "soldier_barrage_homing_nys_giant" }, { attack = "Attack_2", duration = 20, Icon = "soldier_bazooka_homing_nys_giant" }, { attack = "Attack_3", duration = 12, Icon = "soldier_rocketrain_homing_nys_giant" }, { attack = "Attack_4", duration = 15, Icon = "soldier_rocketwall_giant" }, { attack = "Attack_5", duration = 15, Icon = "soldier_rocketrain" }, { attack = "Attack_6", duration = 15, Icon = "soldier_hyper_lite" } }, -- phase 2 { { attack = "Attack_1", duration = 20, Icon = "soldier_barrage_homing_nys_giant" }, { attack = "Attack_8", duration = 20, Icon = "soldier_bazooka_homing_nys_giant" }, { attack = "Attack_3", duration = 12, Icon = "soldier_rocketrain_homing_nys_giant" }, { attack = "Attack_4", duration = 15, Icon = "soldier_rocketwall_giant" }, { attack = "Attack_10", duration = 15, Icon = "soldier_rocketrain" }, { attack = "Attack_6", duration = 15, Icon = "soldier_hyper_lite" }, { attack = "Attack_7", duration = 20, Icon = "soldier_rocketrain_homing_hyper_giant" }, { attack = "Attack_9", duration = 20, Icon = "soldier_barrage_homing_nys_giant" } }, -- phase 3 { { attack = "Attack_15", duration = 10, Icon = "soldier_barrage_homing_nys_giant" }, { attack = "Attack_14", duration = 10, Icon = "soldier_bazooka_homing_nys_giant" }, { attack = "Attack_12", duration = 7.5, Icon = "soldier_rocketrain_hyper_giant" }, { attack = "Attack_16", duration = 10, Icon = "soldier_rocketrain_homing_hyper_giant" }, { attack = "Attack_13", duration = 10, Icon = "soldier_barrage_homing_hyper" }, { attack = "Attack_11", duration = 0.6, Icon = "soldier_rocketrain_heat" }, { attack = "Attack_11", duration = 1.1, Icon = "soldier_rocketrain_heat" }, { attack = "Attack_11", duration = 1.6, Icon = "soldier_rocketrain_heat" } } } for _, player in pairs(ents.GetAllPlayers()) do player.lives = 3 end end function OnGameTick() if boss ~= nil then if CurTime() >= boss_delay then local attack = boss_attack_tbl[boss_phase][math.random( 1, #boss_attack_tbl[boss_phase] ) ] if ( boss.CurrectAttack ) and ( attack.attack == boss.CurrectAttack ) then goto Skip end boss.Jetpack = false ents.FindByName("passive_attack_timer"):AcceptInput("disable") ents.FindByName("passive_attack_timer"):AcceptInput("ResetTimer") ents.FindByName("passive_attack_timer_airborne"):AcceptInput("disable") ents.FindByName("passive_attack_timer_airborne"):AcceptInput("ResetTimer") boss:AcceptInput( "$ChangeAttributes", attack.attack ) boss.m_iszClassIcon = attack.Icon boss.CurrectAttack = attack.attack boss_delay = CurTime() + attack.duration end end ::Skip:: for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() and ( not player:OnTeam( 1 ) ) then if player.lives < 2 then player.LivesColor = {200,50,50} else player.LivesColor = {50,50,200} end local miniboss = player:GetAttributeValue("is miniboss") or 0 for slot = 0, 5 do if ( IsValid(player:GetPlayerItemBySlot(slot) ) ) and ( string.match(tostring(player:GetPlayerItemBySlot(slot):GetItemName()), "Giant") ) then player:SetAttributeValue("is miniboss", 1) break else player:SetAttributeValue("is miniboss", 0) end end if player:InCond(5) and IsValidRealPlayer( player:GetConditionProvider(5) ) and ( wavestarted ) then local medic = player:GetConditionProvider(5) if ( IsValid( medic:GetPlayerItemBySlot(1) ) ) and ( ( medic:GetPlayerItemBySlot(1):GetAttributeValue("Wrench index") or 0 ) == 2 ) and ( not player.Restored ) then player.Restored = true player.lives = player.lives + 1 timer.Simple(1, function() player.Restored = false end) end end if ( miniboss > 0 ) and ( player.respawntime <= 15 ) then player.respawntime = 60 player:SetAttributeValue("health from packs decreased", 0.25) player:SetAttributeValue("health from healers increased", 2.5) if player.m_iClass == TF_CLASS_SCOUT then player:SetAttributeValue("max health additive penalty", scout_health) player:SetAttributeValue("damage force reduction", 0.7) player:SetAttributeValue("airblast vulnerability multiplier", 0.7) player:SetAttributeValue("override footstep sound set", 5) elseif player.m_iClass == TF_CLASS_SOLDIER then player:SetAttributeValue("max health additive penalty", soldier_health) player:SetAttributeValue("damage force reduction", 0.4) player:SetAttributeValue("airblast vulnerability multiplier", 0.4) player:SetAttributeValue("move speed penalty", 0.625) player:SetAttributeValue("override footstep sound set", 3) elseif player.m_iClass == TF_CLASS_PYRO then player:SetAttributeValue("max health additive penalty", pyro_health) player:SetAttributeValue("damage force reduction", 0.6) player:SetAttributeValue("airblast vulnerability multiplier", 0.6) player:SetAttributeValue("move speed penalty", 0.75) player:SetAttributeValue("override footstep sound set", 6) elseif player.m_iClass == TF_CLASS_DEMOMAN then player:SetAttributeValue("max health additive penalty", demo_health) player:SetAttributeValue("damage force reduction", 0.5) player:SetAttributeValue("airblast vulnerability multiplier", 0.5) player:SetAttributeValue("move speed penalty", 0.642) player:SetAttributeValue("override footstep sound set", 4) elseif player.m_iClass == TF_CLASS_HEAVYWEAPONS then player:SetAttributeValue("max health additive penalty", heavy_health) player:SetAttributeValue("damage force reduction", 0.3) player:SetAttributeValue("airblast vulnerability multiplier", 0.3) player:SetAttributeValue("move speed penalty", 0.565) player:SetAttributeValue("override footstep sound set", 2) elseif player.m_iClass == TF_CLASS_ENGINEER then player:SetAttributeValue("max health additive penalty", engie_health) player:SetAttributeValue("damage force reduction", 0.6) player:SetAttributeValue("airblast vulnerability multiplier", 0.6) player:SetAttributeValue("move speed penalty", 0.75) player:SetAttributeValue("override footstep sound set", 7) player:SetAttributeValue("fire input on hit", "popscript^$RepairTank^") elseif player.m_iClass == TF_CLASS_MEDIC then player:SetAttributeValue("max health additive penalty", medic_health) player:SetAttributeValue("damage force reduction", 0.6) player:SetAttributeValue("airblast vulnerability multiplier", 0.6) player:SetAttributeValue("move speed penalty", 0.8) player:SetAttributeValue("override footstep sound set", nil) elseif player.m_iClass == TF_CLASS_SNIPER then player:SetAttributeValue("max health additive penalty", sniper_health) player:SetAttributeValue("damage force reduction", 0.7) player:SetAttributeValue("airblast vulnerability multiplier", 0.7) player:SetAttributeValue("move speed penalty", 0.75) player:SetAttributeValue("override footstep sound set", 7) elseif player.m_iClass == TF_CLASS_SPY then player:SetAttributeValue("max health additive penalty", spy_health) player:SetAttributeValue("damage force reduction", 0.5) player:SetAttributeValue("airblast vulnerability multiplier", 0.5) player:SetAttributeValue("move speed penalty", 0.8) player:SetAttributeValue("override footstep sound set", 7) end elseif ( miniboss == 0 ) and ( player.respawntime > 15 ) then player:SetAttributeValue("max health additive penalty", nil) player:SetAttributeValue("damage force reduction", nil) player:SetAttributeValue("airblast vulnerability multiplier", nil) player:SetAttributeValue("move speed penalty", nil) player:SetAttributeValue("health from packs decreased", nil) player:SetAttributeValue("health from healers increased", nil) player:SetAttributeValue("override footstep sound set", nil) player.respawntime = 15 end if IsValid(player:GetPlayerItemBySlot(0)) then if player:GetPlayerItemBySlot(0):GetItemName() == "Ash Carbonizer" then player.HasMeter = true player.MeterMax = 100 if CurTime() >= player.UpdateDelay then player:ShowHudText({channel = 5, y = 0.90, x = 0.74, r1 = 250, r2 = 250, g1 = player.Red, g2 = player.Red, b1 = player.Red, b2 = player.Red, effect = 0, fixTime = 0, fadeinTime = 0, fadeoutTime = 0, holdTime = 0.3}, "Carbon: " .. math.round( ( player.MeterCurrent / player.MeterMax ) * 100, 1 ).. "%" ) player.UpdateDelay = CurTime() + 0.1 end else player.HasMeter = false end end if IsValid(player:GetPlayerItemBySlot(0)) then if player:GetPlayerItemBySlot(0):GetItemName() == "[Giant] Soda Breaker" then player.HasMeter = true player.MeterMax = 1000 player.m_flHypeMeter = ( ( player.MeterCurrent / player.MeterMax ) * 100 ) if player.EMPed then player.MeterCurrent = math.max( player.MeterCurrent - 1, 0 ) if player.MeterCurrent == 0 then player.EMPed = false end end else player.HasMeter = false end end end if player:IsPlayer() and player.Jetpack then util.StartLagCompensation(player) local Trace = util.Trace({ start = player:GetAbsOrigin() + Vector(0, 0, 16), mask = MASK_PLAYERSOLID, angles = Vector(90, 0, 0), mins = Vector(-16, -16, 0), maxs = Vector(16, 16, 0), filter = ents.GetAllPlayers() }) util.FinishLagCompensation(player) local floor_height = Trace.HitPos.z local target_height = floor_height + player.JetpackHeight local cur_pos = player:GetAbsOrigin() local cur_height = cur_pos.z local velo = player:GetPlayerVelocity() player:SetPlayerVelocity( Vector(velo.x,velo.y,0) ) if player:IsBot() then player:SetForwardVelocity( 200 ) end if cur_height > ( target_height + 16 ) then player:SetPlayerVelocity( Vector(velo.x,velo.y,-100) ) elseif ( cur_height + 16 ) < target_height then player:SetPlayerVelocity( Vector(velo.x,velo.y,100) ) end if player.m_StuckLast > 0 then player:SetAbsOrigin(player.SpawnPos) end end if player:IsBot() and ( not tobool( player:GetAttributeValue("purchased") or 0 ) ) then if ( not player:InCond(43) ) and ( not player.Recoded ) then player:AcceptInput("$BotCommand","switch_action Mobber") player.Recoded = true elseif ( player:InCond(43) ) and ( player.Recoded ) then player:AcceptInput("$BotCommand","switch_action Mobber") player.Recoded = false if tobool( player.m_bIsMiniBoss ) then player:AddCond(71, 1) else player:AddCond(71, 3) end end end end for _,building in pairs(ents.FindAllByClass("obj_dispenser")) do if IsValid( building.m_hBuilder ) then local owner = building.m_hBuilder if IsValid( owner:GetPlayerItemBySlot(5) ) then local pda = owner:GetPlayerItemBySlot(LOADOUT_POSITION_PDA) if ( pda:GetItemName() == "Mini PDA" ) and ( building.m_bPlacing == 1 ) then building.m_bMiniBuilding = 1 end if ( pda:GetItemName() == "Mini PDA" ) and ( building.m_iState == 0 ) then building.m_iMaxHealth = 100 * ( owner:GetPlayerItemBySlot(LOADOUT_POSITION_PDA):GetAttributeValue("engy building health bonus" ) or 1 ) if building.m_iHealth > building.m_iMaxHealth then building:AcceptInput("SetHealth", building.m_iMaxHealth ) end end end end end for _,building in pairs(ents.FindAllByClass("obj_teleporter")) do if IsValid( building.m_hBuilder ) then local owner = building.m_hBuilder if IsValid( owner:GetPlayerItemBySlot(5) ) then local pda = owner:GetPlayerItemBySlot(LOADOUT_POSITION_PDA) if ( pda:GetItemName() == "Mini PDA" ) and ( building.m_bPlacing == 1 ) then building.m_bMiniBuilding = 1 building.m_iMaxHealth = 100 * ( owner:GetPlayerItemBySlot(LOADOUT_POSITION_PDA):GetAttributeValue("engy building health bonus" ) or 1 ) end if ( pda:GetItemName() == "Mini PDA" ) and ( building.m_iState > 0 ) then building.m_iMaxHealth = 100 * ( owner:GetPlayerItemBySlot(LOADOUT_POSITION_PDA):GetAttributeValue("engy building health bonus" ) or 1 ) if building.m_iHealth > building.m_iMaxHealth then building:AcceptInput("SetHealth", building.m_iMaxHealth ) end end end end end for _,building in pairs(ents.FindAllByClass("obj_sentrygun")) do if IsValid( building.m_hBuilder ) then local owner = building.m_hBuilder if IsValid( owner:GetPlayerItemBySlot(2) ) then local melee = owner:GetPlayerItemBySlot(2) local upgrade_mult = ( owner:GetPlayerItemBySlot(2):GetAttributeValue( "throwable healing" ) or 1 ) * ( owner:GetPlayerItemBySlot(LOADOUT_POSITION_PDA):GetAttributeValue("engy building health bonus" ) or 1 ) if ( melee:GetItemName() == "Drone Controller" ) then building.m_iMaxHealth = 100 * upgrade_mult if building.m_iState ~= 0 and ( not building.HealthFix ) then building.HealthFix = true building:AcceptInput("SetHealth", building.m_iMaxHealth ) end end end end end end function ToggleJetpack(height, activator) if activator.Jetpack then activator.Jetpack = false else activator.Jetpack = true activator.SpawnPos = activator:GetAbsOrigin() local cur_pos = activator:GetAbsOrigin() activator:SetAbsOrigin( Vector( cur_pos.x, cur_pos.y, cur_pos.z + ( height / 4 ) ) ) end activator.JetpackHeight = height end function DelayedAttack(_, activator) local ply_los = activator:FindAllInLineOfSight() if ( ply_los ) and ( #ply_los > 0 ) then local rand = math.random(1, #ply_los) local tar = ply_los[rand] local spawn_offset = 96 local act_facepos = activator:GetEyePos() + ( Vector( 128, 128, 128 ) * ( activator:GetEyeAngles():GetForward() ) ) local dist = ( act_facepos:Distance( tar:GetEyePos() ) ) - spawn_offset local look_ang = ( tar:GetEyeAngles() + Vector( 90, 0, 0 ) ) local ang_to = act_facepos:FaceVector( tar:GetEyePos() ) local Trace = util.Trace({ start = act_facepos, angles = ang_to, distance = dist, mask = CONTENTS_EMPTY }) local spawn_pos = tostring( Trace.HitPos.x ) .. " " .. tostring( Trace.HitPos.y ) .. " " .. tostring( Trace.HitPos.z ) local spawn_ang = tostring( ang_to.x + 90 ) .. " " .. tostring( ang_to.y ) .. " " .. tostring( ang_to.z ) local shoot_pos = tostring( act_facepos.x ) .. " " .. tostring( act_facepos.y ) .. " " .. tostring( act_facepos.z ) local shoot_ang = tostring( ang_to.x ) .. " " .. tostring( ang_to.y ) .. " " .. tostring( ang_to.z ) --Get boss eye pos --Get player eye pos --Get angle cross of them --Get distance between them --Make distances 96 units shorter than disst --Draw a trace between boss eye pos and distance --Set that as the pos --Make ang +90 degrees of the angle cross local indicator = ents.CreateWithKeys( "prop_dynamic", { origin = spawn_pos, angles = spawn_ang, model = "models/props_mvm/indicator/indicator_circle_long.mdl", skin = 0, disableshadows = 1 }, true, true ) local mimic = ents.CreateWithKeys( "tf_point_weapon_mimic", { origin = shoot_pos, angles = shoot_ang, Crits = 1, SpreadAngle = 0, teamnum = 2 }, true, true ) mimic["$weaponname"] = "Sergeant Lock on Single" mimic["$SetOwner"] = activator --print(indicator, mimic) indicator:AcceptInput("SetAnimation","start") timer.Simple(0, function() mimic:AcceptInput("FireOnce") end) timer.Simple(4, function() indicator:AcceptInput("SetAnimation","end") end) timer.Simple(4.5, function() indicator:AcceptInput("kill") mimic:AcceptInput("kill") end) end end function NextPhase() boss_phase = boss_phase + 1 boss_delay = CurTime() + 0.1 end function ImABoss(_, activator) boss = activator end function OnPlayerDeath(player, attacker, weapon, dmgtype, assister, crit_type, silent_kill) if ( boss ) and ( player == boss ) then boss = nil end if ( player ) and ( player:IsValid() ) and ( player:IsBot() ) and ( player.Infected ) then player.Infected = false local Infector = player.Infector local Blast_Radius = 128 * ( Infector:GetPlayerItemBySlot(4):GetAttributeValueByClass("mult_explosion_radius", 1 ) ) local Blast_Damage = 40 * ( Infector:GetPlayerItemBySlot(4):GetAttributeValueByClass("mult_dmg", 1 ) ) local dmg_info = { Attacker = Infector, Damage = Blast_Damage, DamageType = DMG_BLAST, DamageCustom = TF_DMG_CUSTOM_SAPPER_RECORDER_DEATH } util.ParticleEffect( "mvm_loot_explosion", player:GetAbsOrigin() + Vector(0,0,64) ) util.ParticleEffect( "breadjar_impact", player:GetEyePos() + Vector(0,0,64) ) util.ParticleEffect( "bread_gloves_goop", player:GetEyePos() + Vector(0,0,64), player:GetEyeAngles() ) player:PlaySound("Weapon_Airstrike.Explosion") player:PlaySound("Weapon_Airstrike.Explosion") player:PlaySound("weapons/breadmonster/throwable/bm_throwable_smash.wav") for _, others in pairs( ents.FindInSphere( player:GetAbsOrigin(), Blast_Radius ) ) do if ( others:IsBot() ) and ( others:IsAlive() ) and ( others ~= player ) then others:TakeDamage( dmg_info ) Infect( nil, Infector, others ) end end end end function OnWaveSpawnBot(bot, wave, tags) bot.Recoded = false bot.Jetpack = false bot.JetpackHeight = 0 bot.Infected = false end function OnPlayerConnected(player) if player:IsRealPlayer() then player.InSpecAtk = false player.Crouching = false player.Jetpack = false -- testing player.JetpackHeight = 0 -- testing player.Restored = false player.lives = 3 player.respawntime = 15 player.respawncountdown = player.respawntime player.LivesColor = {50,50,200} player.MiscDisplayColor = {200,50,50} player.EMPed = false player.HasMeter = false player.MeterMax = 100 player.MeterCurrent = 0 player.UpdateDelay = CurTime() player.DisplayTimer = timer.Create(1, function() if player:OnTeam( 3 ) then player:ShowHudText({channel = 3, y = 0.85, x = -0.75, r1 = player.LivesColor[1], r2 = player.LivesColor[1], g1 = player.LivesColor[2], g2 = player.LivesColor[2], b1 = player.LivesColor[3], b2 = player.LivesColor[3], effect = 0, fixTime = 0, fadeinTime = 0, fadeoutTime = 0, holdTime = 1.25}, "Lives Left: " .. player.lives) if ( player:GetPlayerItemBySlot(2):GetItemName() == "Drone Controller" ) then local wp = player:GetPlayerItemBySlot(2) if IsValid(wp.Buildables_Drone) then if ( wp.Buildables_Drone.m_iState ~= 0 ) then player.MiscDisplayColor = {50,200,50} player:ShowHudText({channel = 4, y = 0.88, x = -0.6 * drone_state_mini_tbl[wp.Buildables_Drone.State + 1][2], r1 = player.MiscDisplayColor[1], r2 = player.MiscDisplayColor[1], g1 = player.MiscDisplayColor[2], g2 = player.MiscDisplayColor[2], b1 = player.MiscDisplayColor[3], b2 = player.MiscDisplayColor[3], effect = 0, fixTime = 0, fadeinTime = 0, fadeoutTime = 0, holdTime = 1.25}, "Drone State: " .. drone_state_mini_tbl[wp.Buildables_Drone.State + 1][1] ) else player.MiscDisplayColor = {250,150,50} player:ShowHudText({channel = 4, y = 0.88, x = -0.64 * drone_state_mini_tbl[wp.Buildables_Drone.State + 1][2], r1 = player.MiscDisplayColor[1], r2 = player.MiscDisplayColor[1], g1 = player.MiscDisplayColor[2], g2 = player.MiscDisplayColor[2], b1 = player.MiscDisplayColor[3], b2 = player.MiscDisplayColor[3], effect = 0, fixTime = 0, fadeinTime = 0, fadeoutTime = 0, holdTime = 1.25}, "Drone State: Building" ) end else player.MiscDisplayColor = {200,50,50} player:ShowHudText({channel = 4, y = 0.88, x = -0.755, r1 = player.MiscDisplayColor[1], r2 = player.MiscDisplayColor[1], g1 = player.MiscDisplayColor[2], g2 = player.MiscDisplayColor[2], b1 = player.MiscDisplayColor[3], b2 = player.MiscDisplayColor[3], effect = 0, fixTime = 0, fadeinTime = 0, fadeoutTime = 0, holdTime = 1.25}, "Drone: N/A") end end end end, 0) player:AddCallback(ON_DEATH, function() if wavestarted then DefeatCheck() if player.lives > 0 then timer.Simple(5,function() player.HasMeter = false player.MeterMax = 100 player.MeterCurrent = 0 if wavestarted then player.lives = player.lives - 1 player.respawncountdown = player.respawntime player:Print(2,"Revive in " .. player.respawncountdown .. " Seconds") player.respawncountdown = player.respawncountdown - 1 timer.Create(1,function() player:Print(2,"Revive in " .. player.respawncountdown .. " Seconds") player.respawncountdown = player.respawncountdown - 1 end, player.respawntime - 1) timer.Simple(player.respawntime, function() player:ForceRespawn() player:Print(2,"") end) end end) else player:Print(2,"No more lives, enjoy the show") end else timer.Simple(3, function() player:ForceRespawn() end) end end) player:AddCallback(ON_KEY_PRESSED , function(ent, key) if ( key == IN_ATTACK3 ) then player.InSpecAtk = true end if key == IN_DUCK then player.Crouching = true end if IsValid( player.m_hActiveWeapon ) then if ( player.m_hActiveWeapon:GetItemName() == "Drone Controller" ) and ( key == IN_RELOAD ) and ( IsValid(player.m_hActiveWeapon.Buildables_Drone) ) then player.m_hActiveWeapon.Buildables_Drone.State = player.m_hActiveWeapon.Buildables_Drone.State + 1 player.m_hActiveWeapon.Buildables_Drone.LockPos = player:GetAbsOrigin() if player.m_hActiveWeapon.Buildables_Drone.State > 2 then player.m_hActiveWeapon.Buildables_Drone.State = 0 end player:Print(2, drone_state_tbl[player.m_hActiveWeapon.Buildables_Drone.State + 1] ) elseif ( player:GetPlayerItemBySlot(2):GetItemName() == "Drone Controller" ) and ( key == IN_RELOAD ) and ( player.InSpecAtk ) and ( IsValid(player:GetPlayerItemBySlot(2).Buildables_Drone) ) then player:GetPlayerItemBySlot(2).Buildables_Drone.State = player:GetPlayerItemBySlot(2).Buildables_Drone.State + 1 player:GetPlayerItemBySlot(2).Buildables_Drone.LockPos = player:GetAbsOrigin() if player:GetPlayerItemBySlot(2).Buildables_Drone.State > 2 then player:GetPlayerItemBySlot(2).Buildables_Drone.State = 0 end player:Print(2, drone_state_tbl[player:GetPlayerItemBySlot(2).Buildables_Drone.State + 1] ) end if ( player.m_hActiveWeapon:GetItemName() == "Ash Carbonizer" ) and ( key == IN_ATTACK2 ) and ( player.MeterCurrent > 0 ) then CarbonizerAbility(player) end end end) player:AddCallback(ON_KEY_RELEASED, function(entity, key) if key == IN_ATTACK3 then player.InSpecAtk = false end if key == IN_DUCK then player.Crouching = false end end) end end function AddCarbon(damage, activator, caller) activator.MeterCurrent = math.min(activator.MeterCurrent + 10, activator.MeterMax) player:ShowHudText({channel = 5, y = 0.90, x = 0.74, r1 = 250, r2 = 250, g1 = player.Red, g2 = player.Red, b1 = player.Red, b2 = player.Red, effect = 0, fixTime = 0, fadeinTime = 0, fadeoutTime = 0, holdTime = 0.3}, "Carbon: " .. math.round( ( player.MeterCurrent / player.MeterMax ) * 100, 1 ).. "%" ) end function RepairAllBuildings( percent, activator, caller ) --activator is the one with the weapon for _, building in pairs( ents.FindAllByClass("obj_dispenser") ) do if IsValid( building.m_hBuilder ) then local owner = building.m_hBuilder if owner == activator then building:AcceptInput("AddHealth", ( building.m_iMaxHealth * ( percent / 100 ) ) ) end end end for _, building in pairs( ents.FindAllByClass("obj_teleporter") ) do if IsValid( building.m_hBuilder ) then local owner = building.m_hBuilder if owner == activator then building:AcceptInput("AddHealth", ( building.m_iMaxHealth * ( percent / 100 ) ) ) end end end for _, building in pairs( ents.FindAllByClass("obj_sentrygun") ) do if IsValid( building.m_hBuilder ) then local owner = building.m_hBuilder if owner == activator then building:AcceptInput("AddHealth", ( building.m_iMaxHealth * ( percent / 100 ) ) ) end end end end function RadialHeal( damage, activator, caller ) --activator is the one with the weapon local radius = activator:GetPlayerItemBySlot(1):GetAttributeValue("throwable damage") or 128 local heal = activator:GetPlayerItemBySlot(1):GetAttributeValue("throwable healing") or 20 for _, player in pairs ( ents.FindInSphere( activator:GetAbsOrigin(), radius ) ) do if player:IsPlayer() and ( player:GetTeam() == activator:GetTeam() ) and ( player:IsAlive() ) then local MaxHealth = player.m_iMaxHealth + player:GetAttributeValueByClass("add_maxhealth_nonbuffed", 0) + player:GetAttributeValueByClass("add_maxhealth", 0) local fakeEventTable = { patient = player:GetUserId(), healer = activator:GetUserId(), amount = heal } --scoreboard credit. FireEvent("player_healed", fakeEventTable) player:PlaySoundToSelf("HealthKit.Touch") player.m_iHealth = math.min( player.m_iHealth + heal, MaxHealth ) end end end function RepairTeammates(_, activator, caller) --activator is the one with the weapon if not util.IsLagCompensationActive() then util.StartLagCompensation(activator) end --ripped from red_sniper_laser.lua local melee = activator:GetPlayerItemBySlot(2) local meleeRangeMult = melee:GetAttributeValue("melee range multiplier", true) or 1 local TraceLineOfSight = { start = activator, distance = (100 * meleeRangeMult), angles = activator:GetEyeAngles(), mask = MASK_SOLID, collisiongroup = COLLISION_GROUP_PLAYER } local Trace = util.Trace(TraceLineOfSight) local HitEnt = Trace.Entity if IsValid(HitEnt) and HitEnt:IsPlayer() and HitEnt:GetTeam() == activator:GetTeam() then local MaxHealth = HitEnt.m_iMaxHealth + HitEnt:GetAttributeValueByClass("add_maxhealth_nonbuffed", 0) + HitEnt:GetAttributeValueByClass("add_maxhealth", 0) local amount = math.clamp( activator.m_iAmmo[4] * 2, 2, 120 ) amount = math.min( amount, ( MaxHealth - HitEnt.m_iHealth ) ) local cost = amount / 2 amount = amount * activator:GetPlayerItemBySlot(2):GetAttributeValueByClass( "mult_repair_value", 1 ) print( HitEnt.m_iHealth, MaxHealth ) if ( activator.m_iAmmo[TF_AMMO_METAL] >= cost ) and ( HitEnt.m_iHealth ~= MaxHealth ) then HitEnt:PlaySoundToSelf("Weapon_Wrench.HitBuilding_Success") HitEnt:Print(PRINT_TARGET_CENTER, "WRENCHED BY " .. activator.m_szNetname .. " HEALED FOR " .. amount .. " HEALTH") local fakeEventTable = { patient = HitEnt:GetUserId(), healer = activator:GetUserId(), amount = amount } --scoreboard credit. FireEvent("player_healed", fakeEventTable) HitEnt.m_iHealth = HitEnt.m_iHealth + amount activator.m_iAmmo[4] = math.max( activator.m_iAmmo[4] - cost, 0 ) activator:PlaySoundToSelf("Weapon_Wrench.HitBuilding_Success") HitEnt:SetAttributeValue("ammo regen", 100) timer.Simple(5, function() HitEnt:SetAttributeValue("ammo regen", 0) end) else activator:PlaySoundToSelf("Weapon_Wrench.HitBuilding_Failure") end if HitEnt.m_iHealth > MaxHealth then HitEnt.m_iHealth = MaxHealth end end end function AddHype(damage, activator, caller) if not activator.EMPed and ( caller:IsPlayer() ) then activator.MeterCurrent = math.min(activator.MeterCurrent + damage, activator.MeterMax) end end function CarbonizerAbility(player) if player.MeterCurrent > 0 then player:Addcond(16,0.2) player.MeterCurrent = math.max( player.MeterCurrent - 0.25, 0 ) timer.Simple(0.1, function() CarbonizerAbility(player) end) else player:Removecond(16) end end function FireBallLaunch(_,activator,weapon) local Ammo = activator.m_iAmmo[3] local Clip = weapon.m_iClip1 local ShootOffset = Vector(8,4,56) if activator.Crouching then ShootOffset = Vector(8,4,28) end weapon.m_iClip1 = Clip + 1 if Ammo >= 8 then activator.m_iAmmo[3] = Ammo - 8 local KV = { TeamNum = 2 } local shooter = ents.CreateWithKeys("tf_point_weapon_mimic", KV, true, true) shooter["$weaponname"] = "Fake Fireball" shooter:AcceptInput("$SetOwner", activator) shooter["$preventshootparent"] = 1 util.StartLagCompensation(activator) local Trace = util.Trace({ start = activator:GetEyePos(), distance = 550, mask = MASK_PLAYERSOLID, angles = activator:GetAbsAngles(), filter = activator }) util.FinishLagCompensation(activator) local targetAngles = (Trace.HitPos - (activator:GetEyePos() + Vector(8,4,0))):ToAngles() targetAngles = Vector(targetAngles[1], targetAngles[2], 0) shooter:Teleport(activator:GetAbsOrigin() + ShootOffset, targetAngles) shooter:AcceptInput("FireOnce") timer.Simple(1.015, function() shooter:AcceptInput("kill") end) end end function Alerted(_, activator) if not activator:InCond( TF_COND_STUNNED ) and ( not alerted ) then alerted = true timer.Simple(0.1, function() ents.FindByName("alert_relay"):AcceptInput("enable") end) timer.Simple(0.2, function() ents.FindByName("alert_relay"):AcceptInput("trigger") end) end end function DisableFlag( _, activator ) if activator and ( activator:IsValid() ) then for _, intel in pairs( ents.FindInSphere( activator:GetAbsOrigin(),96 ) ) do if intel:GetClassname() == "item_teamflag" then if intel.m_hPrevOwner == activator then intel:AcceptInput("ForceResetAndDisableSilent") ents.FindByName( "australium_pile_" .. tostring( intel.m_iName ) ):AcceptInput("kill") end end end end end function DefeatCheck() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then if player.lives > 0 then return end end end Defeat() end function Defeat() wavestarted = false timer.Simple(3,function() util.PrintToChatAll("Defeat, Everyone ran out of lives!") ents.FindByName("blue_lose_relay"):AcceptInput("Trigger") for _, player in pairs(ents.GetAllPlayers()) do player:Print(2,"Defeat, Everyone ran out of lives!") player:PlaySoundToSelf("music/mvm_lost_wave.wav") end end) end function DefeatTank() wavestarted = false timer.Simple(3,function() util.PrintToChatAll("Defeat, Drill Tank was destroyed!") ents.FindByName("blue_lose_relay"):AcceptInput("Trigger") for _, player in pairs(ents.GetAllPlayers()) do player:Print(2,"Defeat, Drill Tank was destroyed!") player:PlaySoundToSelf("music/mvm_lost_wave.wav") end end) end function OnPlayerDisconnected(player) -- Kill active timers if player:IsRealPlayer() then pcall(timer.Stop, player.DisplayTimer) end end function Recode(_, activator, caller) --activator is the one with the weapon, caller is the one that got hit if ( activator:IsValid() ) and ( caller:IsValid() ) and ( IsValid(activator:GetPlayerItemBySlot(4)) ) and ( not tobool( caller.m_bUseBossHealthBar ) ) then local AddTime = activator:GetPlayerItemBySlot(4):GetAttributeValue("robo sapper") if AddTime == nil then AddTime = 0 else AddTime = AddTime * 2 end if caller.m_bIsMiniBoss == 1 then caller:RemoveCond(43) timer.Simple(5 + ( AddTime * 0.5 ), function() caller:AddCond(43) end) else caller:RemoveCond(43) timer.Simple(10 + AddTime, function() caller:AddCond(43) end) end end end function InfectSapper( _, activator, caller ) --activator is the one with the weapon, caller is the one that got hit if ( activator:IsValid() ) and ( caller:IsValid() ) and ( IsValid(activator:GetPlayerItemBySlot(4)) ) then caller:PlaySound("weapons/breadmonster/gloves/bm_gloves_on.wav") caller:PlaySound("weapons/breadmonster/gloves/bm_gloves_on.wav") util.ParticleEffect( "breadjar_impact", caller:GetEyePos() ) util.ParticleEffect( "bread_gloves_goop", caller:GetEyePos() , caller:GetEyeAngles() ) Infect( nil, activator, caller ) end end function Infect( _, activator, caller ) --activator is the one with the weapon, caller is the one that got hit if ( activator:IsValid() ) and ( caller:IsValid() ) and ( IsValid(activator:GetPlayerItemBySlot(4)) ) and ( not caller.Infected ) then caller.Infected = true caller.Infector = activator util.ParticleEffect( "breadjar_impact", caller:GetEyePos() ) util.ParticleEffect( "bread_gloves_goop", caller:GetEyePos(), caller:GetEyeAngles() ) end end function RepairTank(damage, activator, caller) --activator is the one with the weapon, caller is the one that got hit if ( caller:GetClassname() == "tank_boss" ) and ( activator:GetPlayerItemBySlot(2) == activator.m_hActiveWeapon ) and ( activator.m_iAmmo[4] > 0 ) then local amount = math.clamp( activator.m_iAmmo[4] * 2, 30, 120 ) local cost = amount / 2 amount = amount * activator:GetPlayerItemBySlot(2):GetAttributeValueByClass( "mult_repair_value", 1 ) caller:AcceptInput("AddHealth", amount ) activator.m_iAmmo[4] = math.max( activator.m_iAmmo[4] - cost, 0 ) timer.Simple(0, function() caller:AcceptInput("$TakeDamage", 0 ) end) end end function ThunderHit( damage, activator, caller ) --activator is the one with the weapon, caller is the one that got hit if caller and ( caller:IsValid() ) and ( activator ) and ( activator:IsValid() ) and ( caller:IsPlayer() ) and ( damage >= 85 ) then if activator:IsMidair() then util.ParticleEffect( "drg_cow_explosioncore_charged_blue", caller:GetEyePos(), caller:GetEyePos():FaceVector( activator:GetEyePos() ) ) for _, player in pairs(ents.FindInSphere(activator:GetAbsOrigin(),185)) do if ( player ~= caller ) and ( player:GetTeam() == caller:GetTeam() ) then local dmg_info = { Attacker = activator, Weapon = activator:GetPlayerItemBySlot(2), Damage = 44.4, -- rounds to 75 CritType = 1 } player:TakeDamage( dmg_info ) end end else util.ParticleEffect( "drg_cow_explosioncore_normal_blue", caller:GetEyePos(), caller:GetEyePos():FaceVector( activator:GetEyePos() ) ) for _, player in pairs(ents.FindInSphere(activator:GetAbsOrigin(),148)) do if ( player ~= caller ) and ( player:GetTeam() == caller:GetTeam() ) then local dmg_info = { Attacker = activator, Weapon = activator:GetPlayerItemBySlot(2), Damage = 22, --rounds to 30 CritType = 1 } player:TakeDamage( dmg_info ) end end end end end function ThunderThrow( _, activator, caller ) local ShootOffset = activator:GetEyePos() + Vector(8,4,0) local KV = { TeamNum = 3 } local shooter = ents.CreateWithKeys("tf_point_weapon_mimic", KV, true, true) shooter["$weaponname"] = "Hammer Proj" shooter:AcceptInput("$SetOwner", activator) shooter["$preventshootparent"] = 1 shooter:Teleport( ShootOffset, activator:GetEyeAngles() ) for _, viewmodel in pairs(ents.FindAllByClass("tf_viewmodel")) do if viewmodel.m_hOwner == activator then viewmodel.m_nSequence = 8 timer.Simple(0.015, function() viewmodel.m_nSequence = 11 end) end end shooter:AcceptInput("FireOnce") timer.Simple(1.015, function() shooter:AcceptInput("kill") end) end function ExplosiveBow(damage, activator, caller) --activator is the one with the weapon, caller is the one that got hit if caller:IsPlayer() and ( caller.m_iTeamNum ~= activator.m_iTeamNum ) then ents.FindByName("JB_fx_spawner"):Teleport(caller:GetAbsOrigin()) ents.FindByName("JB_fx_spawner"):AcceptInput("ForceSpawn") caller:PlaySound("Weapon_LooseCannon.Explode") caller:PlaySound("Weapon_LooseCannon.Explode") caller:PlaySound("Weapon_LooseCannon.Explode") local BlastDamage = damage * 0.5 local BlastRadius = damage * 0.75 local BlastDamageMult = activator:GetPlayerItemBySlot(0):GetAttributeValue("throwable damage") local BlastRadiusMult = activator:GetPlayerItemBySlot(0):GetAttributeValue("blast radius increased") if BlastDamageMult == nil then BlastDamageMult = 1 end if BlastRadiusMult == nil then BlastRadiusMult = 1 end if BlastDamage > 100 then BlastDamage = 100 end if BlastRadius > 148 then BlastRadius = 148 end BlastDamage = BlastDamage * BlastDamageMult BlastRadius = BlastRadius * BlastRadiusMult for _, others in pairs(ents.FindInSphere(caller:GetAbsOrigin(),BlastRadius)) do if others:IsPlayer() and ( others.m_iTeamNum ~= activator.m_iTeamNum ) then others:TakeDamage({Damage = BlastDamage, Attacker = activator, DamageType = DMG_BLAST}) end end end end function EMPBlast(condition, caller, activator) --caller is the one with the weapon, activator is the weapon activator.EMPed = true util.ParticleEffect( "drg_cow_explosioncore_charged_blue", activator:GetAbsOrigin() ) activator:PlaySound( "EMP.Sound1" ) activator:PlaySound( "EMP.Sound2" ) for _, player in pairs(ents.FindInSphere(activator:GetAbsOrigin(),384)) do if player:IsBot() and not ( tobool ( player.m_bUseBossHealthBar ) ) then local dist = player:GetAbsOrigin():Distance( activator:GetAbsOrigin() ) local ply_pos = player:GetEyePos() local act_pos = activator:GetEyePos() if dist >= 192 then local Trace = util.Trace({ start = act_pos, endpos = ply_pos, mask = MASK_PLAYERSOLID, filter = ents.GetAllPlayers() }) if not Trace.Hit then player:StunPlayer( 15, 1, TF_STUNFLAGS_NORMALBONK, activator ) util.ParticleEffect( "electrocuted_gibbed_blue", player:GetAbsOrigin(), Vector(0,0,0), player ) util.ParticleEffect( "electrocuted_gibbed_blue", player:GetEyePos(), Vector(0,0,0), player ) util.ParticleEffect( "electrocuted_blue", player:GetEyePos(), Vector(0,0,0), player ) player:PlaySound( "EMP.Sound3" ) end else player:StunPlayer( 15, 1, TF_STUNFLAGS_NORMALBONK, activator ) util.ParticleEffect( "electrocuted_gibbed_blue", player:GetAbsOrigin(), Vector(0,0,0), player ) util.ParticleEffect( "electrocuted_gibbed_blue", player:GetEyePos(), Vector(0,0,0), player ) util.ParticleEffect( "electrocuted_blue", player:GetEyePos(), Vector(0,0,0), player ) player:PlaySound( "EMP.Sound3" ) end end end end function Drone(_,Drone) local owner = Drone.m_hBuilder local Update local posmod = 1 local accel = 0.015 local decel = 0.1 local height = 16 local fakevel = Drone:GetAbsOrigin() local buildpos = Drone:GetAbsOrigin() local dis = 96 local failcounter = 0 local targetable = {} local tar = owner Drone.State = 0 Drone.MaxSpeed = 0.8 Drone.LockPos = Drone:GetAbsOrigin() owner:GetPlayerItemBySlot(2).Buildables_Drone = Drone Drone:AddCallback(ON_REMOVE, function() pcall(timer.Stop, Update) end) Drone:AddCallback(ON_DEATH, function() pcall(timer.Stop, Update) end) Update = timer.Create(0.015, function() if ( not IsValid(tar) ) then tar = owner end if ( owner:GetPlayerItemBySlot(2):GetItemName() ~= "Drone Controller" ) then pcall(timer.Stop, Update); Drone:AcceptInput("RemoveHealth", 9999) end if ( Drone.m_bCarried == 1 ) then pcall(timer.Stop, Update) end local pos = Drone:GetAbsOrigin() local ang = Vector(0,Drone:GetAbsAngles().y,Drone:GetAbsAngles().z) local ownerpos = owner:GetAbsOrigin() local desiredheight = tar:GetAbsOrigin().z + 72 + height local currentheight = pos.z local speedmult = owner:GetPlayerItemBySlot(2):GetAttributeValue("throwable fire speed") or 1 Drone.MaxSpeed = 1.6 * speedmult if ( owner:IsAlive() ) then if ( IsValid(Drone) ) then if owner.m_hActiveWeapon:GetItemName() ~= "Drone Controller" then dis = 128 else dis = 48 end if ( Drone.State ~= 0 ) and ( IsValid(Drone.m_hEnemy) ) then tar = Drone.m_hEnemy dis = dis * 2 if Drone.m_hEnemy.m_bIsMiniBoss == 1 then dis = dis * 1.25 height = 70 else height = 16 end else tar = owner height = 16 end if (Drone.m_iState ~= 0 ) and ( Drone.State ~= 2 ) then if pos:Distance(tar:GetAbsOrigin()) >= dis + 72 + height then fakevel = pos + ( Vector(posmod * 2.5,posmod * 2.5,0) * ang:GetForward()) posmod = math.min(posmod + ( posmod * accel), Drone.MaxSpeed) elseif ( pos:Distance(tar:GetAbsOrigin()) <= 72 + 72 + height ) and ( owner.m_hActiveWeapon:GetItemName() ~= "Drone Controller" ) and ( posmod * 5 < 6 ) then fakevel = pos - ( Vector(Drone.MaxSpeed,Drone.MaxSpeed,0) * ang:GetForward()) posmod = posmod - ( posmod * decel) else if posmod > 1 then fakevel = pos + ( Vector(posmod * 2.5,posmod * 2.5,0) * ang:GetForward()) posmod = posmod - ( posmod * decel) else posmod = 1 fakevel = pos end end if ( currentheight <= desiredheight ) and ( currentheight - desiredheight < 8 ) then if ( pos:Distance(tar:GetAbsOrigin()) >= dis + 72 + height ) or ( ( pos:Distance(tar:GetAbsOrigin()) <= 72 + 72 + height ) and ( owner.m_hActiveWeapon:GetItemName() ~= "Drone Controller" ) ) then fakevel = Vector(fakevel.x,fakevel.y,currentheight+math.max(1.5,( Drone.MaxSpeed * 1.5 ))) else fakevel = Vector(fakevel.x,fakevel.y,currentheight+math.max(0.25,( Drone.MaxSpeed * 1.5 ) / 6)) end elseif currentheight >= desiredheight and ( currentheight - desiredheight > 8 ) then if ( pos:Distance(tar:GetAbsOrigin()) >= dis + 72 + height ) or ( ( pos:Distance(tar:GetAbsOrigin()) <= 72 + 72 + height ) and ( owner.m_hActiveWeapon:GetItemName() ~= "Drone Controller" ) ) then fakevel = Vector(fakevel.x,fakevel.y,currentheight-math.max(1.5,( Drone.MaxSpeed * 1.5 ))) else fakevel = Vector(fakevel.x,fakevel.y,currentheight-math.max(0.25,( Drone.MaxSpeed * 1.5 ) / 6)) end else fakevel = Vector(fakevel.x,fakevel.y,currentheight) end elseif ( Drone.State == 2 ) then if ( currentheight <= ( Drone.LockPos.z + 72 + height ) ) and ( currentheight - ( Drone.LockPos.z + 72 + height ) < 8 ) then fakevel = Vector(fakevel.x,fakevel.y,currentheight+math.max(0.25,( Drone.MaxSpeed * 1.5 ) / 6)) end posmod = 1 else if ( currentheight <= ( Drone.LockPos.z + 72 + height ) ) and ( currentheight - ( Drone.LockPos.z + 72 + height ) < 8 ) then fakevel = Vector(fakevel.x,fakevel.y,currentheight+0.25) end posmod = 1 end Drone:SetAbsOrigin(fakevel) Drone:FaceEntity(tar) else failcounter = failcounter + 1 print("Error, Invaild Drone", failcounter) if failcounter >= 66 then pcall(timer.Stop, Update) end end else pcall(timer.Stop, Update) Drone:AcceptInput("RemoveHealth", 9999) end end, 0) end function DispShieldHurt( damage, activator, caller ) for _, building in pairs( ents.FindAllByClass("obj_dispenser") ) do if IsValid( building.m_hBuilder ) then local owner = building.m_hBuilder if ( owner:GetPlayerItemBySlot( LOADOUT_POSITION_PDA ):GetItemName() == "Shield Projector" ) and ( activator:GetTeam() ~= owner:GetTeam() ) then local dmg_info = { Attacker = activator, Damage = damage / 2 } building:TakeDamage( dmg_info ) end end end end function PlayerSpawn(_,activator) util.ParticleEffect( "wrenchmotron_teleport_beam", activator:GetAbsOrigin() ) util.ParticleEffect( "teleported_blue", activator:GetAbsOrigin() ) util.ParticleEffect( "teleportedin_blue", activator:GetAbsOrigin() ) activator:AcceptInput("RunScriptCode", "ScreenFade(self, 200, 200, 250, 200, 0.25, 0, 1)") end