local PlayerCount = 0 local PlayerTable = {} local BossPhase = 1 math.randomfloat = function(m, n) if (m) then if (n) then if (n == m) then return m; elseif (m > n) then m, n = n, m; end -- n should be greater than m local dif = n - m; local mod = dif * math.random(); return m + mod; else return m * math.random(); end else return math.random(); end end function RecountPlayers() PlayerCount = 0 for index, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then PlayerTable[PlayerCount] = player PlayerCount = PlayerCount + 1 end end end function OnWaveReset() RecountPlayers() UnSoulBind() end function OnWaveStart(wave) RecountPlayers() UnSoulBind() end function OrbitalRocket(projectile,activator,weapon) RecountPlayers() local RandomPlayer = PlayerTable[math.random(0,#PlayerTable)] OrbitalRocketMain(RandomPlayer,activator,projectile:GetNetIndex()) end function OrbitalRocketMain(target,attacker,index) if (target:IsValid()) and (attacker:IsValid()) then timer.Simple(3, function() local rand = (math.random() * math.random()) local KeyValues = { model = "models/props_mvm/indicator/indicator_circle_long.mdl", skin = 0, origin = target:GetAbsOrigin(), disableshadows = 1, targetname = 'indicator ' .. tostring(index) } local KeyValues2 = { origin = target:GetAbsOrigin() + Vector(0, 0, 1100), angles = "90 0 0", Crits = 0, SpreadAngle = 0, targetname = 'shooter ' .. tostring(index) } ents.CreateWithKeys("tf_point_weapon_mimic", KeyValues2, true, true) local mimic = ents.FindByName('shooter ' .. tostring(index)) mimic["$weaponname"] = "Orbital Strike Rocket" ents.CreateWithKeys("prop_dynamic", KeyValues, true, true) ents.FindByName('indicator ' .. tostring(index)):AcceptInput("SetAnimation","start") timer.Create(0.015, function() ents.FindByName('indicator ' .. tostring(index)):SetAbsOrigin(target:GetAbsOrigin() + Vector(0, 0, 8)) ents.FindByName('shooter ' .. tostring(index)):SetAbsOrigin(target:GetAbsOrigin() + Vector(0, 0, 1100)) end, 3 / 0.015) timer.Simple(6.2, function() ents.FindByName('shooter ' .. tostring(index)):AcceptInput("FireOnce") end) timer.Simple(7.5, function() ents.FindByName('indicator ' .. tostring(index)):AcceptInput("SetAnimation","end") end) timer.Simple(8, function() ents.FindByName('indicator ' .. tostring(index)):AcceptInput("kill") ents.FindByName('shooter ' .. tostring(index)):AcceptInput("kill") end) end) end end function IncreaseBossPhase() BossPhase = BossPhase + 1 end function RandomATK(_,activator) if activator:IsAlive() then for _,player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:PlaySoundToSelf("mvm/mvm_cpoint_klaxon.wav") end end if BossPhase == 1 then activator:AcceptInput("$ChangeAttributes", 'ATK_' .. tostring(math.random(1,5)) ) else activator:AcceptInput("$ChangeAttributes", 'ATK_' .. tostring(math.random(1,12)) ) end activator:SetAttributeValue("no_attack", 1) local MaxHp if BossPhase == 1 then MaxHp = 40000 else MaxHp = 80000 end timer.Simple(math.max(1.5 * (activator.m_iHealth / MaxHp), 0.5),function() activator:SetAttributeValue("no_attack", 0) for _,player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:PlaySoundToSelf("mvm/mvm_warning.wav") end end end) end end function LevitateStun(damage, activator, caller) --activator is the one with the weapon, caller is the one that got hit if caller:IsRealPlayer() then local oldpos = caller:GetAbsOrigin() local currectpos = caller:GetAbsOrigin() local oldangles = caller:GetAbsAngles() local targetheight = 512 local duration = activator:GetPlayerItemBySlot(0):GetAttributeValue("wrench index") or 5 caller:AddCond(30) caller:AddCond(101) caller:PlaySoundToSelf("misc/halloween/spell_athletic.wav") pcall(timer.Stop, StunTimer) local KeyValues = { effect_name = "utaunt_elebound_purple_parent", targetname = 'chains ' .. tostring(caller:GetSteamId()), start_active = 1 --origin = activator:GetAbsOrigin() } ents.CreateWithKeys("info_particle_system", KeyValues, true, true) local StunTimer = timer.Create(0.015, function() caller:SetLocalVelocity(Vector(0,0,0)) ents.FindByName('chains ' .. tostring(caller:GetSteamId())):SetAbsOrigin(currectpos) if ( currectpos.z ) < ( oldpos.z + targetheight ) then caller:SetAbsOrigin(currectpos + Vector(0,0,8)) currectpos = caller:GetAbsOrigin() else caller:SetAbsOrigin(currectpos) end caller:SnapEyeAngles(Vector(0,oldangles.y,math.randomfloat(-2,2))) end, 0) timer.Simple(duration, function() caller:PlaySoundToSelf("misc/halloween/merasmus_spell.wav") pcall(timer.Stop, StunTimer) ents.FindByName('chains ' .. tostring(caller:GetSteamId())):AcceptInput("stop") ents.FindByName('chains ' .. tostring(caller:GetSteamId())):AcceptInput("kill") if caller.m_StuckLast > 0 then caller:SetAbsOrigin(oldpos) end caller:SnapEyeAngles(Vector(caller:GetAbsAngles().x,caller:GetAbsAngles().y,0)) caller:SetLocalVelocity((Vector(-1500,-1500,500) * caller:GetAbsAngles():GetForward()) + Vector(0,0,1000)) caller:RemoveCond(30) caller:RemoveCond(101) caller:AddCond(127) end) end end function OnGameTick() for index, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then if player:InCond(127) then -- player:AddCond(15) else -- player:RemoveCond(15) end end end PlayerLogic() --CleaverRechargeLogic() ScreenText() AdrenalineJunkie() RechargeBattery() ExplosiveGroundSlam() ApplyBotEffects() MineLayer() end function OnPlayerConnected(player) if player:IsRealPlayer() then player.SoulBound = false player.SoulBoundTarget = nil player:AddCallback(ON_DEATH, function() if ( player.SoulBound ) and ( player.SoulBoundTarget:IsAlive() ) then timer.Simple(0.015, function() player.SoulBoundTarget:AcceptInput("$Suicide") end) end end) end if player:IsBot() then SetUpCallBacks( player ) SetUpCallNetpropsBot( player ) end if player:IsRealPlayer() then SetUpPlayerCallBacks( player ) SetUpPlayerNetprops( player ) end end function ShuffleInPlace(t) --copied from stack overflow for i = #t, 2, -1 do local j = math.random(i) t[i], t[j] = t[j], t[i] end end function SoulBind() RecountPlayers() ShuffleInPlace(PlayerTable) local Target1 = PlayerTable[0] local Target2 = PlayerTable[1] Target1.SoulBound = true Target1.SoulBoundTarget = Target2 Target2.SoulBound = true Target2.SoulBoundTarget = Target1 util.PrintToChatAll('\x0799CCFF *Overclocked Experiment 1082* ' .. "\x07FBECCB: I'll take \x07FF3F3F" .. tostring(Target1:GetPlayerName()) .." \x07FBECCB and \x07FF3F3F" .. tostring(Target2:GetPlayerName()) .. " \x07FBECCB and soul bind them!") timer.Create( 0.5, function() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player:SetAttributeValue("min respawn time", 1337666) if ( player == Target1 ) and ( player == Target2 ) then --player:SetAttributeValue("min respawn time", nil) end end end end, 10) end function UnSoulBind() for _, player in pairs(ents.GetAllPlayers()) do if player:IsRealPlayer() then player.SoulBound = false player.SoulBoundTarget = nil player:SetAttributeValue("min respawn time", nil) end end end