local processedPlayers = {} local scope = self.GetScriptScope() scope.ThinkB <- function() { local ent = null while ((ent = Entities.FindByClassname(ent, "player")) != null) { if (!ent.IsAlive()) continue local isBot = false try { isBot = ent.IsBotOfType(TF_BOT_TYPE) } catch (e) { isBot = NetProps.GetPropBool(ent, "m_bIsABot") } //force vac meds to uber if uber threshold is met, the medic or target has left spawn, and the hatch is not exploded if (isBot && NetProps.GetPropInt(ent.GetActiveWeapon(), "m_AttributeManager.m_Item.m_iItemDefinitionIndex") == 998 && NetProps.GetPropInt(Entities.FindByName(null, "hatch_prop_destroy"), "m_bDisabled")) { if (ent.GetCustomAttribute("bot medic uber health threshold", 0) >= ent.GetHealth() || ent.GetHealth() <= 50) { local weapon = null; for (local i = 0; i < 6; i++) { local w = NetProps.GetPropEntityArray(ent, "m_hMyWeapons", i); if (w && w.IsValid() && w.GetClassname() == "tf_weapon_medigun") { weapon = w; break; } } if (!weapon) return null; if (!NetProps.GetPropBool(weapon, "m_bHealing")) return null; local target = NetProps.GetPropEntity(weapon, "m_hHealingTarget"); if (target.IsValid()){ if (!ent.InCond(51) || !target.InCond(51)) { ent.PressAltFireButton(0.1) } } } } //if bot is deploying bomb, remove vac bubble if (isBot && ent.GetSequenceName(ent.GetSequence()).find("deploybomb") && NetProps.GetPropFloat(ent, "m_flCycle") >= 0.1) { ent.RemoveCondEx(Constants.ETFCond.TF_COND_MEDIGUN_UBER_BULLET_RESIST, true) ent.RemoveCondEx(Constants.ETFCond.TF_COND_MEDIGUN_UBER_BLAST_RESIST, true) ent.RemoveCondEx(Constants.ETFCond.TF_COND_MEDIGUN_UBER_FIRE_RESIST, true) ent.RemoveCondEx(Constants.ETFCond.TF_COND_MEDIGUN_SMALL_BULLET_RESIST, true) ent.RemoveCondEx(Constants.ETFCond.TF_COND_MEDIGUN_SMALL_BLAST_RESIST, true) ent.RemoveCondEx(Constants.ETFCond.TF_COND_MEDIGUN_SMALL_FIRE_RESIST, true) } //remove vac backpack if (!(ent in processedPlayers) && isBot) { processedPlayers[ent] <- true local child = ent.FirstMoveChild(); while (child != null) { local nextChild = child.NextMovePeer() if (child.GetClassname() == "tf_wearable" && child.GetModelName() == "models/workshop/weapons/c_models/c_medigun_defense/c_medigun_defensepack.mdl") { child.Kill() } child = nextChild } } } } scope.MasterThink <- function() { ThinkB() return 0.01 } AddThinkToEnt(self, "MasterThink")