--by stardustspy --with help from seelpit local vectorMin = Vector(-75, -75, -75) local vectorMax = Vector(75, 75, 75) local function RevertPlayer(player, attribsFound, attribsActivator, class) player:SwitchClassInPlace(class) player:Regenerate() --dont die after reverting, that would be rather mean player:AddCond(57, 5) --banner soldier cond duration is infinite if this is not removed player:RemoveCond(26) -- batt player:RemoveCond(16) -- buff player:RemoveCond(29) -- conch for attr, val in pairs(attribsFound) do player:SetAttributeValue(attr, val); end --get giant attributes, then paste them onto the player for attr, val in pairs(attribsActivator) do val = nil player:SetAttributeValue(attr, val); end if player:InCond(34) then player:RemoveCond(34) end player:SetAttributeValue("no resupply", nil) player:SetAttributeValue("cannot upgrade", nil) player:SetAttributeValue("cancel falling damage", nil) player:SetAttributeValue("health from packs decreased", nil) player:SetAttributeValue("voice pitch scale", nil) player:SetAttributeValue("crit mod disabled", nil) player:SetAttributeValue("is miniboss", nil) player:SetAttributeValue("mult_patient_overheal_penalty_active", nil) player:SetAttributeValue("hud overlay", nil) player:SetAttributeValue("is giger counter", nil) player:RemoveAllCallbacks(ON_KEY_RELEASED) player:RemoveAllCallbacks(ON_DEATH) end function LookForPlayer(_, activator) if not activator then return end local TimerLookFor TimerLookFor = timer.Create(0.015, function () local activatorOrigin = activator:GetAbsOrigin() local entitiesInMyLovelyBox = ents.FindInBox(activatorOrigin+vectorMin, activatorOrigin+vectorMax) for _, entityWeFound in pairs(entitiesInMyLovelyBox) do --The entity must exist, be a real player, and must be on red. if not IsValid(entityWeFound) or entityWeFound:IsRealPlayer() == false or entityWeFound.m_iTeamNum ~= 3 then goto nextPlayer end --Also, no giants, please. if entityWeFound:GetAttributeValue("is miniboss") ~= nil then return end --Verify that the giant we're turning into is real and alive. and if the giant is blu local parentName = activator:GetPlayerName() if IsValid(activator) and activator:IsAlive() and activator.m_iTeamNum == 3 then entityWeFound:AcceptInput("$DisplayTextCenter", "Become "..parentName.." with attack3! Medic Shield or Heavy Rage key", entityWeFound) end --Now, transform! local TransformCallback = entityWeFound:AddCallback(ON_KEY_RELEASED, function(playerGiant, key) -- The giant must exist, we have to press special attack, and both the player and the giant need to be alive! if not IsValid(activator) or key ~= IN_ATTACK3 or not playerGiant:IsAlive() or not activator:IsAlive() then return end --...and you still shouldn't be a giant. if playerGiant:GetAttributeValue("is miniboss") ~= nil then return end --remove the callback for activating giant mode; new callbacks are given playerGiant:RemoveAllCallbacks(ON_KEY_RELEASED) if TimerLookFor ~= nil then timer.Stop(TimerLookFor) --print("Stopped timer that looks for giant"..TimerLookFor) end --Grab info about the player and the giant. local entityFoundClass = playerGiant.m_iClass local entityFoundAttirbutes = playerGiant:GetAllAttributeValues() local controllerName = playerGiant:GetPlayerName() local entityActivatorClass = activator.m_iClass local entityActivatorAttrs = activator:GetAllAttributeValues() --If we're super sure the player is still real, switch their class to the giant's. if IsValid(playerGiant) and playerGiant:IsAlive() then playerGiant:SwitchClassInPlace(entityActivatorClass) end --Give the player the giant's weapons. for i=0,2 do local wep = activator:GetPlayerItemBySlot(i); if wep == nil then goto continue end local weaponName = wep:GetItemName() local weaponAttrs = wep:GetAllAttributeValues() playerGiant:Giveitem(weaponName); for attr, val in pairs(weaponAttrs) do playerGiant:GetPlayerItemBySlot(i):SetAttributeValue(attr, val); end ::continue:: end --Erase player attributes for attr, val in pairs(entityFoundAttirbutes) do val = nil playerGiant:SetAttributeValue(attr, val); end --Get giant attributes, then paste them onto the player for attr, val in pairs(entityActivatorAttrs) do playerGiant:SetAttributeValue(attr, val); end --Additional attributes. playerGiant:SetAttributeValue("no resupply", 1) playerGiant:SetAttributeValue("cannot upgrade", 1) playerGiant:SetAttributeValue("cancel falling damage", 1) playerGiant:SetAttributeValue("health from packs decreased", 0.5) playerGiant:SetAttributeValue("voice pitch scale", 0.7) playerGiant:SetAttributeValue("crit mod disabled", 0) playerGiant:SetAttributeValue("is miniboss", 1) playerGiant:SetAttributeValue("mult_patient_overheal_penalty_active", 0.2) playerGiant:SetAttributeValue("hud overlay", "effects/combine_binocoverlay") playerGiant:AcceptInput("$DisplayTextCenter", "Revert back by pressing attack3 again!", playerGiant) playerGiant.m_flRageMeter = 100 local playerCharge = playerGiant:GetPlayerItemBySlot(1) playerCharge.m_flChargeLevel = 1 if playerGiant:GetAllAttributeValues("health regen") ~= nil then playerCharge.m_flChargeLevel = 0 end activator:AddCond(71, 9999) activator:AcceptInput("$TeleportToEntity", "spawnbot_invasion", activator) activator.SetFakeClientConVar(activator, "name", "Controlled By "..controllerName) if activator:InCond(34) then playerGiant:AddCond(34) end --timer that prevents players spamming mouse3 from transforming early local TimerNoInput NoInputMax = 3 TimerNoInput = timer.Create(1, function () if NoInputMax == nil then timer.Stop(TimerNoInput) return end NoInputMax = NoInputMax - 1 if NoInputMax == 0 then timer.Stop(TimerNoInput) playerGiant:SetAttributeValue("is giger counter", 1) -- dummy end end, 3) --timer that indicates when a player is reverting to normal local TimerRevertToNormal RevertToNormalTime = 43 TimerRevertToNormal = timer.Create(1, function () if RevertToNormalTime == nil then timer.Stop(TimerRevertToNormal) return end RevertToNormalTime = RevertToNormalTime - 1 if RevertToNormalTime <= 40 then playerGiant:AcceptInput("$DisplayTextCenter", "Reverting to normal in: "..RevertToNormalTime, playerGiant) end if RevertToNormalTime == 0 then timer.Stop(TimerRevertToNormal) RevertPlayer(playerGiant,entityFoundAttirbutes,entityActivatorAttrs,entityFoundClass) end end, 0) --Revert if you press special attack, are alive, and aren't spamming special attack. local RevertCallback = playerGiant:AddCallback(ON_KEY_RELEASED, function(playerToRevert, key) if key ~= IN_ATTACK3 or not playerToRevert:IsAlive() or playerToRevert:GetAttributeValue("is giger counter") == nil then return end timer.Stop(TimerRevertToNormal) RevertPlayer(playerToRevert,entityFoundAttirbutes,entityActivatorAttrs,entityFoundClass) if IsValid(activator) == true then activator:AcceptInput("$botcommand", "despawn", activator) end end) --Revert if you die. local CallbackDeath = playerGiant:AddCallback(ON_DEATH, function(playerToRevert) timer.Stop(TimerRevertToNormal) RevertPlayer(playerToRevert,entityFoundAttirbutes,entityActivatorAttrs,entityFoundClass) playerGiant:RemoveAllCallbacks(ON_KEY_RELEASED) playerGiant:RemoveAllCallbacks(ON_DEATH) timer.Stop(TimerNoInput) if activator:IsValid() == true then activator:AcceptInput("$botcommand", "despawn", activator) end end) end) ::nextPlayer:: end end, 0) end function OnWaveInit(wave) for _, player in pairs(ents.GetAllPlayers()) do --print(player) if player:IsRealPlayer() then player:RemoveAllCallbacks(ON_KEY_RELEASED) player:RemoveAllCallbacks(ON_DEATH) NoInputMax = nil RevertToNormalTime = nil end end end function OnPlayerDisconnected(player) if player:IsRealPlayer() then player:RemoveAllCallbacks(ON_KEY_RELEASED) player:RemoveAllCallbacks(ON_DEATH) end end