//////////////////////////TELEPORTING CHARGE ///////////////////////////COOL HHH CHARGE PrecacheSound("vo/halloween_boss/knight_laugh01.mp3") PrecacheSound("vo/halloween_boss/knight_laugh02.mp3") PrecacheSound("vo/halloween_boss/knight_laugh03.mp3") PrecacheSound("vo/halloween_boss/knight_laugh04.mp3") PrecacheSound("misc/halloween/spell_teleport.wav") function OnScriptHook_OnTakeDamage(params) { //printl("hrt") if (params.attacker == null || params.attacker.GetClassname() == "worldspawn") return; if (params.const_entity.GetClassname() != "player" || params.attacker.GetClassname() != "player") return; local victim = params.const_entity; local user = params.attacker; //local player = GetPlayerFromUserID(params.attacker) local scope = user.GetScriptScope() local damageNum = params.damage; local health = victim.GetMaxHealth() local actualHealth = NetProps.GetPropInt(victim, "m_iMaxHealth") local curHealth = victim.GetHealth() local dmgtype = params.damage_type; // printl("ac dmg type is: "+dmgtype) // printl("ac health is: "+actualHealth) //printl(damageNum) // local wepInflictor = params.inflictor; // local dmgType = params.damage_stats; //printl(health) victim.ValidateScriptScope(); user.ValidateScriptScope(); if (victim.InCond(23) && "TeleportChargeThink" in scope.PlayerThinkTable && dmgtype == 134221952) // melee { victim.TakeDamage((curHealth / 2) + 1, 4, user) // add 1 to ensure 4 hits } else if ("TeleportChargeThink" in scope.PlayerThinkTable && dmgtype == 134221952) // melee { victim.TakeDamage((actualHealth / 4) + 1, 4, user) // add 1 to ensure 4 hits } } ::TeleportChargeThink <- function() { local classname = self.GetPlayerClass() local novelo = Vector(0, 0, 0) if (classname != 4) return local tele_buttons = NetProps.GetPropInt(self, "m_nButtons"); local tele_buttons_changed = tele_buttons_last ^ tele_buttons; local tele_buttons_pressed = tele_buttons_changed & tele_buttons; local tele_buttons_released = tele_buttons_changed & (~tele_buttons); local getWep = PopExtUtil.GetItemInSlot(self, 1) local activeWep = self.GetActiveWeapon() local playerBossLocation = self.GetOrigin() local thirdWep = PopExtUtil.GetItemInSlot(self, 2) NetProps.SetPropInt(self, "m_Shared.m_iDecapitations", 0) self.AddCondEx(15, -1, null) // prevents charge //assume the mission has checks/barriers for if the player is in spawn if (self.InCond(51) == true) { return -1 } //for stuck fix CurLocation = playerBossLocation //ty lite ::MASK_PLAYERSOLID <- 33636363 function UnstuckEntity(entity) { local origin = entity.GetOrigin(); local trace = { start = origin, end = origin, hullmin = entity.GetBoundingMins(), hullmax = entity.GetBoundingMaxs(), mask = MASK_PLAYERSOLID, ignore = entity } TraceHull(trace); if ("startsolid" in trace) { local dirs = [Vector(1, 0, 0), Vector(-1, 0, 0), Vector(0, 1, 0), Vector(0, -1, 0), Vector(0, 0, 1), Vector(0, 0, -1)]; for (local i = 16; i <= 96; i += 16) { foreach (dir in dirs) { trace.start = origin + dir * i; trace.end = trace.start; delete trace.startsolid; TraceHull(trace); if (!("startsolid" in trace)) { entity.SetAbsOrigin(trace.end); return true; } } } return false; } return true; } local stuckTimer = NetProps.GetPropFloat(thirdWep, "m_flEnergy") NetProps.SetPropFloat(thirdWep, "m_flEnergy", stuckTimer + 1) //printl(stuckTimer) if (tele_buttons_pressed & Constants.FButtons.IN_ATTACK2 && GetPropFloat(self, "m_Shared.m_flChargeMeter") == 100) { if (bossParticle != null) { bossParticle.Kill() } local getEyePosition = self.EyePosition()+self.EyeAngles().Forward()*950 local eyeAngleFound = self.EyeAngles() // some spots can teleport you very far into spots where you get stuck // yes i can use x to refer to the first vector arguement if (eyeAngleFound.x >= 40) return local navArea = GetNearestNavArea(getEyePosition, 9999, true, true) if (navArea == null) return local foundNav = navArea.GetCenter() if (foundNav == null) return local teleport = navArea.FindRandomSpot() if (GetPropFloat(self, "m_Shared.m_flChargeMeter") == 100 && foundNav != null) { self.Teleport(true, teleport + Vector(0, 0, 20), false, QAngle(), false, novelo) isStuckLocation = teleport NeedStuckCheck = true NetProps.SetPropFloat(thirdWep, "m_flEnergy", 0) SetPropFloat(self, "m_Shared.m_flChargeMeter", 0) bossParticle = SpawnEntityFromTable("info_particle_system", { targetname = "summoning" origin = teleport + Vector(0, 0, 7), angles = novelo, effect_name = "utaunt_headless_fire", flag_as_weather = 0, }) //play particle then kill //self.AddCustomAttribute("move speed penalty", 0.001, 0.85) EntFireByHandle(bossParticle, "start", "", -1, null, null) EntFireByHandle(bossParticle, "stop", "", 2, null, null) EntFireByHandle(bossParticle, "kill", "", 2, null, null) bossParticle = null //extra sfx EmitSoundEx({ sound_name = "misc/halloween/spell_teleport.wav", origin = foundNav + Vector(0, 0, 7), }); //play random sound // local randomNumberLaugh = RandomInt(1, 4) // if (randomNumberLaugh == 1) // { // EmitSoundEx({ // sound_name = "vo/halloween_boss/knight_laugh01.mp3", // origin = foundNav + Vector(0, 0, 7), // }); // } // if (randomNumberLaugh == 2) // { // EmitSoundEx({ // sound_name = "vo/halloween_boss/knight_laugh02.mp3", // origin = foundNav + Vector(0, 0, 7), // }); // } // if (randomNumberLaugh == 3) // { // EmitSoundEx({ // sound_name = "vo/halloween_boss/knight_laugh03.mp3", // origin = foundNav + Vector(0, 0, 7), // }); // } // if (randomNumberLaugh == 4) // { // EmitSoundEx({ // sound_name = "vo/halloween_boss/knight_laugh04.mp3", // origin = foundNav + Vector(0, 0, 7), // }); // } } } //stuck fix if (isStuckLocation.x == CurLocation.x && stuckTimer >= 150 && NeedStuckCheck == true) { UnstuckEntity(self) } tele_buttons_last = tele_buttons; return -1 } ::TeleEnable <- function() { ////printl(self) local playerScope = self.GetScriptScope() local wep = PopExtUtil.GetItemInSlot(self, 1) local wepScope = self.GetScriptScope() local wep = PopExtUtil.GetItemInSlot(self, 0) local getwepID = NetProps.GetPropInt(wep, "m_AttributeManager.m_Item.m_iItemDefinitionIndex") if (self != null && self.IsBotOfType(TF_BOT_TYPE)) { self.ValidateScriptScope() if (!("PlayerThinkTable" in self.GetScriptScope())) self.GetScriptScope().PlayerThinkTable <- {} if (self.HasBotTag("bot_horseman")) { local sword = PopExtUtil.GiveWeapon(self, "tf_weapon_sword", 266) sword.AddAttribute("max health additive penalty", 0, -1) sword.AddAttribute("damage bonus hidden", 0, -1) sword.AddAttribute("fire rate penalty", 2, -1) sword.AddAttribute("no crit boost", 1, -1) self.ValidateScriptScope(); playerScope.tele_buttons_last <- 0; playerScope.isStuckLocation <- Vector(); playerScope.CurLocation <- Vector(); playerScope.NeedStuckCheck <- false; playerScope.ChargeCheck <- false; playerScope.bossParticle <- null PopExtUtil.AddThinkToEnt(self, "TeleportChargeThink"); } } }