::CONST <- getconsttable() ::ROOT <- getroottable() ::MAX_CLIENTS <- MaxClients().tointeger() IncludeScript("alternatewaves", getroottable()) IncludeScript("tankextensions_main", getroottable()) IncludeScript("tankextensions/combattank", getroottable()) IncludeScript("tankextensions/combattank_weapons/minigun", getroottable()) PrecacheModel("models/bots/boss_bot/paintable_tank_v2/boss_tank.mdl") PrecacheModel("models/bots/boss_bot/paintable_tank_v2/tank_track_l.mdl") PrecacheModel("models/bots/boss_bot/paintable_tank_v2/tank_track_r.mdl") PrecacheModel("models/bots/boss_bot/paintable_tank_v2/bomb_mechanism.mdl") TankExt.NewTankScript("painttank*", { Model = { Default = "models/bots/boss_bot/paintable_tank_v2/boss_tank.mdl" LeftTrack = "models/bots/boss_bot/paintable_tank_v2/tank_track_l.mdl" RightTrack = "models/bots/boss_bot/paintable_tank_v2/tank_track_r.mdl" Bomb = "models/bots/boss_bot/paintable_tank_v2/bomb_mechanism.mdl" } OnSpawn = function(hTank, sName, hPath) { local sParams = split(sName, "|") if(sParams.len() == 1) sParams.append("255 255 255") TankExt.SetTankColor(hTank, sParams[1]) } }) if (!("ConstantNamingConvention" in ROOT)) foreach (a,b in Constants) foreach (k,v in b) { CONST[k] <- v != null ? v : 0 ROOT[k] <- v != null ? v : 0 } foreach(k, v in ::Entities.getclass()) if (k != "IsValid" && !(k in ROOT)) ROOT[k] <- ::Entities[k].bindenv(::Entities) foreach(k, v in ::NetProps.getclass()) if (k != "IsValid" && !(k in ROOT)) ROOT[k] <- ::NetProps[k].bindenv(::NetProps) local OTHER_CONSTANTS = { MASK_ALL = -1 MASK_SPLITAREAPORTAL = 48 MASK_SOLID_BRUSHONLY = 16395 MASK_WATER = 16432 MASK_BLOCKLOS = 16449 MASK_OPAQUE = 16513 MASK_DEADSOLID = 65547 MASK_PLAYERSOLID_BRUSHONLY = 81931 MASK_NPCWORLDSTATIC = 131083 MASK_NPCSOLID_BRUSHONLY = 147467 MASK_CURRENT = 16515072 MASK_SHOT_PORTAL = 33570819 MASK_SOLID = 33570827 MASK_BLOCKLOS_AND_NPCS = 33570881 MASK_OPAQUE_AND_NPCS = 33570945 MASK_VISIBLE_AND_NPCS = 33579137 MASK_PLAYERSOLID = 33636363 MASK_NPCSOLID = 33701899 MASK_SHOT_HULL = 100679691 MASK_SHOT = 1174421507 TF_STUN_NONE = 0 TF_STUN_MOVEMENT = 1 TF_STUN_CONTROLS = 2 TF_STUN_MOVEMENT_FORWARD_ONLY = 4 TF_STUN_SPECIAL_SOUND = 8 TF_STUN_DODGE_COOLDOWN = 16 TF_STUN_NO_EFFECTS = 32 TF_STUN_LOSER_STATE = 64 TF_STUN_BY_TRIGGER = 128 TF_STUN_SOUND = 256 SND_NOFLAGS = 0 SND_CHANGE_VOL = 1 SND_CHANGE_PITCH = 2 SND_STOP = 4 SND_SPAWNING = 8 SND_DELAY = 16 SND_STOP_LOOPING = 32 SND_SPEAKER = 64 SND_SHOULDPAUSE = 128 SND_IGNORE_PHONEMES = 256 SND_IGNORE_NAME = 512 SND_DO_NOT_OVERWRITE_EXISTING_ON_CHANNEL = 1024 // damagefilter redefinitions DMG_USE_HITLOCATIONS = DMG_AIRBOAT DMG_HALF_FALLOFF = DMG_RADIATION DMG_CRITICAL = DMG_ACID DMG_RADIUS_MAX = DMG_ENERGYBEAM DMG_IGNITE = DMG_PLASMA DMG_USEDISTANCEMOD = DMG_SLOWBURN DMG_NOCLOSEDISTANCEMOD = DMG_POISON DMG_MELEE = DMG_BLAST_SURFACE DMG_DONT_COUNT_DAMAGE_TOWARDS_CRIT_RATE = DMG_DISSOLVE } foreach(k,v in OTHER_CONSTANTS) if(!(k in ROOT)) { CONST[k] <- v ROOT[k] <- v } PrecacheSound("#trespasser_v2/music_spawnroom.wav") for(local i = 1; i <= MAX_PLAYERS; i++) { local hPlayer = PlayerInstanceFromIndex(i) if(!hPlayer || hPlayer.IsFakeClient()) continue EmitSoundEx({ sound_name = "#trespasser_v2/music_spawnroom.wav" volume = 0.65 pitch = 85 entity = hPlayer filter_type = RECIPIENT_FILTER_SINGLE_PLAYER }) } if(!("TrespasserLosses" in ROOT)) ::TrespasserLosses <- 0 local SpawnSkull = function(pos, ang, mdltype) SpawnEntityFromTable("prop_dynamic", { origin = pos angles = ang rendercolor = "0 0 0" model = mdltype == 0 ? "models/props_mvm/mvm_human_skull.mdl" : "models/props_mvm/mvm_human_skull_collide.mdl" disableshadows = 1 }) switch(TrespasserLosses > 24 ? 24 : TrespasserLosses) { case 24: SpawnSkull("985 1574 237.5", "-30 255 0", 0) SpawnEntityFromTable("prop_dynamic", { origin = "973.75 1532 171.5" angles = "-30 255 0" model = "models/player/items/all_class/sd_glasses_sniper_cigar.mdl" disableshadows = 1 }) SpawnEntityFromTable("prop_dynamic", { origin = "974 1533.5 163" angles = "-30 255 0" model = "models/player/items/demo/top_hat.mdl" modelscale = 1.1 disableshadows = 1 }) case 23: SpawnSkull("976 1582 237.5", "-30 255 0", 0) case 22: SpawnSkull("967 1581 238", "-30 270 0", 1) case 21: SpawnSkull("957 1582 238", "-30 255 0", 1) case 20: SpawnSkull("948 1582 237.5", "-30 270 0", 0) case 19: SpawnSkull("939 1582 237.5", "-30 285 0", 0) case 18: SpawnSkull("929 1583 238", "-30 270 0", 1) case 17: SpawnSkull("919 1581 237.5", "-30 255 0", 0) case 16: SpawnSkull("910 1583 238", "-30 255 0", 1) case 15: SpawnSkull("901 1582 238", "-30 285 0", 1) case 14: SpawnSkull("891 1581 238", "-30 270 0", 1) case 13: SpawnSkull("882 1585 238", "-27 255 0", 1) case 12: SpawnSkull("873 1582 237.5", "-27 300 0", 0) case 11: SpawnSkull("862 1580 237.5", "-27 240 0", 0) case 10: SpawnSkull("853 1582 238", "-30 270 0", 1) case 9: SpawnSkull("844 1582 237.5", "-27 285 0", 0) case 8: SpawnSkull("834 1585 237.5", "-30 255 0", 0) case 7: SpawnSkull("825 1585 237.5", "-30 285 0", 0) case 6: SpawnSkull("816 1583 238", "-30 285 0", 1) case 5: SpawnSkull("806 1585 238", "-27 285 0", 1) case 4: SpawnSkull("796 1585 237.5", "-27 275 0", 0) case 3: SpawnSkull("786 1584 237.5", "-27 265 0", 0) case 2: SpawnSkull("776 1584 238", "-30 255 0", 1) case 1: SpawnSkull("766 1584 237.5", "-27 285 0", 0) } local hObjectiveResource = FindByClassname(null, "tf_objective_resource") local hGameRules = FindByClassname(null, "tf_gamerules") ::Trespasser <- { // Cleanup function OnGameEvent_recalculate_holidays(_) { if(GetRoundState() == 3) { if(GetPropString(FindByClassname(null, "tf_objective_resource"), "m_iszMvMPopfileName").find("trespasser_v2") == null) Convars.SetValue("sig_etc_unintended_class_weapon_display_meters", 1) local hGameRules = FindByClassname(null, "tf_gamerules") if(hGameRules) { SetPropInt(hGameRules, "m_halloweenScenario", 0) SetPropBool(hGameRules, "m_bShowMatchSummary", false) } for(local i = 1; i <= MAX_PLAYERS; i++) { local hPlayer = PlayerInstanceFromIndex(i) if(!hPlayer) continue CleanupPlayer(hPlayer) if(hPlayer.IsFakeClient()) continue if(hPlayer.GetTeam() == 3) { hPlayer.ForceChangeTeam(2, true) hPlayer.ForceRespawn() } EmitSoundEx({ sound_name = "#trespasser_v2/music_spawnroom.wav" entity = hPlayer filter_type = RECIPIENT_FILTER_SINGLE_PLAYER flags = SND_STOP }) } if(hThinkEnt && hThinkEnt.IsValid()) hThinkEnt.Kill() delete ::Trespasser } } iProxyMineModelIndex = PrecacheModel("models/pickups/emitter.mdl") iBugBaitModelIndex = PrecacheModel("models/weapons/w_bugbait.mdl") bBlockerStairs = false bBlockerCade = false // Setup Music bMusic = true function SetMusicState(bool) { bMusic = bool for(local i = 1; i <= MAX_PLAYERS; i++) { local hPlayer = PlayerInstanceFromIndex(i) if(!hPlayer || hPlayer.IsFakeClient()) continue EmitSoundEx({ sound_name = "#trespasser_v2/music_spawnroom.wav" volume = 0.65 pitch = 85 entity = hPlayer filter_type = RECIPIENT_FILTER_SINGLE_PLAYER flags = bool ? SND_NOFLAGS : SND_STOP }) } } // OnKilled functions function SetDestroyCallback(entity, callback) { entity.ValidateScriptScope(); local scope = entity.GetScriptScope(); scope.setdelegate({}.setdelegate({ parent = scope.getdelegate() id = entity.GetScriptId() index = entity.entindex() callback = callback _get = function(k) { return parent[k]; } _delslot = function(k) { if (k == id) { entity = EntIndexToHScript(index); local scope = entity.GetScriptScope(); scope.self <- entity; callback.pcall(scope); } delete parent[k]; } }) ); } // Unstuck Logic function UnstuckEntity(hEntity) { local vecOrigin = hEntity.GetOrigin() local Trace = { start = vecOrigin end = vecOrigin hullmin = hEntity.GetBoundingMins() hullmax = hEntity.GetBoundingMaxs() mask = MASK_PLAYERSOLID ignore = hEntity } TraceHull(Trace) if("startsolid" in Trace) { local Dirs = [Vector(0, 0, 1), Vector(0, 0, -1), Vector(1, 0, 0), Vector(-1, 0, 0), Vector(0, 1, 0), Vector(0, -1, 0)] for (local i = 16; i <= 96; i += 16) { foreach (vecDir in Dirs) { Trace.start = vecOrigin + vecDir * i Trace.end = Trace.start delete Trace.startsolid TraceHull(Trace) if (!("startsolid" in Trace)) { hEntity.SetAbsOrigin(Trace.end) return true } } } return false } return true } // Bounding Box logic function IntersectionBoxBox(xorigin, xmins, xmaxs, yorigin, ymins, ymaxs) { xmins += xorigin xmaxs += xorigin ymins += yorigin ymaxs += yorigin return (xmins.x <= ymaxs.x && xmaxs.x >= ymins.x) && (xmins.y <= ymaxs.y && xmaxs.y >= ymins.y) && (xmins.z <= ymaxs.z && xmaxs.z >= ymins.z) } // Reset function CleanupPlayer(hPlayer) { SetPropBool(hPlayer, "m_bForcedSkin", false) SetPropInt(hPlayer, "m_nForcedSkin", 0) hPlayer.KeyValueFromInt("rendermode", 0) hPlayer.KeyValueFromInt("renderfx", 0) hPlayer.KeyValueFromInt("renderamt", 255) hPlayer.AcceptInput("color", "255 255 255", null, null) hPlayer.AcceptInput("$RemoveItemAttribute", "custom view model|2", null, null) DispatchParticleEffectOn(hPlayer, null) if(!hPlayer.IsBotOfType(TF_BOT_TYPE)) { hPlayer.SetForceLocalDraw(false) hPlayer.SetScriptOverlayMaterial(null) hPlayer.SetCustomModelWithClassAnimations(null) ClientPrint(hPlayer, 4, "") } } // Camera Intro Sequence function StartCamera() { ScreenFade(null, 0, 0, 0, 255, 1, 0.033, 2) local hCameraProp = SpawnEntityFromTable("prop_dynamic", { model = "models/props_mvm/trespasser_camera.mdl" startdisabled = 1 disableshadows = 1 "OnAnimationDone" : "!self,Kill,,-1,-1" }) local hCamera = SpawnEntityFromTable("point_viewcontrol", { targetname = "trespasser_camera" }) hCamera.AcceptInput("SetParent", "!activator", hCameraProp, null) hCamera.AcceptInput("SetParentAttachment", "camera", null, null) SetDestroyCallback(hCamera, function() { self.AcceptInput("$DisableAll", null, null, null) SetPropBool(FindByClassname(null, "tf_gamerules"), "m_bShowMatchSummary", false) ScreenFade(null, 0, 0, 0, 255, 1, 0, 1) for(local i = 1; i <= MAX_CLIENTS; i++) { local hPlayer = PlayerInstanceFromIndex(i) if(!hPlayer || hPlayer.IsFakeClient()) continue if(hPlayer.GetTeam() >= 2) { hPlayer.RemoveCond(TF_COND_TAUNTING) hPlayer.SetForceLocalDraw(false) hPlayer.SetHudHideFlags(0) } SetPropInt(hPlayer, "m_iFOV", 0) } }) EntFireByHandle(hCamera, "RunScriptCode", "Trespasser.InitializeCamera(activator, self)", 1, hCameraProp, null) } function InitializeCamera(hCameraProp, hCamera) { SetPropBool(FindByClassname(null, "tf_gamerules"), "m_bShowMatchSummary", true) hCameraProp.AcceptInput("SetAnimation", "camera", null, null) hCameraProp.AcceptInput("Enable", null, null, null) hCamera.AcceptInput("$EnableAll", null, null, null) for(local i = 1; i <= MAX_CLIENTS; i++) { local hPlayer = PlayerInstanceFromIndex(i) if(!hPlayer || hPlayer.IsFakeClient()) continue if(hPlayer.GetTeam() >= 2) { hPlayer.RemoveCond(TF_COND_TAUNTING) hPlayer.SetForceLocalDraw(true) local hWeapon = hPlayer.GetActiveWeapon() if(hWeapon) hWeapon.EnableDraw() hPlayer.SetHudHideFlags(~0) } } hCamera.ValidateScriptScope() hCamera.GetScriptScope().Think <- function() { for(local i = 1; i <= MAX_CLIENTS; i++) { local hPlayer = PlayerInstanceFromIndex(i) if(!hPlayer || hPlayer.IsFakeClient()) continue SetPropInt(hPlayer, "m_iFOV", 75) } return -1 } AddThinkToEnt(hCamera, "Think") } // Red-Tape Recorder : Reprogrammed Neutral BotModel = [ null, "models/bots/scout/bot_scout_gray.mdl" "models/bots/sniper/bot_sniper_gray.mdl" "models/bots/soldier/bot_soldier_gibby_gray.mdl" "models/bots/demo/bot_demo_gray.mdl" "models/bots/medic/bot_medic_gray.mdl" "models/bots/heavy/bot_heavy_gibby_gray.mdl" "models/bots/pyro/bot_pyro_gray.mdl" "models/bots/spy/bot_spy_gray.mdl" "models/bots/engineer/bot_engineer_gray.mdl" ] BotGiantModel = [ null, "models/bots/scout_boss/bot_scout_gray_boss.mdl" "models/bots/sniper/bot_sniper_gray.mdl" "models/bots/soldier_boss/bot_soldier_boss_gibby_gray.mdl" "models/bots/demo_boss/bot_demo_gray_boss.mdl" "models/bots/medic/bot_medic_gray.mdl" "models/bots/heavy_boss/bot_heavy_gray_boss.mdl" "models/bots/pyro_boss/bot_pyro_gray_boss.mdl" "models/bots/spy/bot_spy_gray.mdl" "models/bots/engineer/bot_engineer_gray.mdl" ] function OnGameEvent_player_stunned(params) { local hStunner if("stunner" in params) hStunner = GetPlayerFromUserID(params.stunner) local hVictim if("victim" in params) hVictim = GetPlayerFromUserID(params.victim) if(!hStunner || !hVictim || !hVictim.IsBotOfType(TF_BOT_TYPE)) return if(hVictim.HasBotTag("bot_nogray")) return local bHasRTR = false for(local i = 0; i <= 8; i++) { local hWeapon = GetPropEntityArray(hStunner, "m_hMyWeapons", i) if(hWeapon && GetPropInt(hWeapon, "m_AttributeManager.m_Item.m_iItemDefinitionIndex") == 810) { bHasRTR = true; break } } if(bHasRTR) { local hObjSapper while(hObjSapper = FindByClassname(hObjSapper, "obj_attachment_sapper")) if(GetPropEntity(hObjSapper, "m_hBuilder") == hStunner) break if(!hObjSapper) return hObjSapper.ValidateScriptScope() local hObjSapper_scope = hObjSapper.GetScriptScope() if(!("hBots" in hObjSapper_scope)) { hObjSapper.AcceptInput("ClearParent", null, null, null) hObjSapper_scope.hSappedBot <- GetPropEntity(hObjSapper, "m_hBuiltOnEntity") hObjSapper_scope.hBots <- {} hObjSapper_scope.Think <- function() { local PlayerAlive = @(handle) handle && handle.IsValid() && handle.IsAlive() foreach(hBot, Array in hBots) { local bBotValid = hBot.IsValid() if(!bBotValid || !hBot.IsAlive()) { if(bBotValid) { local hParticle = Array[0] if(hParticle && hParticle.IsValid()) hParticle.Kill() hBot.SetCustomModelWithClassAnimations(Array[1]) } delete hBots[hBot] continue } if(!PlayerAlive(hSappedBot)) { hSappedBot = hBot SetPropEntity(hObjSapper, "m_hBuiltOnEntity", hBot) } hBot.RemoveCond(TF_COND_STUNNED) hBot.RemoveCond(TF_COND_SAPPED) } if(!PlayerAlive(hSappedBot)) { self.AcceptInput("RemoveHealth", "9999", null, null); return } self.SetAbsOrigin(hSappedBot.GetAttachmentOrigin(1)) self.SetAbsAngles(hSappedBot.GetAttachmentAngles(1)) return -1 } AddThinkToEnt(hObjSapper, "Think") Trespasser.SetDestroyCallback(hObjSapper, function() { foreach(hBot, Array in hBots) { hBot.AcceptInput("$RemoveCond", "159", null, null) hBot.AcceptInput("$ChangeAttributes", "RevertGray", null, null) foreach(Attribute, Value in Array[2]) { if(typeof Value == "function") Value(hBot) else hVictim.AcceptInput("$RemoveItemAttribute", format("%s|%i", Attribute, Array[3]), null, null) } local hParticle = Array[0] if(hParticle && hParticle.IsValid()) hParticle.Kill() hBot.SetCustomModelWithClassAnimations(Array[1]) local iTeamNum = hBot.GetTeam() for(local i = 0; i <= 8; i++) { local hWeapon = GetPropEntityArray(hBot, "m_hMyWeapons", i) if(hWeapon) hWeapon.SetTeam(iTeamNum) } } }) } local hParticle = SpawnEntityFromTable("info_particle_system", { origin = hVictim.GetOrigin() effect_name = "medic_resist_bullet" start_active = 1 }) hParticle.AcceptInput("SetParent", "!activator", hVictim, null) local ModelList = hVictim.IsMiniBoss() ? Trespasser.BotGiantModel : Trespasser.BotModel local sModel = ModelList[hVictim.GetPlayerClass()] local Tags = {} hVictim.GetAllBotTags(Tags) foreach(k, tag in Tags) if(startswith(tag, "graymodel")) { local sParams = split(tag, "|"); sModel = sParams[1]; break } local sPreviousModel = hVictim.GetModelName() if(sModel != "null") hVictim.SetCustomModelWithClassAnimations(sModel) hVictim.AcceptInput("$ChangeAttributes", "Gray", null, null) hVictim.AcceptInput("$AddCond", "159", null, null) local Attributes = {} if(hVictim.HasBotTag("gray_generic")) { Attributes["ammo regen"] <- 1 Attributes["crit mod disabled"] <- 0 Attributes["use robot voice"] <- 1 Attributes["additional step sound"] <- "MVM.BotStep" Attributes["set item tint RGB"] <- 8289918 } if(hVictim.HasBotTag("gray_robrute")) { EntFire("player", "$PlaySoundToSelf", "ambient/machines/thumper_shutdown1.wav") for(local hChild = hVictim.FirstMoveChild(); hChild; hChild = hChild.NextMovePeer()) if(GetPropInt(hChild, "m_AttributeManager.m_Item.m_iItemDefinitionIndex") == 31279) { hChild.AddAttribute("set item tint rgb", 16711680, -1) hChild.AddAttribute("attach particle effect", 0, -1) break } Attributes["callback"] <- function(hBot) { EntFire("player", "$PlaySoundToSelf", "ambient/machines/thumper_startup1.wav") for(local hChild = hBot.FirstMoveChild(); hChild; hChild = hChild.NextMovePeer()) if(GetPropInt(hChild, "m_AttributeManager.m_Item.m_iItemDefinitionIndex") == 31279) { hChild.AddAttribute("set item tint rgb", 3329330, -1) hChild.AddAttribute("attach particle effect", 0, -1) break } } } if(hVictim.HasBotTag("gray_medic")) { Attributes["medigun particle"] <- "~medicgun_beam_machinery" } foreach(Attribute, Value in Attributes) hVictim.AcceptInput("$AddItemAttribute", Attribute + "|" + Value, null, null) hObjSapper_scope.hBots[hVictim] <- [hParticle, sPreviousModel, Attributes, hVictim.GetActiveWeapon().GetSlot()] } } // Infected Sniper Viewmodel function SetInfectedSniperViewmodel() { local hPlayer = self local hWeapon for(local i = 0; i <= 8; i++) { hWeapon = GetPropEntityArray(hPlayer, "m_hMyWeapons", i) if(hWeapon && hWeapon.GetSlot() == 2) break } if(!hWeapon) return hPlayer.AcceptInput("$TauntFromItem", "Taunt: Burstchester", null, null) local sViewmodel = "models/player/infection/v_models/v_infected_sniper.mdl" local iViewmodel = PrecacheModel(sViewmodel) SetPropInt(hWeapon, "m_iViewModelIndex", iViewmodel) SetPropInt(hWeapon, "m_nModelIndex", iViewmodel) local ZombieCosmetics = [ 5617 5617 5625 5618 5620 5622 5619 5624 5623 5621 5621 ] SetPropInt(hWeapon, "m_AttributeManager.m_Item.m_iItemDefinitionIndex", ZombieCosmetics[hPlayer.GetPlayerClass()]) SetPropBool(hWeapon, "m_AttributeManager.m_Item.m_bOnlyIterateItemViewAttributes", true) hWeapon.ValidateScriptScope() local hWeapon_scope = hWeapon.GetScriptScope() hWeapon_scope.bModelSwap <- false hWeapon_scope.Think <- function() { if(!self.IsValid()) return local hWeapon = hPlayer.GetActiveWeapon() local hViewmodel = GetPropEntity(hPlayer, "m_hViewModel") if(hWeapon && hViewmodel && (bModelSwap || !hPlayer.InCond(TF_COND_TAUNTING))) { if(hWeapon != self) hPlayer.Weapon_Switch(self) else { if(!bModelSwap) { bModelSwap = true hViewmodel.SetModelSimple(sViewmodel) self.SetModelSimple(sViewmodel) self.SetCustomViewModel(sViewmodel) SetPropInt(self, "m_iViewModelIndex", iViewmodel) SetPropInt(self, "m_nModelIndex", iViewmodel) local hCommand = CreateByClassname("point_clientcommand") hCommand.AcceptInput("Command", "r_screenoverlay effects/stealth_overlay", hPlayer, null) hCommand.Kill() hPlayer.SetScriptOverlayMaterial("debug/hsv") SetPropBool(hPlayer, "m_bForcedSkin", true) SetPropInt(hPlayer, "m_nForcedSkin", hPlayer.GetPlayerClass() == TF_CLASS_SPY ? 23 : 5) hPlayer.SetIsMiniBoss(true) } local flTime = Time() local flNextPrimaryAttack = GetPropFloat(hWeapon, "m_flNextPrimaryAttack") local flTimeWeaponIdle = GetPropFloat(hWeapon, "m_flTimeWeaponIdle") local iButtons = GetPropInt(hPlayer, "m_nButtons") local iSeqRef = hViewmodel.LookupSequence("ref") local iSeqDraw = hViewmodel.LookupSequence("draw") local iSeqIdle = hViewmodel.LookupSequence("idle") local iSeqAttack = hViewmodel.LookupSequence("attack") if(iButtons & IN_ATTACK) { if(flNextPrimaryAttack == flTimeWeaponIdle) { // hPlayer.ViewPunch(QAngle(-2, RandomFloat(-3, 3), 0)) hViewmodel.ResetSequence(iSeqAttack) SetPropFloat(self, "m_flNextPrimaryAttack", flTime + 0.85 * self.GetAttribute("fire rate bonus", 1)) } } if(hViewmodel.GetSequence() == iSeqRef) hViewmodel.ResetSequence(iSeqDraw) else if(hViewmodel.IsSequenceFinished()) hViewmodel.ResetSequence(iSeqIdle) } } return -1 } AddThinkToEnt(hWeapon, "Think") Trespasser.SetDestroyCallback(hWeapon, function() { if(bModelSwap) { local hCommand = CreateByClassname("point_clientcommand") hCommand.AcceptInput("Command", "r_screenoverlay /", hPlayer, null) hCommand.Kill() hPlayer.SetScriptOverlayMaterial(null) SetPropBool(hPlayer, "m_bForcedSkin", false) SetPropInt(hPlayer, "m_nForcedSkin", 0) hPlayer.SetIsMiniBoss(false) } }) } // Merasmus's Staff function MerasmusZap() { local hAttacker = activator local hVictim = self if(hAttacker == hVictim) return hVictim.AcceptInput("IgnitePlayer", null, null, null) PrecacheScriptSound("Halloween.Merasmus_Spell") hVictim.AcceptInput("$PlaySound", "Halloween.Merasmus_Spell", null, null) hVictim.ApplyAbsVelocityImpulse(Vector(0, 0, 256)) PrecacheScriptSound("Halloween.MerasmusStaffAttack") hAttacker.AcceptInput("$PlaySound", "Halloween.MerasmusStaffAttack", null, null) local iEffectHandR = hAttacker.LookupAttachment("effect_hand_R") local vecEffectHandR = hAttacker.GetAttachmentOrigin(iEffectHandR) local angEffectHandR = hAttacker.GetAttachmentAngles(iEffectHandR) local hParticleZap = SpawnEntityFromTable("info_particle_system", { origin = vecEffectHandR + angEffectHandR.Up() * 128 effect_name = "merasmus_zap" start_active = 1 }) hParticleZap.SetForwardVector(hAttacker.EyeAngles().Forward()) SetPropBool(hParticleZap, "m_bForcePurgeFixedupStrings", true) local hZapTarget = SpawnEntityFromTable("info_target", { origin = hVictim.GetCenter(), spawnflags = 0x01 }) SetPropBool(hZapTarget, "m_bForcePurgeFixedupStrings", true) SetPropEntityArray(hParticleZap, "m_hControlPointEnts", hZapTarget, 0) EntFireByHandle(hParticleZap, "Kill", null, 0.066, null, null) EntFireByHandle(hZapTarget, "Kill", null, 0.066, null, null) } // Merasmus's Bombinomicon function GiveBombinomicon() { local hPlayer = self hPlayer.AcceptInput("$GiveItem", "Basic Spellbook", null, null) local hBook for(local hChild = hPlayer.FirstMoveChild(); hChild; hChild = hChild.NextMovePeer()) if(hChild.GetClassname() == "tf_weapon_spellbook") { hBook = hChild; break } SetPropBool(hBook, "m_bForcePurgeFixedupStrings", true) hBook.ValidateScriptScope() local hBook_scope = hBook.GetScriptScope() hBook_scope.hGameText <- SpawnEntityFromTable("game_text", { channel = 0 color = "255 0 0" holdtime = 1 x = 0.8 y = 0.8 }) hBook_scope.flRechargeTime <- Time() + 12 hBook_scope.iSpellChargesLast <- 0 hBook_scope.Think <- function() { local flTime = Time() local iSpellCharges = GetPropInt(self, "m_iSpellCharges") if(iSpellCharges == 0) { local flRechargeTimeDuration = 12 if(iSpellChargesLast == 1) { hGameText.KeyValueFromString("color", "255 0 0") flRechargeTime = flTime + flRechargeTimeDuration } local iMessageMaxLength = 14 local sMessage = "BOMBINOMICON!\n" if(flTime >= flRechargeTime) { hGameText.KeyValueFromString("color", "0 255 0") hPlayer.AcceptInput("$SetSpell", "pumpkin mirv", null, null) hPlayer.AcceptInput("$PlaySoundToSelf", "TFPlayer.ReCharged", null, null) PrecacheScriptSound("Halloween.BombinomiconBombs") hPlayer.AcceptInput("$PlaySoundToSelf", "Halloween.BombinomiconBombs", null, null) for(local i = 1; i <= iMessageMaxLength; i++) sMessage += "▰" sMessage += " READY" } else { local flTimeRemaining = flRechargeTime - flTime local flTimeRemainingPercent = 1 - flTimeRemaining / flRechargeTimeDuration local flMessagePercent = 1.0 / iMessageMaxLength local iRechargeMeter = (flTimeRemainingPercent / flMessagePercent).tointeger() for(local i = 1; i <= iRechargeMeter; i++) sMessage += "▰", iMessageMaxLength-- for(local i = 1; i <= iMessageMaxLength; i++) sMessage += "▱" sMessage += format(" %i", ceil(flTimeRemaining)) } SetPropString(hGameText, "m_iszMessage", sMessage) } iSpellChargesLast = iSpellCharges hGameText.AcceptInput("Display", null, hPlayer, null) return -1 } AddThinkToEnt(hBook, "Think") Trespasser.SetDestroyCallback(hBook, function() { if(hGameText && hGameText.IsValid()) hGameText.Destroy() }) } function DispatchParticleEffectOn(entity, name) { if(entity == null) return if(name == null) { entity.AcceptInput("DispatchEffect", "ParticleEffectStop", null, null); return } local hParticle = CreateByClassname("trigger_particle") hParticle.KeyValueFromString("particle_name", name) hParticle.KeyValueFromInt("attachment_type", 1) hParticle.KeyValueFromInt("spawnflags", 64) hParticle.DispatchSpawn() hParticle.AcceptInput("StartTouch", null, entity, entity) hParticle.Kill() } function DispatchParticleEffectClient(player, name, origin, angles) { local hProxy = CreateByClassname("obj_teleporter") hProxy.SetAbsOrigin(origin) hProxy.SetForwardVector(angles) hProxy.DispatchSpawn() hProxy.DisableDraw() hProxy.AddEFlags(EFL_NO_THINK_FUNCTION) hProxy.SetSolid(SOLID_NONE) SetPropBool(hProxy, "m_bPlacing", true) SetPropInt(hProxy, "m_fObjectFlags", 2) SetPropInt(hProxy, "m_lifeState", 2) SetPropEntity(hProxy, "m_hBuilder", player) local hParticle = CreateByClassname("trigger_particle") hParticle.KeyValueFromString("particle_name", name) hParticle.KeyValueFromInt("attachment_type", 1) hParticle.KeyValueFromInt("spawnflags", 64) hParticle.DispatchSpawn() hParticle.AcceptInput("StartTouch", null, hProxy, hProxy) EntFireByHandle(hProxy, "Kill", null, 0.066, null, null) hParticle.Kill() } bHHHAttackedThisTick = false function OnScriptHook_OnTakeDamage(params) { local hVictim = params.const_entity local iVictimModelIndex = GetPropInt(hVictim, "m_nModelIndex") local hAttacker = params.attacker local iAttackerModelIndex = GetPropInt(hAttacker, "m_nModelIndex") local hInflictor = params.inflictor local iInflictorModelIndex = GetPropInt(hInflictor, "m_nModelIndex") local hWeapon = params.weapon local vecHit = params.damage_position if(hInflictor && hInflictor.GetClassname() == "tf_pumpkin_bomb" && hVictim == hAttacker) { hAttacker.ApplyAbsVelocityImpulse(params.damage_force * 0.03) params.damage *= 0 } if(hVictim && hInflictor) { // makes planted proxy mines deal 500% damage if ( iInflictorModelIndex == Trespasser.iProxyMineModelIndex && hInflictor.GetSkin() == 1 && hInflictor.GetForwardVector().x == 1 && GetPropEntity(hInflictor, "m_hThrower") != hVictim ) params.damage *= 5 // pull players into the viro if(iInflictorModelIndex == Trespasser.iBugBaitModelIndex && hVictim.IsPlayer()) { local hThrower = GetPropEntity(hInflictor, "m_hThrower") if(hThrower && hThrower != hVictim) { local vecTowardsThrower = hThrower.GetOrigin() - hVictim.GetOrigin() vecTowardsThrower.z = 0 vecTowardsThrower.Norm() hVictim.SetAbsVelocity(vecTowardsThrower * 400 + Vector(0, 0, 400)) } } if(hInflictor.GetClassname() == "saw_kill") params.damage_type = params.damage_type | DMG_ALWAYSGIB } if(hVictim && hAttacker) { local sVictimClassname = hVictim.GetClassname() local iVictimTeam = "GetTeam" in hVictim ? hVictim.GetTeam() : -1 local sAttackerClassname = hAttacker.GetClassname() local iAttackerTeam = "GetTeam" in hAttacker ? hAttacker.GetTeam() : -1 // prevents MiniBosses from trampling over buildings that arent a sentrygun (except minis) if ( HasProp(hVictim, "m_iObjectType") && GetPropBool(hVictim, "m_bMiniBuilding") == false && "IsMiniBoss" in hAttacker && hAttacker.IsMiniBoss() && hWeapon == null && params.damage_type == DMG_BLAST && params.damage_custom == TF_DMG_CUSTOM_NONE && params.force_friendly_fire == false ) params.damage = 0 // Gives gray bots crit damage against blue bots if(iVictimTeam == 3 && iAttackerTeam == 1) params.damage_type = params.damage_type | DMG_ACID local bIsMiniCrit = "InCond" in hAttacker && ( hAttacker.InCond(TF_COND_OFFENSEBUFF) || hAttacker.InCond(TF_COND_ENERGY_BUFF) ) // increase melee effectiveness against horsemann, monoculus, and skeletons // makes horsemann headshottable // allows crit vfx to play on npc entities if ( ( sVictimClassname == "headless_hatman" || sVictimClassname == "eyeball_boss" || sVictimClassname == "tf_zombie" || sVictimClassname == "tank_boss" ) && iVictimTeam != iAttackerTeam ) { if(sVictimClassname != "tank_boss") { if("GetSlot" in hWeapon) { if(hWeapon.GetSlot() == 2) { params.damage_type = params.damage_type | DMG_ACID if((bSoloMode && sVictimClassname == "headless_hatman") || sVictimClassname == "eyeball_boss") params.damage *= 2 } else if((sVictimClassname == "headless_hatman" || sVictimClassname == "tf_zombie") && (hWeapon.GetAttribute("can headshot", 0) || hWeapon.GetAttribute("revolver use hit locations", 0))) { local iHead = hVictim.LookupBone("bip_head") local vecHead = hVictim.GetBoneOrigin(iHead) local angHead = hVictim.GetBoneAngles(iHead) if ( (sVictimClassname == "headless_hatman" && (vecHead + angHead.Up() * -2.25 + angHead.Left() * 2.25 - vecHit).Length() <= 14) || (sVictimClassname == "tf_zombie" && (vecHead + angHead.Up() * -1.05 + angHead.Left() * 3.5 - vecHit).Length() <= 12) ) params.damage_type = params.damage_type | DMG_ACID } } if(params.damage_type & DMG_ACID) { if(sVictimClassname == "tf_zombie") params.damage *= 3 if("GetAttribute" in hWeapon) params.damage *= hWeapon.GetAttribute("mult crit dmg", 1) } else if(bIsMiniCrit) params.damage *= 1.35 } local CritEffect = function(bMiniCrit) { DispatchParticleEffectClient(hAttacker, bMiniCrit ? "minicrit_text" : "crit_text", hVictim.GetOrigin() + Vector(0, 0, hVictim.GetBoundingMaxs().z), Vector(1)) local sRNG = RandomInt(1, 5).tostring() local sSound = format("player/crit_hit%s%s.wav", bMiniCrit ? "_mini" : "", sRNG == "1" ? "" : sRNG) PrecacheSound(sSound) EmitSoundEx({ sound_name = sSound filter_type = RECIPIENT_FILTER_SINGLE_PLAYER entity = hAttacker }) } if(hVictim != hAttacker) { if(params.damage_type & DMG_ACID) CritEffect(false) else if(bIsMiniCrit) CritEffect(true) } } // make crits deal their normal 3x damage against monoculus if(sVictimClassname == "eyeball_boss" && params.damage_type & DMG_ACID) params.damage *= 1.5 if(hVictim.IsPlayer() && hVictim.IsBotOfType(TF_BOT_TYPE)) { if(hVictim.HasBotTag("metal_hit")) DispatchParticleEffect("lowv_sparks1", vecHit, Vector(0, 0, 1)) if(hVictim.HasBotTag("blood_hit_green")) DispatchParticleEffect("spell_skeleton_goop_green", hVictim.GetCenter(), Vector(1)) if(hVictim.HasBotTag("blood_hit_big")) DispatchParticleEffect("tfc_sniper_mist", hVictim.GetCenter(), Vector(1)) if(hVictim.HasBotTag("bot_receivemeleecrit") && "GetSlot" in hWeapon && hWeapon.GetSlot() == 2) params.damage_type = params.damage_type | DMG_ACID } if(sAttackerClassname == "headless_hatman") { if(iVictimTeam == 3) params.damage *= 2 if(hAttacker == hInflictor && GetPropInt(hGameRules, "m_halloweenScenario") == 5) { if(!bHHHAttackedThisTick) { bHHHAttackedThisTick = true EntFireByHandle(hAttacker, "RunScriptCode", "Trespasser.bHHHAttackedThisTick = false", 0.033, null, null) local vecVictimOrigin = hVictim.GetOrigin() local vecAttackerOrigin = hAttacker.GetOrigin() local hHammerKillIcon = SpawnEntityFromTable("info_target", { classname = "necro_smasher", origin = vecVictimOrigin }) EntFireByHandle(hHammerKillIcon, "Kill", null, -1, null, null) local vecAttackerEye = hAttacker.EyePosition() local vecTrace = hVictim.GetCenter() local flAttackRange = Convars.GetFloat("tf_halloween_hhh_attack_kart_radius") for(local hPlayer; hPlayer = FindByClassnameWithin(hPlayer, "player", vecVictimOrigin, flAttackRange);) if(hPlayer.IsAlive() && TraceLine(vecTrace, vecAttackerEye, hAttacker) == 1) { EntFireByHandle(hAttacker, "RunScriptCode", "activator.TakeDamageEx(caller, self, null, Vector(), Vector(), activator.GetMaxHealth() * 0.4, DMG_CLUB)", -1, hPlayer, hHammerKillIcon) local vecAway = hPlayer.GetOrigin() - vecAttackerOrigin vecAway.Norm() hPlayer.ApplyAbsVelocityImpulse(vecAway * 500) hPlayer.AddCustomAttribute("increased air control", 2, 2) } } params.damage = 0 // very very gross hAttacker.StopSound("Halloween.HeadlessBossAxeHitWorld") EntFireByHandle(hAttacker, "RunScriptCode", "self.StopSound(`Halloween.HeadlessBossAxeHitWorld`)", -1, null, null) EntFireByHandle(hAttacker, "RunScriptCode", "self.StopSound(`Halloween.HeadlessBossAxeHitWorld`)", 0.033, null, null) hAttacker.StopSound("Halloween.HeadlessBossAxeHitFlesh") EntFireByHandle(hAttacker, "RunScriptCode", "self.StopSound(`Halloween.HeadlessBossAxeHitFlesh`)", -1, null, null) EntFireByHandle(hAttacker, "RunScriptCode", "self.StopSound(`Halloween.HeadlessBossAxeHitFlesh`)", 0.033, null, null) } } // nullify combattank knockback force if(sAttackerClassname == "tank_boss" && hVictim.IsPlayer()) hVictim.AddCustomAttribute("damage force increase hidden", 0, 0.033) } } function OnGameEvent_teamplay_round_win(params) { bLastMan = false bSoloMode = false if(params.team == 3) { for(local i = 1; i <= MAX_PLAYERS; i++) { local hPlayer = PlayerInstanceFromIndex(i) if(hPlayer && !hPlayer.IsFakeClient() && GetPropInt(hPlayer, "m_iObserverMode") <= 1) { SetPropEntity(hPlayer, "m_hObserverTarget", null) EntFire("bignet", "RunScriptCode", "SetPropEntity(activator, `m_hObserverTarget`, null)", 0.033, hPlayer) } } EntFire("gameover_relay", "Trigger") TrespasserLosses++ } } // Chainsaw Sounds function Chainsaw() { local hPlayer = self local hChainsaw for(local i = 0; i <= 8; i++) { local hWeapon = GetPropEntityArray(hPlayer, "m_hMyWeapons", i) if(hWeapon && hWeapon.GetSlot() == 0) { hChainsaw = hWeapon; break } } if(!hChainsaw) return local hViewmodel = GetPropEntity(hPlayer, "m_hViewModel") hChainsaw.ValidateScriptScope() local hChainsaw_scope = hChainsaw.GetScriptScope() hChainsaw_scope.iWeaponStateLast <- 0 hChainsaw_scope.Think <- function() { if(!self.IsValid()) return local iWeaponState = GetPropInt(self, "m_iWeaponState") if(hPlayer && hPlayer.IsValid()) { local hViewmodel = GetPropEntity(hPlayer, "m_hViewModel") if(hViewmodel && hViewmodel.IsValid()) hViewmodel.AcceptInput("DispatchEffect", "ParticleEffectStop", null, null) } EmitSoundEx({ sound_name = "common/null.wav", channel = CHAN_WEAPON, entity = self, flags = SND_STOP | SND_IGNORE_NAME, filter_type = RECIPIENT_FILTER_GLOBAL }) if(iWeaponState != iWeaponStateLast) { iWeaponStateLast = iWeaponState switch(iWeaponState) { case 0: hViewmodel.StopSound("Chainsaw.Start") hViewmodel.StopSound("Chainsaw.Run") hViewmodel.EmitSound("Chainsaw.Stop") break case 1: hViewmodel.EmitSound("Chainsaw.Start") hViewmodel.StopSound("Chainsaw.Run") hViewmodel.StopSound("Chainsaw.Stop") break case 2: hViewmodel.StopSound("Chainsaw.Start") hViewmodel.EmitSound("Chainsaw.Run") hViewmodel.StopSound("Chainsaw.Stop") break default: hViewmodel.StopSound("Chainsaw.Start") hViewmodel.StopSound("Chainsaw.Run") hViewmodel.StopSound("Chainsaw.Stop") break } } return -1 } AddThinkToEnt(hChainsaw, "Think") Trespasser.SetDestroyCallback(hChainsaw, function() { if(hViewmodel && hViewmodel.IsValid()) { hViewmodel.StopSound("Chainsaw.Start") hViewmodel.StopSound("Chainsaw.Run") hViewmodel.StopSound("Chainsaw.Stop") } }) Trespasser.SetDestroyCallback(hViewmodel, function() { self.StopSound("Chainsaw.Start") self.StopSound("Chainsaw.Run") self.StopSound("Chainsaw.Stop") }) } // Chainsaw fire input on attack function ChainsawHit() { local hPlayer = self local vecEye = hPlayer.EyePosition() local Trace = { start = vecEye end = vecEye + hPlayer.EyeAngles().Forward() * (72 * hPlayer.GetCustomAttribute("melee range multiplier", 1)) mask = MASK_SHOT_HULL ignore = hPlayer hullmin = Vector(-10, -10, -10) hullmax = Vector(10, 10, 10) } TraceHull(Trace) if("enthit" in Trace) { local iTeamNum = hPlayer.GetTeam() local sSound = "Wood.Loud" if(Trace.enthit.IsPlayer()) { if(Trace.enthit.GetTeam() == iTeamNum) return sSound = "Chainsaw.Hit" } EmitSoundEx({ sound_name = sSound origin = Trace.endpos }) local flDamageBonus = hPlayer.GetCustomAttribute("damage bonus", 1) * hPlayer.GetCustomAttribute("damage penalty", 1) local flBlastRadius = hPlayer.GetCustomAttribute("Blast radius increased", 1) * hPlayer.GetCustomAttribute("Blast radius decreased", 1) local hExplosion = CreateByClassname("env_explosion") hExplosion.SetAbsOrigin(Trace.endpos) SetPropInt(hExplosion, "m_iMagnitude", 25 * flDamageBonus) SetPropInt(hExplosion, "m_iRadiusOverride", 20 * flBlastRadius) SetPropInt(hExplosion, "m_spawnflags", 18300) SetPropInt(hExplosion, "m_iTeamNum", iTeamNum) SetPropEntity(hExplosion, "m_hEntityIgnore", hPlayer) hExplosion.SetOwner(hPlayer) hExplosion.DispatchSpawn() hExplosion.KeyValueFromString("classname", "saw_kill") hExplosion.AcceptInput("Explode", null, null, null) // weird particle bug which needs to be at the end of the tick EntFire("bignet", "RunScriptCode", format("DispatchParticleEffect(`versus_door_slam`, Vector(%i, %i, %i), Vector(1))", Trace.endpos.x, Trace.endpos.y, Trace.endpos.z), -1) hPlayer.ApplyAbsVelocityImpulse((Trace.endpos - self.GetOrigin()) * 2.5) } } function ParatrooperRifle() { local hPlayer = self local hRifle for(local i = 0; i <= 8; i++) { local hWeapon = GetPropEntityArray(hPlayer, "m_hMyWeapons", i) if(hWeapon && hWeapon.GetSlot() == 1) { hRifle = hWeapon; break } } if(!hRifle) return hRifle.ValidateScriptScope() local hRifle_scope = hRifle.GetScriptScope() if("hPack" in hRifle_scope && hRifle_scope.hPack && hRifle_scope.hPack.IsValid()) hRifle_scope.hPack.Kill() hRifle_scope.hParachute <- null hRifle_scope.bDeployed <- false local MakeParachute = function(player) { local parachute = CreateByClassname("tf_weapon_parachute") SetPropInt(parachute, "m_AttributeManager.m_Item.m_iItemDefinitionIndex", 1101) SetPropBool(parachute, "m_AttributeManager.m_Item.m_bInitialized", true) parachute.DispatchSpawn() player.Weapon_Equip(parachute) return parachute } hRifle_scope.Think <- function() { local bParaCond = hPlayer.InCond(80) if(bParaCond && !bDeployed) { bDeployed = true if(hParachute && hParachute.IsValid()) hParachute.Kill() hParachute = MakeParachute(hPlayer) GetPropEntity(hParachute, "m_hExtraWearable").Kill() } else if(!bParaCond && bDeployed) { bDeployed = false if(hParachute && hParachute.IsValid()) EntFireByHandle(hParachute, "Kill", null, 0.175, null, null) } if(hParachute && hParachute.IsValid()) { hParachute.RemoveAttribute("allow bunny hop") hParachute.RemoveAttribute("parachute redeploy") hParachute.AddAttribute("increased air control", -4, -1) } return -1 } local bGivePack = true for(local hChild = hPlayer.FirstMoveChild(); hChild; hChild = hChild.NextMovePeer()) { local iItemIndex = GetPropInt(hChild, "m_AttributeManager.m_Item.m_iItemDefinitionIndex") if(iItemIndex == 231 || iItemIndex == 57 || iItemIndex == 642) { bGivePack = false; break } } if(bGivePack) { local hTempParachute = MakeParachute(hPlayer) hRifle_scope.hPack <- GetPropEntity(hTempParachute, "m_hExtraWearable") hTempParachute.Kill() Trespasser.SetDestroyCallback(hRifle, function() { if(hPack && hPack.IsValid()) hPack.Kill() }) } AddThinkToEnt(hRifle, "Think") } // Annotations function SendAnnotationOn(hEnt, sText, flDuration, bVisibleToOthers = false, flDelay = -1) { if(flDelay < 0.033) flDelay = 0.033 local bRealClient = hEnt.IsPlayer() && !hEnt.IsFakeClient() local hAnnotationFollow if(bRealClient) { hAnnotationFollow = SpawnEntityFromTable("prop_dynamic", { model = "models/props_hydro/barrel_crate_half.mdl", origin = "400 0 60", disableshadows = 1 }) hAnnotationFollow.DisableDraw() SetPropEntity(hAnnotationFollow, "m_hMovePeer", hEnt.FirstMoveChild()) SetPropEntity(hEnt, "m_hMoveChild", hAnnotationFollow) SetPropEntity(hAnnotationFollow, "m_hMoveParent", hEnt) SpawnEntityFromTable("info_target", { spawnflags = 0x01 }).AcceptInput("SetParent", "!activator", hAnnotationFollow, null) EntFireByHandle(hAnnotationFollow, "Kill", null, flDelay + flDuration + 0.2, null, null) SetPropBool(hAnnotationFollow, "m_bForcePurgeFixedupStrings", true) } DoEntFire("bignet", "RunScriptCode" format(@" local index = activator.entindex() local hTarget = SpawnEntityFromTable(`info_target`, { spawnflags = 0x01 }) hTarget.AcceptInput(`SetParent`, `!activator`, activator, null) local anno = function(entindex1, entindex2){ SendGlobalGameEvent(`show_annotation`, { id = RandomInt(5000, 50000) text = `%s` follow_entindex = entindex1 visibilityBitfield = entindex2 play_sound = `misc/null.wav` show_distance = false show_effect = false lifetime = %f })} EntFireByHandle(hTarget, `Kill`, null, %f, null, null) %s %s", sText, flDuration, flDuration, bVisibleToOthers ? "anno(activator.entindex(), ((1 << 31) - 1) & ~(1 << (index > 30 ? 0 : index)))" : "", bRealClient ? "anno(caller.entindex(), 1 << (index > 30 ? 30 : index))" : "" ), flDelay, hEnt, hAnnotationFollow) } // Last Man Standing / Solo Mode bInWave = false bLastTwo = false bLastMan = false bAboutToBeLastMan = false bSoloMode = false bAboutToBeSoloMode = false hLastRed = null function AliveCountCheck(bTrigger = true) { if(!bInWave || bSoloMode || bAboutToBeSoloMode) return local iAliveReds = 0 local iAliveRedBots = 0 local hRedPlayer for(local i = 1; i <= MAX_CLIENTS; i++) { local hPlayer = PlayerInstanceFromIndex(i) if(hPlayer && hPlayer.GetTeam() == 2 && hPlayer.IsAlive() && !(hPlayer.IsBotOfType(TF_BOT_TYPE) && hPlayer.HasBotTag("bot_ignoreredcount"))) { if(hPlayer.IsBotOfType(TF_BOT_TYPE)) iAliveRedBots++ iAliveReds++ hRedPlayer = hPlayer } } local iRedIcon local iBlankIcon AlternateWaves.IterateIcons(function(iIcon, sNames, sCounts, sFlags) { local sIcon = GetPropStringArray(hObjectiveResource, sNames, iIcon) if(!iRedIcon && sIcon == "red2_lite") iRedIcon = [iIcon, sNames, sFlags] else if(!iBlankIcon && sIcon == "") iBlankIcon = [iIcon, sNames, sFlags] }) if(iAliveRedBots > 0 && iRedIcon == null && iBlankIcon != null) { SetPropStringArray(hObjectiveResource, iBlankIcon[1], "red2_lite", iBlankIcon[0]) SetPropIntArray(hObjectiveResource, iBlankIcon[2], MVM_CLASS_FLAG_NORMAL | MVM_CLASS_FLAG_SUPPORT, iBlankIcon[0]) } else if(iAliveRedBots == 0 && iRedIcon != null) { SetPropStringArray(hObjectiveResource, iRedIcon[1], "", iRedIcon[0]) SetPropIntArray(hObjectiveResource, iRedIcon[2], MVM_CLASS_FLAG_NONE, iRedIcon[0]) } if(iAliveReds == 2 && bTrigger && !bLastTwo) { bLastTwo = true bLastMan = false bAboutToBeLastMan = false } else if(iAliveReds == 1) { bLastTwo = false hLastRed = hRedPlayer if(bTrigger && !bLastMan && !bAboutToBeLastMan) { bAboutToBeLastMan = true SendAnnotationOn(hRedPlayer, "YOU ARE THE LAST...", 8, false, 2.75) EntFire("bignet", "RunScriptCode", "Trespasser.bAboutToBeLastMan = false", 2.75) EntFire("lastman_relay", "Trigger", null, -1) } else if(!bTrigger) { bAboutToBeSoloMode = true SendAnnotationOn(hRedPlayer, "YOU ARE ALONE...", 8, false, 3) } return true } else { EntFire("lastman_relay", "CancelPending") if(bTrigger && bLastMan) EntFire("lastman_relay_disable", "Trigger", null, -1) bLastTwo = false bLastMan = false bAboutToBeLastMan = false return false } } function OnGameEvent_mvm_begin_wave(params) { if(bInWave) return ForceRespawnDeadRed() bInWave = true if(AliveCountCheck(false)) { EntFire("solomode_relay", "Trigger", null, -1, hLastRed) for(local i = 0; i <= 8; i++) { local hWeapon = GetPropEntityArray(hLastRed, "m_hMyWeapons", i) if(!hWeapon) continue local sClassname = hWeapon.GetClassname() local iItemIndex = GetPropInt(hWeapon, "m_AttributeManager.m_Item.m_iItemDefinitionIndex") if(iItemIndex == 129) // buff banner hWeapon.AddAttribute("effect cond override", 34, -1) else if(iItemIndex == 311) // steak hWeapon.AddAttribute("effect cond override", 34 + 41 * 256, -1) else if(iItemIndex == 751) // carbine hWeapon.AddAttribute("effect cond override", 34, -1) else if(startswith(sClassname, "tf_weapon_jar")) // jarate, milk, gas hWeapon.AddAttribute("applies snare effect", 0.65, -1) } } } // player joining function OnGameEvent_player_activate(params) { //GetPlayerWins() local hPlayer = GetPlayerFromUserID(params.userid) if(bMusic) EmitSoundEx({ sound_name = "#trespasser_v2/music_spawnroom.wav" pitch = 85 entity = hPlayer filter_type = RECIPIENT_FILTER_SINGLE_PLAYER }) } // player leaving DisconnectedPlayerClass = {} function OnGameEvent_player_disconnect(params) { local hPlayer = GetPlayerFromUserID(params.userid) if(hPlayer && hPlayer.IsValid()) { DisconnectedPlayerClass[GetPropString(hPlayer, "m_szNetworkIDString")] <- hPlayer.GetPlayerClass() if(hPlayer.IsAlive() && bInWave) { ScreenShake(Vector(), 40, 16, 2, 0, 0, true) local sSound = format("misc/halloween/skeletons/skelly_giant_0%i.wav", RandomInt(1, 3)) PrecacheSound(sSound) EmitSoundEx({ sound_name = sSound pitch = 75 filter_type = RECIPIENT_FILTER_GLOBAL special_dsp = 20 }) local vecOrigin = hPlayer.GetOrigin() hPlayer.EmitSound("Zombie.Break") DispatchParticleEffect("env_sawblood", vecOrigin, Vector(1)) DispatchParticleEffect("env_sawblood", hPlayer.GetCenter(), Vector(1)) DispatchParticleEffect("env_sawblood", hPlayer.EyePosition(), Vector(1)) local hSkeleton = SpawnEntityFromTable("tf_zombie", { origin = vecOrigin, angles = hPlayer.GetAbsAngles(), teamnum = 2 }) hSkeleton.SetSkin(4) hSkeleton.SetMaxHealth(1500) hSkeleton.SetHealth(1500) SendAnnotationOn(hSkeleton, format("%s's remains fight on...", GetPropString(hPlayer, "m_szNetname")), 5, true) } } EntFire("bignet", "RunScriptCode", "Trespasser.AliveCountCheck()", -1) } GivenWeapon = {} // player spawning function OnGameEvent_player_spawn(params) { local hPlayer = GetPlayerFromUserID(params.userid) CleanupPlayer(hPlayer) if(hPlayer && params.team == 2) AliveCountCheck() if(!hPlayer.IsFakeClient()) { if(!(hPlayer.GetEFlags() & EFL_NO_MEGAPHYSCANNON_RAGDOLL)) DispatchParticleEffect(hPlayer.GetPlayerClass() == TF_CLASS_CIVILIAN ? "merasmus_tp" : "teleportedin_red", hPlayer.GetOrigin(), Vector(1)) } if(hPlayer.IsBotOfType(TF_BOT_TYPE) && bSoloMode) EntFireByHandle(hPlayer, "$ChangeAttributes", "Solo", -1, null, null) } // player dying function OnGameEvent_player_death(params) { local hVictim = GetPlayerFromUserID(params.userid) local bBot = hVictim.IsBotOfType(TF_BOT_TYPE) DispatchParticleEffectOn(hVictim, null) hVictim.SetScriptOverlayMaterial(null) if(!bInWave && !hVictim.IsBotOfType(TF_BOT_TYPE)) EntFire("bignet", "RunScriptCode", "if(activator && !activator.IsAlive() && activator.GetTeam() == 2) activator.ForceRespawn()", 2, hVictim) if(hVictim && hVictim.GetTeam() == 2) EntFire("bignet", "RunScriptCode", "Trespasser.AliveCountCheck()", -1) if(bBot) { // delayed to the end of the tick due to a weird issue with explosives local DispatchParticleEffectDelay = @(particle, position, forward) EntFire("bignet", "RunScriptCode", format("DispatchParticleEffect(`%s`, %s, %s)", particle, position, forward), -1, hVictim) if(hVictim.HasBotTag("blood_death")) DispatchParticleEffectDelay("env_sawblood", "activator.GetCenter()", "Vector(1)") if(hVictim.HasBotTag("blood_death_big")) DispatchParticleEffectDelay("tfc_sniper_mist", "activator.GetCenter()", "Vector(1)") if(hVictim.HasBotTag("blood_death_huge")) { local hTempParticle = SpawnEntityFromTable("info_particle_system", { origin = hVictim.GetOrigin() + Vector(0, 0, -256) angles = QAngle(-90, 0, 0) effect_name = "bonzo_vomit2_red" start_active = 1 }) EntFireByHandle(hTempParticle, "Kill", null, 2, null, null) hVictim.EmitSound("vehicles/airboat/pontoon_splash1.wav") } if(hVictim.HasBotTag("blood_death_green")) DispatchParticleEffectDelay("duck_collect_blood_green", "activator.GetCenter()", "Vector(1)") if(hVictim.HasBotTag("explosive_death")) DispatchParticleEffectDelay("rd_robot_explosion_smoke_linger", "activator.GetOrigin()", "Vector(1)") if(hVictim.HasBotTag("explosive_death_sound")) hVictim.EmitSound("Zombie.Boss.Explode") if(hVictim.HasBotTag("metal_death")) DispatchParticleEffectDelay("bot_death", "activator.GetOrigin()", "Vector(1)") } } // make reds scream once theyve reached under a certain amount of health ScreamTimeTable = {} function OnGameEvent_player_hurt(params) { local hPlayer = GetPlayerFromUserID(params.userid) if(hPlayer.GetTeam() == 2) { local flTime = Time() local iHealth = hPlayer.GetHealth() if(iHealth > 0 && iHealth <= 25 && iHealth + params.damageamount > 25 && (!(hPlayer in ScreamTimeTable) || flTime >= ScreamTimeTable[hPlayer])) { ScreamTimeTable[hPlayer] <- flTime + 60 hPlayer.AcceptInput("SpeakResponseConcept", "HalloweenLongFall", null, null) } } } // sets all monoculus rockets to be the same speed function MonoculusScript() { local hMonoculus = self local iEyeRocketModelIndex = PrecacheModel("models/props_halloween/eyeball_projectile.mdl") local flEyeRocketSpeed = 330.0 hMonoculus.GetScriptScope().Think <- function() { for(local hRocket; hRocket = FindByClassname(hRocket, "tf_projectile_rocket");) if(GetPropInt(hRocket, "m_nModelIndex") == iEyeRocketModelIndex) { local vecVelocity = hRocket.GetAbsVelocity() if(vecVelocity.Length() > flEyeRocketSpeed) { vecVelocity.Norm() hRocket.SetAbsVelocity(vecVelocity * flEyeRocketSpeed) } } return -1 } AddThinkToEnt(hMonoculus, "Think") } // converts spies to be perma cloaked at 15% visibility while still being able to attack function SetSpecialCloak() { local hPlayer = self local hItem = hPlayer.GetActiveWeapon() for(local hChild = hPlayer.FirstMoveChild(); hChild; hChild = hChild.NextMovePeer()) if(hChild != hItem && hChild.GetScriptThinkFunc() == "") { hItem = hChild; break } if(!hItem) return hPlayer.AddCond(TF_COND_STEALTHED_USER_BUFF_FADING) hItem.ValidateScriptScope() local hItem_scope = hItem.GetScriptScope() hItem_scope.Think <- function() { if(!self.IsValid()) return if(hPlayer.InCond(TF_COND_STEALTHED)) hPlayer.RemoveCond(TF_COND_STEALTHED) SetPropFloat(hPlayer, "m_Shared.m_flInvisChangeCompleteTime", Time() + 0.15) return -1 } AddThinkToEnt(hItem, "Think") } // works exactly like the hot hand except animations will play properly on other classes function SetZombieSlap() { local hPlayer = self local hMelee for(local i = 0; i <= 8; i++) { local hWeapon = GetPropEntityArray(hPlayer, "m_hMyWeapons", i) if(hWeapon && hWeapon.GetSlot() == 2) { hMelee = hWeapon; break } } if(!hMelee) return hMelee.ValidateScriptScope() local hMelee_scope = hMelee.GetScriptScope() hMelee_scope.flNextPrimaryAttackLast <- GetPropFloat(hMelee, "m_flNextPrimaryAttack") hMelee_scope.flNextPrimaryAttackAgain <- -1 hMelee_scope.Think <- function() { local flNextPrimaryAttack = GetPropFloat(self, "m_flNextPrimaryAttack") if(flNextPrimaryAttack != flNextPrimaryAttackLast) { flNextPrimaryAttackLast = flNextPrimaryAttack if(flNextPrimaryAttackAgain >= 0) flNextPrimaryAttackAgain = -1 else flNextPrimaryAttackAgain = Time() + 0.315 } if(flNextPrimaryAttackAgain >= 0) { local flTime = Time() if(flTime >= flNextPrimaryAttackAgain) { SetPropInt(self, "m_flNextPrimaryAttack", 0) self.PrimaryAttack() } } return -1 } AddThinkToEnt(hMelee, "Think") } function OnGameEvent_player_team(params) { local hPlayer = GetPlayerFromUserID(params.userid) if(params.oldteam == 0) { local sNetworkID = GetPropString(hPlayer, "m_szNetworkIDString") local iPlayerClass = RandomInt(1, 9) if(sNetworkID in DisconnectedPlayerClass && (!bInWave ? DisconnectedPlayerClass[sNetworkID] != TF_CLASS_CIVILIAN : true)) iPlayerClass = DisconnectedPlayerClass[sNetworkID] SetPropInt(hPlayer, "m_Shared.m_iDesiredPlayerClass", iPlayerClass) if(!bInWave) EntFire("bignet", "RunScriptCode", "if(activator && !activator.IsAlive()) activator.ForceRespawn()", 1, hPlayer) } if(params.oldteam == 1 && !bInWave) EntFire("bignet", "RunScriptCode", "if(activator && !activator.IsAlive()) activator.ForceRespawn()", -1, hPlayer) if(params.autoteam == 1 && params.oldteam == 3) { PrecacheSound("vo/eli_lab/eli_handle_b.wav") local SoundTable = { sound_name = "vo/eli_lab/eli_handle_b.wav" entity = hPlayer filter_type = RECIPIENT_FILTER_SINGLE_PLAYER } EmitSoundEx(SoundTable) EmitSoundEx(SoundTable) EmitSoundEx(SoundTable) hPlayer.AcceptInput("$ResetInventory", null, null, null) EntFire("bignet", "RunScriptCode", "activator.SetScriptOverlayMaterial(`effects/tp_eyefx/tp_eyefx_eli`); activator.SetHudHideFlags(-1); activator.ForceChangeTeam(2, true)", -1, hPlayer) EntFire("bignet", "RunScriptCode", "activator.SetScriptOverlayMaterial(null); activator.SetHudHideFlags(0)", 3, hPlayer) } } function Virophage() { local hViro = activator local hBase = self local hHead = FindByName(null, "viro_head") local hParticle = FindByName(null, "virophage_particle") vecOriginLast <- Vector() flTimeUnStuck <- 0 iZeroMovement <- 0 function Think() { local flTime = Time() local bStuck = hViro.GetLocomotionInterface().IsStuck() if(bStuck) { flTimeUnStuck = flTime + 1 hViro.SetModelScale(1, 6) } if(flTime >= flTimeUnStuck) hViro.SetModelScale(2.3, 3) local vecOrigin = hViro.GetOrigin() if((vecOrigin - vecOriginLast).Length() == 0) iZeroMovement++ else iZeroMovement = 0 vecOriginLast = vecOrigin if(iZeroMovement >= 200) { iZeroMovement = 0 Trespasser.UnstuckEntity(hViro) } local flScale = hViro.GetModelScale() / 2.3 if(hBase && hHead && hParticle && hBase.IsValid() && hHead.IsValid() && hParticle.IsValid()) { hBase.SetModelScale(4 * flScale, 0) hBase.SetLocalOrigin(Vector(0, 0, 5) * flScale) hHead.SetModelScale(0.075 * flScale, 0) hHead.SetLocalOrigin(Vector(10, 0, 100) * flScale) hParticle.SetLocalOrigin(Vector(0, 0, 195) * flScale) } return -1 } AddThinkToEnt(self, "Think") } function ForceRespawnDeadRed() { if(bSoloMode) return for(local i = 1; i <= MAX_CLIENTS; i++) { local hPlayer = PlayerInstanceFromIndex(i) if(hPlayer && !hPlayer.IsFakeClient() && !hPlayer.IsAlive() && hPlayer.GetTeam() == 2) hPlayer.ForceRespawn() } } function ForceRespawnDeadRedAsBots() { for(local i = 1; i <= MAX_CLIENTS; i++) { local hPlayer = PlayerInstanceFromIndex(i) if(hPlayer && !hPlayer.IsFakeClient() && !hPlayer.IsAlive() && hPlayer.GetTeam() == 2 && hPlayer.GetPlayerClass() != TF_CLASS_CIVILIAN) { hPlayer.AddEFlags(EFL_NO_MEGAPHYSCANNON_RAGDOLL) hPlayer.ForceRespawn() hPlayer.RemoveEFlags(EFL_NO_MEGAPHYSCANNON_RAGDOLL) local KillList = [] for(local hChild = hPlayer.FirstMoveChild(); hChild; hChild = hChild.NextMovePeer()) if(hChild.GetClassname() == "tf_wearable") KillList.append(hChild) foreach(hWearable in KillList) hWearable.Kill() hPlayer.SetPlayerClass(TF_CLASS_SOLDIER) hPlayer.SetHealth(200) hPlayer.AddCond(TF_COND_REPROGRAMMED) hPlayer.AddCond(TF_COND_TEAM_GLOWS) hPlayer.SetCustomModelWithClassAnimations("models/bots/soldier/bot_soldier_gibby.mdl") hPlayer.SetScriptOverlayMaterial("effects/combine_binocoverlay") hPlayer.AcceptInput("$AddPlayerAttribute", "SET BONUS: special dsp|38", null, null) hPlayer.AcceptInput("$AddPlayerAttribute", "damage penalty|0.5", null, null) //hPlayer.AcceptInput("$AddPlayerAttribute", "no_jump|1", null, null) hPlayer.AcceptInput("$AddPlayerAttribute", "move speed bonus|1", null, null) hPlayer.AcceptInput("$WeaponStripSlot", "0", null, null) hPlayer.AcceptInput("$WeaponStripSlot", "1", null, null) hPlayer.AcceptInput("$WeaponSwitchSlot", "2", null, null) hPlayer.AcceptInput("$WeaponStripSlot", "3", null, null) hPlayer.AcceptInput("$WeaponStripSlot", "4", null, null) hPlayer.AcceptInput("$WeaponStripSlot", "5", null, null) local hWeapon = hPlayer.GetActiveWeapon() if(hWeapon) { local sWeaponClassname = hWeapon.GetClassname() if ( sWeaponClassname == "tf_weapon_robot_arm" || sWeaponClassname == "tf_weapon_fists" || sWeaponClassname == "tf_weapon_knife" || sWeaponClassname == "tf_weapon_sword" ) { hPlayer.AcceptInput("$WeaponStripSlot", "2", null, null) hPlayer.AcceptInput("$GiveItem", "Upgradeable TF_WEAPON_SHOVEL", null, null) hPlayer.AcceptInput("$WeaponSwitchSlot", "2", null, null) } } hPlayer.AcceptInput("$AddItemAttribute", "custom view model|models/mvm/weapons/c_models/c_soldier_bot_arms.mdl|2", null, null) hPlayer.SetAbsOrigin(Vector(-1767, 165, 60)) hPlayer.SnapEyeAngles(QAngle()) } } } function GetAllPlayersOfType(iTeamNums = null, bAlive = null, bBot = null) { local Players = [] local bCheckTeamNum = iTeamNums != null local bCheckAlive = bAlive != null local bCheckBot = bBot != null for(local i = 1; i <= MAX_CLIENTS; i++) { local hPlayer = PlayerInstanceFromIndex(i) if(hPlayer && (bCheckTeamNum ? iTeamNums.find(hPlayer.GetTeam()) != null : true) && (bCheckAlive ? hPlayer.IsAlive() == bAlive : true) && (bCheckBot ? hPlayer.IsBotOfType(TF_BOT_TYPE) == bBot : true)) Players.append(hPlayer) } return Players } function GetRandomPlayer(iTeamNums = null, bAlive = null, bBot = null) { local Players = GetAllPlayersOfType(iTeamNums, bAlive, bBot) local ArrayLength = Players.len() if(ArrayLength > 0) return Players[RandomInt(0, ArrayLength - 1)] else return null } SelectedFromShuffle = [] function GetRandomPlayerShuffle(iTeamNums = null, bAlive = null, bBot = null) { local Players = GetAllPlayersOfType(iTeamNums, bAlive, bBot) local Delete = [] foreach(hPlayer in SelectedFromShuffle) { local Index = Players.find(hPlayer) if(Index != null) Players.remove(Index) } local ArrayLength = Players.len() if(ArrayLength > 0) { local hSelectedPlayer = Players[RandomInt(0, ArrayLength - 1)] SelectedFromShuffle.append(hSelectedPlayer) return hSelectedPlayer } else if(SelectedFromShuffle.len() == 0) return null else { SelectedFromShuffle.clear() return GetRandomPlayerShuffle(iTeamNums, bAlive, bBot) } } function ShakeIt() { ScreenShake(Vector(), 16, 40, 1, 0, 0, true) ScreenShake(Vector(), 16, 40, 1, 0, 0, true) ScreenShake(Vector(), 16, 40, 2, 0, 0, true) } function SetDoppelganger(hBot, hPlayer) { if(!hPlayer && hBot) { hBot.TakeDamage(hBot.GetHealth() + 10, DMG_ALWAYSGIB, hBot); return } else if(!hBot) return local iClass = hPlayer.GetPlayerClass() local sClassIcon = GetPropString(hBot, "m_PlayerClass.m_iszClassIcon") local bGiant = hBot.IsMiniBoss() local bHealthBar = GetPropBool(hBot, "m_bUseBossHealthBar") local vecOrigin = hBot.GetOrigin() local angRotation = hBot.EyeAngles() SetPropInt(hBot, "m_Shared.m_iDesiredPlayerClass", iClass) hBot.SetPlayerClass(iClass) hBot.DispatchSpawn() local OldItems = [] for(local hChild = hBot.FirstMoveChild(); hChild; hChild = hChild.NextMovePeer()) if(HasProp(hChild, "m_AttributeManager") && hChild.GetClassname() != "tf_wearable") OldItems.append(hChild) foreach(hItem in OldItems) hItem.Kill() hBot.SetAbsOrigin(vecOrigin) hBot.SnapEyeAngles(angRotation) SetPropString(hBot, "m_PlayerClass.m_iszClassIcon", sClassIcon) hBot.SetIsMiniBoss(bGiant) hBot.SetUseBossHealthBar(bHealthBar) if(bSoloMode) hBot.SetDifficulty(EASY) SetFakeClientConVarValue(hBot, "name", GetPropString(hPlayer, "m_szNetname") + "็") hBot.SetHealth(hBot.GetMaxHealth()) hBot.SetCustomModelWithClassAnimations(hPlayer.GetModelName()) local hWeapon = hPlayer.GetActiveWeapon() if(!hWeapon) return local iCurrentSlot = hWeapon.GetSlot() local CopyAttributes = [ "always crit" "blast radius increased" "minicrits become crits" "mod_maxhealth_drain_rate" "mult bleeding delay" "mult bleeding dmg" "mult crit dmg" "mult_player_movespeed_active" "speed_boost_on_hit" "stickybomb charge rate" "unique craft index" "airblast pushback scale" "ammo regen" "applies snare effect" "armor piercing" "attack projectiles" "bidirectional teleport" "bleeding duration" "building instant upgrade" "canteen specialist" "charge recharge rate increased" "clip size bonus upgrade" "clip size upgrade atomic" "critboost on kill" "damage bonus" "damage force reduction" "dmg taken from blast reduced" "dmg taken from bullets reduced" "dmg taken from crit reduced" "dmg taken from fire reduced" "effect bar recharge rate increased" "engy building health bonus" "engy dispenser radius increased" "engy disposable sentries" "engy sentry fire rate increased" "explode_on_ignite" "explosive sniper shot" "falling_impact_radius_stun" "faster reload rate" "fire rate bonus" "fire rate bonus" "generate rage on damage" "generate rage on heal" "heal on kill" "healing mastery" "health regen" "increase buff duration" "mad milk syringes" "mark for death" "max health additive bonus" "maxammo grenades1 increased" "maxammo metal increased" "maxammo primary increased" "maxammo secondary increased" "melee attack rate bonus" "move speed bonus" "mult_item_meter_charge_rate" "overheal expert" "projectile penetration heavy" "projectile penetration" "projectile speed increased" "robo sapper" "rocket specialist" "SRifle Charge rate increased" "thermal_thruster_air_launch" "uber duration bonus" "ubercharge rate bonus" "weapon burn dmg increased" "weapon burn time increased" "attach particle effect static" "attach particle effect" "custom_paintkit_seed_hi" "custom_paintkit_seed_lo" "is australium item" "item style override" "killstreak effect" "killstreak idleeffect" "killstreak tier" "paintkit_proto_def_index" "set item tint RGB 2" "set item tint RGB" "set_item_texture_wear" "style changes on strange level" ] local GiveItem = function(hPlayer, sClassname, iItemIndex) { local bWearable = !startswith(sClassname, "tf_weapon") local iItemIndexReal = iItemIndex local sClassnameReal = sClassname if(bWearable) { iItemIndex = 1101 sClassname = "tf_weapon_parachute" } local hItem = CreateByClassname(sClassname) SetPropInt(hItem, "m_AttributeManager.m_Item.m_iItemDefinitionIndex", iItemIndex) SetPropBool(hItem, "m_AttributeManager.m_Item.m_bInitialized", true) SetPropBool(hItem, "m_bValidatedAttachedEntity", true) hItem.SetTeam(hPlayer.GetTeam()) hItem.DispatchSpawn() if(bWearable) { hPlayer.Weapon_Equip(hItem) local hWearable = GetPropEntity(hItem, "m_hExtraWearable") hItem.Kill() SetPropString(hWearable, "m_iClassname", sClassnameReal) SetPropInt(hWearable, "m_nModelIndex", 0) SetPropInt(hWearable, "m_AttributeManager.m_Item.m_iItemDefinitionIndex", iItemIndexReal) SetPropBool(hWearable, "m_AttributeManager.m_Item.m_bInitialized", true) hWearable.DispatchSpawn() SetPropBool(hWearable, "m_bForcePurgeFixedupStrings", true) hWearable.ValidateScriptScope() hWearable.GetScriptScope().Think <- function() { if("Shield" in this) Shield() if(!hPlayer.IsAlive()) { SetPropString(self, "m_iszScriptThinkFunction", "") EntFireByHandle(self, "RunScriptCode", "self.Kill()", 0.033, null, null) } return -1 } if(sClassnameReal == "tf_wearable_demoshield") { hWearable.AddAttribute("Attack not cancel charge", 1, -1) hWearable.GetScriptScope().Shield <- function() { if(GetPropInt(hPlayer, "m_nButtons") & IN_ATTACK && GetPropFloat(hPlayer, "m_Shared.m_flChargeMeter") >= 100) hPlayer.AddCond(TF_COND_SHIELD_CHARGE) } } AddThinkToEnt(hWearable, "Think") hItem = hWearable } else { hPlayer.Weapon_Equip(hItem) } return hItem } local WeaponBlacklist = [ "tf_weapon_builder" "tf_weapon_sapper" "tf_weapon_pda_engineer_build" "tf_weapon_pda_engineer_destroy" "tf_weapon_jar_milk" "tf_weapon_lunchbox" "tf_weapon_lunchbox_drink" "tf_weapon_buff_item" "tf_weapon_rocketpack" 265 ] local hPlayerManager = FindByClassname(null, "tf_player_manager") local iUserID = GetPropIntArray(hPlayerManager, "m_iUserID", hBot.entindex()) for(local hChild = hPlayer.FirstMoveChild(); hChild; hChild = hChild.NextMovePeer()) if(HasProp(hChild, "m_AttributeManager")) { local iWeaponSlot = "GetSlot" in hChild ? hChild.GetSlot() : -1 local sClassname = hChild.GetClassname() local iItemIndex = GetPropInt(hChild, "m_AttributeManager.m_Item.m_iItemDefinitionIndex") if(WeaponBlacklist.find(sClassname) != null || WeaponBlacklist.find(iItemIndex) != null) continue if(sClassname == "tf_weapon_laser_pointer" && iItemIndex == 0) continue local hItem local flAttribute = hChild.GetAttribute("is commodity", 0) if(flAttribute < 0) continue local bIsCustomWeapon = flAttribute != 0 // we applied this to all custom weapons, no real way to check for a custom weapon without it if(bIsCustomWeapon) { hChild.KeyValueFromString("targetname", "whatisyouritemname") local hLua = CreateByClassname("$script_manager") hLua.AcceptInput("$ExecuteScript", format("ents.GetPlayerByUserId(%i):GiveItem(ents.FindByName('whatisyouritemname'):GetItemName()):SetName('heresdoppelsweaponcopy')", iUserID), null, null) hLua.Kill() hChild.KeyValueFromString("targetname", "") hItem = FindByName(null, "heresdoppelsweaponcopy") hItem.KeyValueFromString("targetname", "") } else { hItem = GiveItem(hBot, sClassname, iItemIndex) hItem.EnableDraw() } if(iWeaponSlot != -1 && hItem.GetSlot() == iCurrentSlot) { hBot.Weapon_Switch(hItem) hBot.AddCustomAttribute("disable weapon switch", 1, -1) } foreach(sAttr in CopyAttributes) { local Attr = hChild.GetAttribute(sAttr, 1337) if(Attr != 1337) hItem.AddAttribute(sAttr, Attr, -1) } if(sClassname == "tf_weapon_cannon") hItem.AddAttribute("grenade launcher mortar mode", 0, -1) if(sClassname == "tf_weapon_medigun" && iClass == TF_CLASS_CIVILIAN) hItem.AcceptInput("SetBodyGroup", "1", null, null) } foreach(sAttr in CopyAttributes) { local Attr = hPlayer.GetCustomAttribute(sAttr, 1337) if(Attr != 1337) hBot.AddCustomAttribute(sAttr, Attr, -1) } local ZombieCosmetics = [ 5617 5617 5625 5618 5620 5622 5619 5624 5623 5621 5621 ] local hZombie = GiveItem(hBot, "tf_wearable", ZombieCosmetics[iClass]) hZombie.GetScriptScope().CopyThink <- function() { if(!hPlayer || !hPlayer.IsValid() || !hPlayer.IsAlive()) return local hWeapon = hBot.GetActiveWeapon() local hPlayerWeapon = hPlayer.GetActiveWeapon() if(hWeapon && hPlayerWeapon) { local iSlot = hWeapon.GetSlot() local iPlayerSlot = hPlayerWeapon.GetSlot() if(iSlot != iPlayerSlot) { hBot.RemoveCustomAttribute("disable weapon switch") hBot.AcceptInput("$WeaponSwitchSlot", iPlayerSlot.tostring(), null, null) hBot.AddCustomAttribute("disable weapon switch", 1, -1) } } if(!Trespasser.bSoloMode) { local iPlayerCond = GetPropInt(hPlayer, "m_Shared.m_nPlayerCond") local iPlayerCondEx = GetPropInt(hPlayer, "m_Shared.m_nPlayerCondEx") local iPlayerCondEx2 = GetPropInt(hPlayer, "m_Shared.m_nPlayerCondEx2") local iPlayerCondEx3 = GetPropInt(hPlayer, "m_Shared.m_nPlayerCondEx3") local iPlayerCondEx4 = GetPropInt(hPlayer, "m_Shared.m_nPlayerCondEx4") for(local i = 0; i <= 31; i++) { local iBit = 1 << i if(iPlayerCond & iBit && i != 7) hBot.AddCondEx(i, 0.03, null) if(iPlayerCondEx & iBit) hBot.AddCondEx(i + 32, 0.03, null) if(iPlayerCondEx2 & iBit) hBot.AddCondEx(i + 64, 0.03, null) if(iPlayerCondEx3 & iBit) hBot.AddCondEx(i + 96, 0.03, null) if(iPlayerCondEx4 & iBit) hBot.AddCondEx(i + 128, 0.03, null) } } } if(iClass == TF_CLASS_CIVILIAN) { hZombie.AddAttribute("never gib", 1, -1) SetPropBool(hBot, "m_bForcedSkin", true) hZombie.DisableDraw() hZombie.GetScriptScope().Think <- function() { CopyThink() SetPropInt(hBot, "m_nForcedSkin", 3) if(!hBot.IsAlive()) { SetPropString(self, "m_iszScriptThinkFunction", "") SetPropBool(hBot, "m_bForcedSkin", false) SetPropInt(hBot, "m_nForcedSkin", 0) EntFireByHandle(self, "RunScriptCode", "self.Kill()", 0.033, null, null) } return -1 } } else { SetPropInt(hBot, "m_iPlayerSkinOverride", 1) hZombie.GetScriptScope().Think <- function() { CopyThink() if(!hBot.IsAlive()) { SetPropString(self, "m_iszScriptThinkFunction", "") SetPropInt(hBot, "m_iPlayerSkinOverride", 0) EntFireByHandle(self, "RunScriptCode", "self.Kill()", 0.033, null, null) } return -1 } } SendGlobalGameEvent("post_inventory_application", { userid = iUserID }) } function TeleportWithinCircle(hEnt, vecOrigin, flRadius) { local vecForward = QAngle(0, RandomFloat(0, 360), 0).Forward() * RandomFloat(0, flRadius) hEnt.SetAbsOrigin(vecOrigin + vecForward) } HalloweenBossIcon = ["special_blimp", 404, MVM_CLASS_FLAG_MINIBOSS] function SetWavebar(iWave) { EntFire("tf_objective_resource", "$SetClientProp$m_nMannVsMachineWaveCount", iWave.tostring(), -1) EntFire("tf_objective_resource", "$SetClientProp$m_nMannVsMachineMaxWaveCount", "7", -1) AlternateWaves.ClearWaveIcons() switch(iWave) { case 1: AlternateWaves.AddWaveIcons([ [ "heavy_zombie_arm1_lite", 2, MVM_CLASS_FLAG_MINIBOSS ], [ "heavy_zombie_lite", 200, MVM_CLASS_FLAG_MINIBOSS ], [ "heavy_zombie_arm2_lite", 1, MVM_CLASS_FLAG_MINIBOSS | MVM_CLASS_FLAG_ALWAYSCRIT ] ]) break case 2: AlternateWaves.AddWaveIcons([ [ "heavy_zombie_arm2_lite", 3, MVM_CLASS_FLAG_MINIBOSS ], [ "heavy_zombie_lite", 18, MVM_CLASS_FLAG_NORMAL ], [ "spy_facepeel_lite", 6, MVM_CLASS_FLAG_MINIBOSS ], [ "pyro_scout_fireaxe_bat", 75, MVM_CLASS_FLAG_NORMAL ], [ "dead_multi_lite", 50, MVM_CLASS_FLAG_NORMAL ] ]) break case 3: AlternateWaves.AddWaveIcons([ [ "heavy_zombie_arm2_lite", 1, MVM_CLASS_FLAG_MINIBOSS ], [ "spy_facepeel_lite", 1, MVM_CLASS_FLAG_MINIBOSS ], [ "dead_multi_lite", 50, MVM_CLASS_FLAG_NORMAL ], [ "pyro_scout_fireaxe_bat", 25, MVM_CLASS_FLAG_NORMAL ], HalloweenBossIcon, [ "dead_flame_lite", 68, MVM_CLASS_FLAG_NORMAL ], [ "heavy_zombie_lite", 82, MVM_CLASS_FLAG_NORMAL ] ]) break case 4: AlternateWaves.AddWaveIcons([ [ "pyro_membrain_lite", 125, MVM_CLASS_FLAG_NORMAL ], [ "heavy_zombie_arm2_lite", 4, MVM_CLASS_FLAG_MINIBOSS ], [ "dead_flame_lite", 12, MVM_CLASS_FLAG_NORMAL ], [ "random_lite", 1, MVM_CLASS_FLAG_MINIBOSS ] ]) break case 5: AlternateWaves.AddWaveIcons([ [ "soldier_gib_lite", 100, MVM_CLASS_FLAG_NORMAL ], [ "soldier", 8, MVM_CLASS_FLAG_MINIBOSS ], [ "shotgun_lite", 25, MVM_CLASS_FLAG_NORMAL ], [ "medic_uber", 35, MVM_CLASS_FLAG_NORMAL ], [ "heavy_steelfist_nys", 16, MVM_CLASS_FLAG_NORMAL ], [ "soldier_burstfire", 2, MVM_CLASS_FLAG_MINIBOSS | MVM_CLASS_FLAG_ALWAYSCRIT ], [ "scout_bombrunner", 100, MVM_CLASS_FLAG_NORMAL ], bSoloMode ? [ "tank_black", 1, MVM_CLASS_FLAG_MINIBOSS] : ["tank_combat_minigun", 1, MVM_CLASS_FLAG_MINIBOSS ] ]) break case 6: AlternateWaves.AddWaveIcons([ [ "heavy_zombie_arm2_lite", 1, MVM_CLASS_FLAG_MINIBOSS ], [ "pyro_scout_fireaxe_bat", 50, MVM_CLASS_FLAG_NORMAL | MVM_CLASS_FLAG_ALWAYSCRIT ], [ "dead_multi_lite", 50, MVM_CLASS_FLAG_NORMAL | MVM_CLASS_FLAG_ALWAYSCRIT ], [ "heavy_chainsaw", 50, MVM_CLASS_FLAG_NORMAL ], [ "dead_flame_lite", 20, MVM_CLASS_FLAG_NORMAL | MVM_CLASS_FLAG_ALWAYSCRIT ], [ "shotgun_lite", 25, MVM_CLASS_FLAG_NORMAL ], [ "spy_facepeel_lite", 3, MVM_CLASS_FLAG_MINIBOSS ], [ "heavy_steelfist_cash", 9, MVM_CLASS_FLAG_NORMAL ], [ "sentry_gun", 0, MVM_CLASS_FLAG_NORMAL | MVM_CLASS_FLAG_SUPPORT ] ]) break case 7: AlternateWaves.AddWaveIcons([ [ "heavy_zombie_breach_lite", 0, MVM_CLASS_FLAG_NORMAL | MVM_CLASS_FLAG_SUPPORT ], [ "soldier_spammer", 4, MVM_CLASS_FLAG_MINIBOSS ], [ "dead2_ylw_lite", 0, MVM_CLASS_FLAG_NORMAL | MVM_CLASS_FLAG_SUPPORT ], [ "bot_norm_lite", 1, MVM_CLASS_FLAG_MINIBOSS ], [ "osprey", 0, MVM_CLASS_FLAG_NORMAL | MVM_CLASS_FLAG_SUPPORT ] ]) break default: AlternateWaves.AddWaveIcons([ [ "heavy_zombie_lite", 300, MVM_CLASS_FLAG_NORMAL ], [ "heavy_zombie_arm2_lite", 12, MVM_CLASS_FLAG_MINIBOSS ], [ "spy_facepeel_lite", 10, MVM_CLASS_FLAG_MINIBOSS ], [ "pyro_scout_fireaxe_bat", 150, MVM_CLASS_FLAG_NORMAL ], [ "dead_multi_lite", 150, MVM_CLASS_FLAG_NORMAL ], HalloweenBossIcon, [ "dead_flame_lite", 100, MVM_CLASS_FLAG_NORMAL ], [ "pyro_membrain_lite", 125, MVM_CLASS_FLAG_NORMAL ], [ "heavy_chainsaw", 50, MVM_CLASS_FLAG_NORMAL ], [ "random_lite", 1, MVM_CLASS_FLAG_MINIBOSS ], [ "soldier_gib_lite", 100, MVM_CLASS_FLAG_NORMAL ], [ "soldier", 8, MVM_CLASS_FLAG_MINIBOSS ], [ "shotgun_lite", 50, MVM_CLASS_FLAG_NORMAL ], [ "medic_uber", 35, MVM_CLASS_FLAG_NORMAL ], [ "heavy_steelfist_nys", 25, MVM_CLASS_FLAG_NORMAL ], [ "soldier_burstfire", 2, MVM_CLASS_FLAG_MINIBOSS | MVM_CLASS_FLAG_ALWAYSCRIT ], [ "scout_bombrunner", 100, MVM_CLASS_FLAG_NORMAL ], [ "soldier_spammer", 4, MVM_CLASS_FLAG_MINIBOSS ], [ "heavy_zombie_breach_lite", 0, MVM_CLASS_FLAG_NORMAL | MVM_CLASS_FLAG_SUPPORT ], [ "tank_combat_minigun", 1, MVM_CLASS_FLAG_MINIBOSS ], [ "dead2_ylw_lite", 0, MVM_CLASS_FLAG_NORMAL | MVM_CLASS_FLAG_SUPPORT ], [ "bot_norm_lite", 1, MVM_CLASS_FLAG_MINIBOSS ] ]) break } EntFire("bignet", "RunScriptCode", "Trespasser.AliveCountCheck()", 0.033) } function Emissary() { local hPlayer = self local hWearable for(local hChild = hPlayer.FirstMoveChild(); hChild; hChild = hChild.NextMovePeer()) if(hChild.GetClassname() == "tf_wearable") { hWearable = hChild; break } if(!hWearable) return hWearable.ValidateScriptScope() local hWearable_scope = hWearable.GetScriptScope() hWearable_scope.bTaunting <- false hWearable_scope.hIndicator <- null hWearable_scope.hPlatform <- null hWearable_scope.hPlatformFake <- null hWearable_scope.Cleanup <- function() { if(hIndicator && hIndicator.IsValid()) hIndicator.Kill() if(hPlatform && hPlatform.IsValid()) { local vecOrigin = hPlatform.GetOrigin() PrecacheSound("physics/metal/metal_grate_impact_hard3.wav") EmitSoundEx({ sound_name = "physics/metal/metal_grate_impact_hard3.wav", sound_level = 90, origin = vecOrigin, filter_type = RECIPIENT_FILTER_GLOBAL }) Trespasser.ShakeIt() if(hPlatformFake && hPlatformFake.IsValid()) DispatchParticleEffect("merasmus_object_spawn", hPlatformFake.GetOrigin() + hPlatformFake.GetRightVector() * -60, Vector(1)) hPlatform.Kill() } if(hPlatformFake && hPlatformFake.IsValid()) hPlatformFake.Kill() } hWearable_scope.Think <- function() { local bTauntCond = hPlayer.InCond(TF_COND_TAUNTING) if(bTauntCond && !bTaunting) { bTaunting = true if(hIndicator && hIndicator.IsValid()) hIndicator.Kill() hIndicator = CreateByClassname("prop_dynamic") hIndicator.SetModelSimple("models/props_mvm/indicator/indicator_circle_long.mdl") hIndicator.SetModelScale(0.5, 0) hIndicator.KeyValueFromInt("disableshadows", 1) hIndicator.SetSkin(1) hIndicator.DispatchSpawn() hIndicator.AcceptInput("SetAnimation", "start", null, null) } else if(!bTauntCond && bTaunting) { bTaunting = false Cleanup() } if(hIndicator && hIndicator.IsValid()) { local vecOrigin = hPlayer.GetOrigin() local vecForward = hPlayer.GetForwardVector() local vecDestination = vecOrigin + vecForward * 142 local bPlatform = hPlatform && hPlatform.IsValid() if(!bPlatform) { local Trace = { start = vecDestination + Vector(0, 0, 96) end = vecDestination + Vector(0, 0, -96) hullmin = Vector(-24, -24, 0) hullmax = Vector(24, 24, 0) mask = MASK_PLAYERSOLID } TraceHull(Trace) if("enthit" in Trace && Trace.enthit.IsPlayer()) { Trace.ignore <- Trace.enthit TraceHull(Trace) } if((vecDestination - Trace.endpos).Length() >= 4) { local vecRight = hPlayer.GetRightVector() local iDestZ = ceil(vecDestination.z < Trace.endpos.z ? Trace.endpos.z + 6 : vecOrigin.z + 6) local vecAbove = vecOrigin vecAbove.z = iDestZ hPlayer.SetAbsOrigin(vecAbove) local vecPlatform = vecAbove + vecForward * 80 + vecRight * 32 + Vector(0, 0, -9) hPlatform = SpawnEntityFromTable("prop_dynamic", { origin = vecPlatform angles = QAngle(0, 270 + hPlayer.GetAbsAngles().y, 90) model = "models/props_coalmines/wood_fence_128.mdl" solid = 6 disableshadows = 1 rendermode = 1 renderamt = 0 OnTakeDamage = "!selfRunScriptCodeif(!activator.IsPlayer())return;local w=activator.GetActiveWeapon();if(w&&w.GetSlot()==2)activator.ApplyAbsVelocityImpulse(Vector(0,0,300))-1-1" }) hPlatformFake = SpawnEntityFromTable("prop_dynamic", { origin = vecAbove + vecForward * 81 + vecRight * -60 + Vector(0, 0, -6) angles = QAngle(90, 180 + hPlayer.GetAbsAngles().y, 0) model = "models/props_vehicles/train_flatcar_container_doorl.mdl" disableshadows = 1 modelscale = 1.95 }) PrecacheSound("physics/metal/metal_grate_impact_hard2.wav") EmitSoundEx({ sound_name = "physics/metal/metal_grate_impact_hard2.wav", sound_level = 90, entity = hPlatform, filter_type = RECIPIENT_FILTER_GLOBAL }) Trespasser.ShakeIt() DispatchParticleEffect("merasmus_object_spawn", vecAbove + vecForward * 80 + Vector(0, 0, -6), Vector(1)) for(local hPlayer; hPlayer = FindByClassnameWithin(hPlayer, "player", vecAbove, 512);) { if(!hPlayer.IsAlive()) continue if(!Trespasser.UnstuckEntity(hPlayer)) { local vecPlayerOrigin = hPlayer.GetOrigin() hPlayer.SetAbsOrigin(Vector(vecPlayerOrigin.x, vecPlayerOrigin.y, iDestZ + 8)) } } } } local bOnIndicator = false for(local hPlayer; hPlayer = FindByClassnameWithin(hPlayer, "player", vecDestination, 4);) if(hPlayer.IsAlive()) { bOnIndicator = true; break } hIndicator.SetSkin(bOnIndicator ? 3 : 1) hIndicator.SetOrigin(vecDestination + Vector(0, 0, 6)) } return -1 } AddThinkToEnt(hWearable, "Think") Trespasser.SetDestroyCallback(hWearable, hWearable_scope.Cleanup) } // a think ent for per tick checks hITLast = null bMalletHHH = false hThinkEnt = SpawnEntityFromTable("logic_relay", {}) flTimeNext_Slow = 0 function ThinkEntThink() { local flTime = Time() // player checks for(local i = 1; i <= MAX_PLAYERS; i++) { local hPlayer = PlayerInstanceFromIndex(i) if(!hPlayer) continue local iTeamNum = hPlayer.GetTeam() local bBot = hPlayer.IsBotOfType(TF_BOT_TYPE) local bFakeClient = hPlayer.IsFakeClient() local bAlive = hPlayer.IsAlive() if(iTeamNum == 2) // reds { if(bAlive) // alive { // dirt slow if(!bSoloMode) { local vecOrigin = hPlayer.GetOrigin() local vecMins = hPlayer.GetPlayerMins() local vecMaxs = hPlayer.GetPlayerMaxs() if(!IntersectionBoxBox(vecOrigin, vecMins, vecMaxs, Vector(0, 1092, 288), Vector(-696, -828, -352), Vector(696, 828, 352))) { local Trace = { start = vecOrigin end = vecOrigin + Vector(0, 0, -128) hullmin = vecMins hullmax = Vector(vecMaxs.x, vecMaxs.y, vecMins.z) mask = MASK_PLAYERSOLID ignore = hPlayer } TraceHull(Trace) if(Trace.surface_props == 9) hPlayer.StunPlayer(0.2, 0.85, TF_STUN_MOVEMENT, null) } } // last man/solo mode red changes if(!bBot) { local iClass = hPlayer.GetPlayerClass() local hWeapon = hPlayer.GetActiveWeapon() local iItemIndex = hWeapon ? GetPropInt(hWeapon, "m_AttributeManager.m_Item.m_iItemDefinitionIndex") : -1 //dont count med/eng/spy ""primaries"" local bPrimary = hWeapon && hWeapon.GetSlot() == 0 && iClass != TF_CLASS_ENGINEER && iClass != TF_CLASS_MEDIC && iClass != TF_CLASS_SPY local bMiniCrit = iItemIndex == 656 // Holiday Punch if(bLastTwo || bAboutToBeLastMan) { if(!bPrimary) hPlayer.AddCondEx(TF_COND_OFFENSEBUFF, 0.2, null) } else if(bLastMan) { if(!bPrimary) hPlayer.AddCondEx(!bMiniCrit ? TF_COND_CRITBOOSTED_USER_BUFF : TF_COND_OFFENSEBUFF, 0.2, null) hPlayer.AddCondEx(TF_COND_GRAPPLINGHOOK_BLEEDING, 0.2, null) hPlayer.AddCustomAttribute("no_jump", 1, 0.2) hPlayer.AddCustomAttribute("no_duck", 1, 0.2) } else if(bSoloMode) { if(!bPrimary) hPlayer.AddCondEx(TF_COND_OFFENSEBUFF, 0.2, null) hPlayer.AddCustomAttribute("projectile penetration", 1, 0.2) hPlayer.AddCustomAttribute("melee cleave attack", 1, 0.2) EntFire("bignet", "RunScriptCode", "activator.AddCustomAttribute(`engy sentry fire rate increased`, 1, 0.2)", -1, hPlayer) } if((bLastTwo || bLastMan || bSoloMode) && hPlayer.InCond(TF_COND_OFFENSEBUFF)) hPlayer.AcceptInput("DispatchEffect", "ParticleEffectStop", null, null) } } else // dead { if(bSoloMode && hPlayer != hLastRed) ClientPrint(hPlayer, 4, "Singleplayer Mode in progress...\n Please wait...") } } else // blues/grays { if(bLastMan && !(bBot && hPlayer.HasBotTag("bot_nolastmanspeed"))) hPlayer.AddCondEx(TF_COND_SPEED_BOOST, 0.2, null) if(bFakeClient && !bAlive) SetPropEntity(hPlayer, "m_hObserverTarget", null) } } if((bLastMan || bSoloMode) && hLastRed && hLastRed.IsValid() && hLastRed.InCond(TF_COND_REPROGRAMMED)) { hLastRed = null EntFire("bots_win", "RoundWin") EntFire("transform_relay", "CancelPending") } // dont allow players to build through prop_dynamics for(local hBuilding; hBuilding = FindByClassname(hBuilding, "obj_*");) { if(GetPropBool(hBuilding, "m_bPlacing")) { local hPlayer = GetPropEntity(hBuilding, "m_hBuilder") if(!hPlayer) continue local vecPlayer = hPlayer.GetCenter() local Trace = { start = vecPlayer + QAngle(0, hPlayer.EyeAngles().y, 0).Forward() * 72 + Vector(0, 0, 33) end = vecPlayer ignore = hPlayer mask = MASK_PLAYERSOLID } TraceLineEx(Trace) if("enthit" in Trace && Trace.enthit.GetClassname() == "prop_dynamic") SetPropFloat(hPlayer.GetActiveWeapon(), "m_flNextPrimaryAttack", Time() + 0.1) } } // make proxy mines stick to the ground for(local hMine; hMine = FindByClassname(hMine, "tf_projectile_pipe");) { if(GetPropInt(hMine, "m_nModelIndex") == iProxyMineModelIndex) { local vecOrigin = hMine.GetOrigin() local Trace = { start = vecOrigin end = vecOrigin + Vector(0, 0, -8) mask = MASK_SHOT ignore = hMine } TraceLineEx(Trace) if("enthit" in Trace && (Trace.enthit.GetClassname() == "worldspawn" || Trace.enthit.GetClassname() == "prop_dynamic")) { if(hMine.GetSkin() == 1) EntFireByHandle(hMine, "RunScriptCode", "SetPropBool(self, `m_bTouched`, false)", -1, null, null) hMine.SetForwardVector(Vector(1)) hMine.SetPhysVelocity(Vector()) hMine.SetPhysAngularVelocity(Vector()) } else SetPropBool(hMine, "m_bTouched", true) } } // tf_zombie is yellow now for(local hSkeleton; hSkeleton = FindByClassname(hSkeleton, "tf_zombie");) { local iTeamNum = hSkeleton.GetTeam() if(iTeamNum != TF_TEAM_RED) hSkeleton.SetSkin(3) } // really need mallet hhh to not crash local iScenario = GetPropInt(hGameRules, "m_halloweenScenario") if(!bMalletHHH && iScenario == 5) bMalletHHH = true if(bMalletHHH && !bHHHAttackedThisTick && FindByClassname(null, "headless_hatman") != null) { local hIT = GetPropEntity(hGameRules, "m_itHandle") if(!hIT && iScenario == 5) SetPropInt(hGameRules, "m_halloweenScenario", 0) else if(hIT && iScenario == 0) SetPropInt(hGameRules, "m_halloweenScenario", 5) if(hIT != hITLast) { if(hIT) { ClientPrint(hIT, HUD_PRINTTALK, "#TF_HALLOWEEN_BOSS_WARN_VICTIM") ClientPrint(hIT, HUD_PRINTCENTER, "#TF_HALLOWEEN_BOSS_WARN_VICTIM") EmitSoundOnClient("Player.YouAreIT", hIT) hIT.EmitSound("Halloween.PlayerScream") } if(hITLast && hITLast.IsAlive()) { ClientPrint(hITLast, HUD_PRINTTALK, "#TF_HALLOWEEN_BOSS_LOST_AGGRO") ClientPrint(hITLast, HUD_PRINTCENTER, "#TF_HALLOWEEN_BOSS_LOST_AGGRO") EmitSoundOnClient("Player.TaggedOtherIT", hITLast) } } hITLast = hIT } // nav blockers if(flTime >= flTimeNext_Slow) { flTimeNext_Slow = flTime + 0.25 local NavAreas = {} local hNavArea // broken stairs near red spawn NavAreas.clear() NavMesh.GetNavAreasInRadius(Vector(448, 1264, 192), 20, NavAreas) foreach(sName, hNav in NavAreas) bBlockerStairs ? hNav.SetAttributeTF(TF_NAV_BLOCKED) : hNav.ClearAttributeTF(TF_NAV_BLOCKED) // right side barricade hNavArea = NavMesh.GetNavArea(Vector(-687.5, 800, -64), 1) bBlockerCade ? hNavArea.SetAttributeTF(TF_NAV_BLOCKED) : hNavArea.ClearAttributeTF(TF_NAV_BLOCKED) for(local hHHH; hHHH = FindByClassnameWithin(hHHH, "headless_hatman", Vector(560, 1264, 192), 128);) { local Motion = hHHH.GetLocomotionInterface() if(Motion.GetVelocity().x >= 300) Motion.Reset() } } } } __CollectGameEventCallbacks(Trespasser) local hFilterBlu = FindByName(null, "filter_blu") for(local hProp; hProp = FindByClassname(hProp, "prop_dynamic");) if(GetPropEntity(hProp, "m_hDamageFilter") == null) SetPropEntity(hProp, "m_hDamageFilter", hFilterBlu) AlternateWaves.IterateIcons(function(iIcon, sNames, sCounts, sFlags) { local sIconName = GetPropStringArray(hObjectiveResource, sNames, iIcon) switch(sIconName) { case "horsemann_lite": Trespasser.HalloweenBossIcon = ["horsemann_lite", 1, MVM_CLASS_FLAG_MINIBOSS] break case "mallet_lite": Trespasser.HalloweenBossIcon = ["mallet_lite", 1, MVM_CLASS_FLAG_MINIBOSS] break case "monoculus_nys": Trespasser.HalloweenBossIcon = ["monoculus_nys", 1, MVM_CLASS_FLAG_MINIBOSS | MVM_CLASS_FLAG_ALWAYSCRIT] break } }) AlternateWaves.bTrackIcons = false local hPlayerManager = FindByClassname(null, "tf_player_manager") for(local i = 1; i <= MAX_CLIENTS; i++) { local hPlayer = PlayerInstanceFromIndex(i) if(hPlayer && hPlayer.IsAlive()) SendGlobalGameEvent("player_spawn", { userid = GetPropIntArray(hPlayerManager, "m_iUserID", i) team = hPlayer.GetTeam() "class": hPlayer.GetPlayerClass() }) } Trespasser.hThinkEnt.ValidateScriptScope() Trespasser.hThinkEnt.GetScriptScope().Think <- function() { Trespasser.ThinkEntThink() return -1 } AddThinkToEnt(Trespasser.hThinkEnt, "Think") Convars.SetValue("sig_etc_unintended_class_weapon_display_meters", 0)