--please do not modify or copy this for your own needs --you may use this unmodified version if you credit me :) --made by Wacev --https://steamcommunity.com/profiles/76561198009331097/ function has_value (tab, val) --copied from stack overflow for index, value in pairs(tab) do if value == val then return true end end return false end function OnWaveSpawnBot(bot, wave, tags) if bot.m_iClass ~= TF_CLASS_SPY then local usesLeft = 3 local maxHealth = bot.m_iHealth local curHealth = bot.m_iHealth local enraged = false local ShotCount = 0 local enrageCount = 0 local maxammo = bot.m_hActiveWeapon.m_iClip1 bot:AddCallback(ON_DAMAGE_RECEIVED_POST, function(ent, damage, previousHealth) curHealth = bot.m_iHealth if IsValid(bot:GetPlayerItemBySlot(0)) then if bot:GetPlayerItemBySlot(0):GetItemName() == "The Phlogistinator" and ( not has_value(tags, "bot_boss") ) then --phlog taunt when injured function. if curHealth <= maxHealth*0.8 and ( enraged == false ) then enraged = true bot:Taunt("TAUNT_BASE_WEAPON", 0) end end end if has_value(tags, "bot_enragable") then --enrage bot function if curHealth <= maxHealth*0.65 and ( enraged == false ) then enraged = true bot:AddCond(34,6) bot:AddCond(26,6) bot:AddCond(71,1) bot:AddCond(52,1) bot:ChangeAttributes("Enraged") timer.Simple(6, function() bot:ChangeAttributes("Defualt") end) end end end) bot:AddCallback(ON_DAMAGE_RECEIVED_PRE, function(ent, damage) curHealth = bot.m_iHealth if has_value(tags, "bot_canteenuber") then --uber canteen bot function if not bot:InCond(8) then if curHealth <= maxHealth*0.25 and ( enraged == false ) then bot:AddCond(52,5) PrintChatText('\x0799CCFF' .. tostring(bot:GetPlayerName()) .. ' \x07FBECCBhas used thier \x079ec34fÜBERCHARGE \x07FBECCBPower Up Canteen!') for _, player in pairs(ents.GetAllPlayers()) do --play the canteen sound to all players if player:IsRealPlayer() then player:PlaySoundToSelf("MVM.PlayerUsedPowerup") player:PlaySoundToSelf("MVM.PlayerUsedPowerup") end end enraged = true elseif damage.Damage >= curHealth and ( enraged == false ) then --makes the uber canteen bot servive a lethal strike -- damage.Damage = 0 bot:AddCond(52,5) bot:SetHealth(1) PrintChatText('\x0799CCFF' .. tostring(bot:GetPlayerName()) .. ' \x07FBECCBhas used thier \x079ec34fÜBERCHARGE \x07FBECCBPower Up Canteen!') for _, player in pairs(ents.GetAllPlayers()) do --play the canteen sound to all players if player:IsRealPlayer() then player:PlaySoundToSelf("MVM.PlayerUsedPowerup") player:PlaySoundToSelf("MVM.PlayerUsedPowerup") end end enraged = true end end end end) timer.Simple(0.5, function() bot.m_hActiveWeapon:AddCallback(ON_FIRE_WEAPON_PRE, function(ent) if has_value(tags, "bot_canteencrit") then --crit canteen bot function if ( not bot:InCond(34) ) and ( not bot:InCond(51) ) then --only increment shot count when not critboosted and not in spawn ShotCount = ShotCount + 1 if ShotCount >= 3 and ( enrageCount < 3 ) then ShotCount = 0 enrageCount = enrageCount + 1 bot:AddCond(34,5) PrintChatText('\x0799CCFF' .. tostring(bot:GetPlayerName()) .. ' \x07FBECCBhas used thier \x079ec34fCRITS \x07FBECCBPower Up Canteen!') --what an ungodly parameter for _, player in pairs(ents.GetAllPlayers()) do --play the canteen sound to all players if player:IsRealPlayer() then player:PlaySoundToSelf("MVM.PlayerUsedPowerup") player:PlaySoundToSelf("MVM.PlayerUsedPowerup") end end end else ShotCount = 0 --to prevent back to back to back crit canteens end end if has_value(tags, "bot_canteenammo") then --ammo canteen bot function if ent.m_iClip1 == 0 and (usesLeft ~= 0) then usesLeft = usesLeft - 1 ent.m_iClip1 = maxammo PrintChatText('\x0799CCFF' .. tostring(bot:GetPlayerName()) .. ' \x07FBECCBhas used thier \x079ec34fAMMO REFILL \x07FBECCBPower Up Canteen!') for _, player in pairs(ents.GetAllPlayers()) do --play the canteen sound to all players if player:IsRealPlayer() then player:PlaySoundToSelf("MVM.PlayerUsedPowerup") player:PlaySoundToSelf("MVM.PlayerUsedPowerup") end end end end end) end) end end function PrintChatText(text) --currently colored text is limited to lua scripts, idk why util.PrintToChatAll(text) --to create colored text, start with "\x07" then add the color in hexadecimal form end