PrecacheModel("models/props_mvm/robot_spawnpoint_warning.mdl") PrecacheSound("weapons/dragons_fury_impact_bonus_damage_hit.wav") PrecacheSound("player/pl_impact_airblast1.wav") local areas = {} GetAllAreas(areas) // function LookAtTheClosestPlayer() // { // local closest = 1e9; // local aimat = Vector(); // local eye_pos = self.EyePosition() // for(local player; player = Entities.FindByClassname(player, "player");) // { // if(player.GetTeam() == self.GetTeam() || NetProps.GetPropInt(player, "m_lifeState") != 0) // continue; // local direction = player.GetCenter() - eye_pos; // local distance = direction.Length(); // if(distance < closest) { // closest = distance; // aimat = direction; // } // } // if(aimat) { // aimat.Norm() // self.SetForwardVector(aimat) // } // return -1; // } // AddThinkToEnt(GetListenServerHost(),"LookAtTheClosestPlayer") // Then you can add traceline check // function LookAtTheClosestPlayer(who) { // local closest = 1e9; // local aimat = null; // local eye_pos = who.EyePosition(); // local line = { // mask = 16395, //MASK_SOLID_BRUSHONLY // ignore = who, // start = eye_pos, // end = null // } // for(local player; player = Entities.FindByClassname(player, "player");) { // if(player.GetTeam() == who.GetTeam() || NetProps.GetPropInt(player, "m_lifeState") != 0) // continue; // local center = player.GetCenter(); // local direction = center - eye_pos; // local distance = direction.Length(); // if(distance < closest) { // line.end = center; // TraceLineEx(line); // if(!line.hit) { // closest = distance; // aimat = direction; // } // } // } // if(aimat) { // aimat.Norm() // who.SetForwardVector(aimat) // } // } // LookAtTheClosestPlayer(GetListenServerHost()) //ATTACKS //-Draco Meteor: Summon meteors (rockets or fireballs) from the sky. they land in different areas of the map //-Flamethrower: Use primary weapon //-Flame Lash: Fires several flares in a line //-Fire Bomb: Charge explosives, then launch them ::BombThink <- function() { //printl("piper") velocityNum++ // printl(velocityNum) // printl(velocityPipeInit) // if (velocityNum >= 40) // { // self.SetPhysVelocity(Vector(velocityPipeInit.x, velocityPipeInit.y, velocityNum * velocityNum)) // } // if (velocityNum >= 50) // { // self.SetPhysVelocity(Vector(velocityPipeInit.x, velocityPipeInit.y, velocityNum / velocityNum)) // } // if (velocityNum <= 40) // { // self.SetPhysVelocity(Vector(0, 0, velocityNum * 2)) // } if (NetProps.GetPropBool(self, "m_bTouched") == true) { local origin = self.GetOrigin() local blast = NetProps.GetPropFloat(self, "m_DmgRadius") local damage = NetProps.GetPropFloat(self, "m_flDamage") + 40 local launcher = NetProps.GetPropInt(self, "m_hOriginalLauncher") for(local enemy; enemy = FindByClassnameWithin(enemy, "player", origin, blast);) { if (enemy.GetTeam() != shooter && enemy.GetTeam() != TEAM_SPECTATOR) { if (enemy.InCond(30) || enemy.InCond(24)) { enemy.TakeDamageEx(null, shooter, launcher, Vector(0, 0, 0), enemy.GetOrigin(), damage * 1.35, 64) // blast } else { enemy.TakeDamageEx(null, shooter, launcher, Vector(0, 0, 0), enemy.GetOrigin(), damage, 64) // blast } } } DispatchParticleEffect("projectile_fireball", origin, Vector(0, 0, 0)) DispatchParticleEffect("heavy_ring_of_fire_child01", origin, Vector(0, 0, 0)) EmitSoundEx({ sound_name = "weapons/dragons_fury_impact_bonus_damage_hit.wav", origin = origin, }); EmitSoundEx({ sound_name = "player/pl_impact_airblast1.wav", origin = origin, }); self.Kill() } } ::GiantModeThink <- function() { local buttons_giantmode = NetProps.GetPropInt(self, "m_nButtons"); local buttons_changed_giantmode = buttons_last_giantmode ^ buttons_giantmode; local buttons_pressed_giantmode = buttons_changed_giantmode & buttons_giantmode; local buttons_released_giantmode = buttons_changed_giantmode & (~buttons_giantmode); local activeWep = self.GetActiveWeapon() local wepID = NetProps.GetPropInt(activeWep, "m_AttributeManager.m_Item.m_iItemDefinitionIndex") local primary = PopExtUtil.GetItemInSlot(self, 0) local second = PopExtUtil.GetItemInSlot(self, 1) local melee = PopExtUtil.GetItemInSlot(self, 2) local curOrigin = self.GetOrigin() local maxhp = self.GetMaxHealth() local curHp = self.GetHealth() local playerScope = self.GetScriptScope() local fire_time = NetProps.GetPropFloat(second, "m_flLastFireTime"); ////printl(fire_time) function CallTrickRoom() { for (local player; player = FindByClassname(player, "player");) { ClientPrint(player, 4, "The dimensions have been twisted!") SetSkyboxTexture("sky_harvest_night_01") EmitSoundOnClient("Halloween.hellride", player) local maxspeed = NetProps.GetPropFloat(player, "m_flMaxspeed") if (maxspeed >= 300) { NetProps.SetPropFloat(player, "m_flMaxspeed", maxspeed / 2) //player.AddCustomAttribute("major move speed bonus", 0.5, -1) } if (maxspeed <= 300) { NetProps.SetPropFloat(player, "m_flMaxspeed", maxspeed * 2) //player.AddCustomAttribute("major move speed bonus", 2, -1) } } } if (curHp <= maxhp / 2 && isTrickRoomUp == false) { CallTrickRoom() isTrickRoomUp = true } //heavy is 230 //scout is 400 //soldier is 260 //pyro is 300 //demo is 280 //engie is 300 //medic is 320 //sniper is 300 //spy is 320 randomGenTime++ if (randomGenTime >= 500) { local doAttack2 = RandomInt(1, 4) if (doAttack2 == 1) { self.Weapon_Switch(second) self.PressAltFireButton(0.1) } if (doAttack2 == 2 && activateMetoer == false) { self.Weapon_Switch(primary) self.PressSpecialFireButton(0.1) meteor_timer = 0 } if (doAttack2 == 3) { self.Weapon_Switch(second) self.PressSpecialFireButton(0.1) meteor_timer = 0 } if (doAttack2 == 4) { allowFlaming = true } randomGenTime = 0 } //////////////////////ATTACK 3 ///////////////////////////////// function SpawnFlare(player, offset) { local eye_angle = player.EyeAngles(); NetProps.SetPropVector(player, "pl.v_angle", eye_angle + offset + Vector()) NetProps.SetPropEntity(flaregun, "m_hOwner", player); NetProps.SetPropFloat(flaregun, "m_flNextPrimaryAttack", 0); flaregun.PrimaryAttack(); NetProps.SetPropVector(player, "pl.v_angle", eye_angle + Vector()) } function SpawnBombs(player, offset) { local eye_angle = player.EyeAngles(); local forwardvelo = player.EyePosition()+player.EyeAngles().Forward()*50 local propos = player.EyePosition() NetProps.SetPropVector(player, "pl.v_angle", eye_angle + offset + Vector()) NetProps.SetPropEntity(bomb, "m_hOwner", player); NetProps.SetPropFloat(bomb, "m_flNextPrimaryAttack", 0); bomb.PrimaryAttack(); NetProps.SetPropVector(player, "pl.v_angle", eye_angle + Vector()) } //for some reason spawnbombs takes limited calls, create a second one function SpawnBombs2(player, offset) { local eye_angle = player.EyeAngles(); NetProps.SetPropVector(player, "pl.v_angle", eye_angle + offset + Vector()) NetProps.SetPropEntity(bomb2, "m_hOwner", player); NetProps.SetPropFloat(bomb2, "m_flNextPrimaryAttack", 0); bomb2.PrimaryAttack(); NetProps.SetPropVector(player, "pl.v_angle", eye_angle + Vector()) } if (buttons_giantmode & Constants.FButtons.IN_ATTACK) { //attack and attack 3 conflict, set max flares here to prevent rapid flare attacks from triggering flareCount = 20 if (last_fire_time == 0) { if(!("flaregun" in getroottable()) || !flaregun.IsValid()) { flaregun <- Entities.CreateByClassname("tf_weapon_flaregun"); NetProps.SetPropInt(flaregun, "m_AttributeManager.m_Item.m_iItemDefinitionIndex", 39); NetProps.SetPropInt(flaregun, "m_AttributeManager.m_Item.m_bInitialized", 1); flaregun.DispatchSpawn(); flaregun.AddAttribute("projectile speed decreased", 0.5, -1) } } ////printl("last fire time: "+last_fire_time+" cur fire time: "+fire_time) if (fire_time > last_fire_time) { SpawnFlare(self, QAngle(0, 20)) SpawnFlare(self, QAngle(0, 10)) SpawnFlare(self, QAngle(0, -20)) SpawnFlare(self, QAngle(0, -10)) last_fire_time = fire_time } } if (activateFlare == true) { for(local pipe; pipe = FindByClassname(pipe, "tf_projectile_pipe");) { if (pipe.GetOwner() == bomb.GetOwner() || pipe.GetOwner() == bomb2.GetOwner()) { //printl(pipe) local pipeScope = pipe.GetScriptScope() pipe.SetModelSimple("models/passtime/ball/passtime_ball_halloween.mdl") EntFireByHandle(pipe, "Ignite", "", 0, null, null) local pipeVel = GetPhysVelocity(pipe) pipe.GetScriptScope().ProjectileThinkTable <- {} pipe.ValidateScriptScope(); if (!("BombThink" in pipeScope.ProjectileThinkTable)) { pipeScope.shooter <- self pipeScope.velocityNum <- 0 pipeScope.velocityPipeInit <- pipeVel pipeScope.ProjectileThinkTable.BombThink <- BombThink } } if (pipe == null) { activateFlare = false break } } } //printl(flareTimer) if (pipeBombCheck == true) { flareTimer++ self.AddCondEx(87, 0.1, null) self.AddCustomAttribute("move speed penalty", 0.01, 0.1) self.AddCustomAttribute("no_jump", 1, 2) } if (flareTimer <= 87) { for(local propkin; propkin = FindByName(propkin, "pumpkin");) { if (propkin != null && propkin.IsValid()) { EntFireByHandle(propkin, "Ignite", "", 0, null, null) propkin.SetAbsAngles(QAngle(flareTimer, flareTimer, flareTimer)) } } } if (flareTimer == 87) { for(local propkin; propkin = FindByName(propkin, "pumpkin");) { if (propkin != null && propkin.IsValid()) { propkin.Kill() } } SpawnBombs(self, QAngle(0, 90)) SpawnBombs(self, QAngle(0, 180)) SpawnBombs(self, QAngle(0, -180)) SpawnBombs(self, QAngle(0, -90)) SpawnBombs2(self, QAngle(0, 45)) SpawnBombs2(self, QAngle(0, -45)) SpawnBombs2(self, QAngle(0, 0)) SpawnBombs2(self, QAngle(45, 0)) SpawnBombs2(self, QAngle(-45, 0)) pipeBombCheck = false flareTimer = 0 } if (buttons_pressed_giantmode & Constants.FButtons.IN_ATTACK2) { if (second == activeWep) { //printl("create projectile") if(!("bomb" in getroottable()) || !bomb.IsValid()) { bomb <- Entities.CreateByClassname("TF_WEAPON_GRENADELAUNCHER"); NetProps.SetPropInt(bomb, "m_AttributeManager.m_Item.m_iItemDefinitionIndex", 206); NetProps.SetPropInt(bomb, "m_AttributeManager.m_Item.m_bInitialized", 1); bomb.DispatchSpawn(); bomb.AddAttribute("fuse bonus", 99, -1) } if(!("bomb2" in getroottable()) || !bomb2.IsValid()) { bomb2 <- Entities.CreateByClassname("TF_WEAPON_GRENADELAUNCHER"); NetProps.SetPropInt(bomb2, "m_AttributeManager.m_Item.m_iItemDefinitionIndex", 206); NetProps.SetPropInt(bomb2, "m_AttributeManager.m_Item.m_bInitialized", 1); bomb2.DispatchSpawn(); bomb2.AddAttribute("fuse bonus", 99, -1) } pipeBombCheck = true flareTimer = 0 local summonFire = SpawnEntityFromTable("info_particle_system", { targetname = "summoning_fire", origin = self.GetOrigin(), angles = Vector(0, 0, 0), effect_name = "utaunt_headless_fire", flag_as_weather = 0, }) EntFireByHandle(summonFire, "start", "", -1, null, null) EntFireByHandle(summonFire, "Kill", "", 3, null, null) local bombProp1 = SpawnEntityFromTable("prop_dynamic", { targetname = "pumpkin" origin = self.GetOrigin() + Vector(50, 0, 70), model = "models/passtime/ball/passtime_ball_halloween.mdl", }) local bombProp1 = SpawnEntityFromTable("prop_dynamic", { targetname = "pumpkin" origin = self.GetOrigin() + Vector(0, 50, 70), model = "models/passtime/ball/passtime_ball_halloween.mdl", }) local bombProp1 = SpawnEntityFromTable("prop_dynamic", { targetname = "pumpkin" origin = self.GetOrigin() + Vector(0, -50, 70), model = "models/passtime/ball/passtime_ball_halloween.mdl", }) local bombProp1 = SpawnEntityFromTable("prop_dynamic", { targetname = "pumpkin" origin = self.GetOrigin() + Vector(-50, 0, 70), model = "models/passtime/ball/passtime_ball_halloween.mdl", }) local bombProp1 = SpawnEntityFromTable("prop_dynamic", { targetname = "pumpkin" origin = self.GetOrigin() + Vector(-25, 25, 70), model = "models/passtime/ball/passtime_ball_halloween.mdl", }) local bombProp1 = SpawnEntityFromTable("prop_dynamic", { targetname = "pumpkin" origin = self.GetOrigin() + Vector(25, -25, 70), model = "models/passtime/ball/passtime_ball_halloween.mdl", }) local bombProp1 = SpawnEntityFromTable("prop_dynamic", { targetname = "pumpkin" origin = self.GetOrigin() + Vector(-25, -25, 70), model = "models/passtime/ball/passtime_ball_halloween.mdl", }) local bombProp1 = SpawnEntityFromTable("prop_dynamic", { targetname = "pumpkin" origin = self.GetOrigin() + Vector(25, 25, 70), model = "models/passtime/ball/passtime_ball_halloween.mdl", }) } //SpawnFlare(self, QAngle(0, 20)) } if (buttons_pressed_giantmode & Constants.FButtons.IN_ATTACK3) { if (primary == activeWep) { activateMetoer = true meteorBegins = true meteorNumber = 0 self.Taunt(0, 28) meteorBeginTime = 0 } //SpawnFlare(self, QAngle(0, 20)) } //////////////////////FLAMETHROWER ///////////////////////////////// if (allowFlaming == true) { flamerTime++ } if (flamerTime == 1 && allowFlaming == true) { self.AddBotAttribute(SUPPRESS_FIRE) self.Weapon_Switch(primary) self.AddCustomAttribute("no_attack", 1, -1) primary.AddAttribute("disable weapon switch", 1, -1) primary.AddAttribute("provide on active", 1, -1) EmitSoundEx({ sound_name = "weapons/stickybomblauncher_charge_up.wav", origin = self.GetOrigin(), }); } if (flamerTime == 240) { self.RemoveCustomAttribute("no_attack") self.RemoveBotAttribute(SUPPRESS_FIRE) self.AddBotAttribute(ALWAYS_FIRE_WEAPON) } if (flamerTime == 550) { self.RemoveBotAttribute(ALWAYS_FIRE_WEAPON) primary.RemoveAttribute("disable weapon switch") primary.RemoveAttribute("provide on active") self.Weapon_Switch(second) } if (flamerTime >= 1300) { flamerTime = 0 allowFlaming = false } //////////////////////METEORS ///////////////////////////////// if (meteorBegins == true) { meteorBeginTime++ } if (meteorBeginTime <= 100 && meteorBegins == true) { meteorInitTimer++ if (meteorInitTimer == 5) { for (local meteor = 0; meteor <= 1; meteor++) { local fireball = SpawnEntityFromTable("tf_projectile_spellfireball", { basevelocity = Vector(0, 0, 600), teamnum = self.GetTeam(), origin = self.GetOrigin()+ Vector(RandomInt(-60, 130), RandomInt(-60, 130), 0), angles = Vector(-90, 0, 0) }) fireball.SetOwner(self) meteorInitTimer = 0 fireball = null } } //return spots; // causes script to iterate over spots again } if (meteorBeginTime >= 500) { if (activateMetoer == true && meteorNumber <= 30) { meteorScatter++ if (meteorScatter == 10) { local navCount = 0 local nav_id = 0 local minareasize = 1500; local spots = []; local spawnNum = 0 foreach(id, nav in areas) { if (nav.GetSizeX() * nav.GetSizeY() > minareasize) spots.append(nav.GetCenter() + Vector(0, 0, 50)); } for (local meteor = 0; meteor <= 1; meteor++) { local spot = spots[RandomInt(0, spots.len() - 1)] ////printl(spot) local speed = RandomInt(-350, -650) local fireball = SpawnEntityFromTable("tf_projectile_spellfireball", { basevelocity = Vector(0, 0, speed), teamnum = self.GetTeam(), origin = spot + Vector(0, 0, 900), angles = Vector(90, 0, 0) }) local warning = SpawnEntityFromTable("prop_dynamic", { model = "models/props_mvm/robot_spawnpoint_warning.mdl" origin = spot - Vector(0, 0, 50) angles = Vector(0, 0, 0) targetname = "indicator_warn" }) fireball.SetOwner(self) EntFireByHandle(warning, "Kill", "", 3, null, null) } meteorScatter = 0 meteorNumber++ //return spots; // causes script to iterate over spots again } } if (meteorScatter >= 30) { meteorBegins = false meteorBeginTime = 0 activateMetoer = false } } ////printl(meteorScatter) if (buttons_pressed_giantmode & Constants.FButtons.IN_ATTACK3) { ////printl("find areas") if (activeWep == second) { allowFlaming = true } if (primary == activeWep) { activateMetoer = true meteorBegins = true meteorNumber = 0 self.Taunt(0, 28) meteorBeginTime = 0 } } buttons_last_giantmode = buttons_giantmode; } ::GiantModeEnable <- function() { ////printl(self) local playerScope = self.GetScriptScope() local wep = PopExtUtil.GetItemInSlot(self, 1) local wepScope = wep.GetScriptScope() self.ValidateScriptScope(); if (!("PlayerThinkTable" in self.GetScriptScope())) player.GetScriptScope().PlayerThinkTable <- {} playerScope.buttons_last_giantmode <- 0 //msic playerScope.randomGenTime <- 0 playerScope.pipeBombCheck <- false //flamer playerScope.flamerTime <- 0 playerScope.allowFlaming <- false //flares playerScope.flareCount <- 0 playerScope.flareTimer <- 0 playerScope.activateFlare <- true playerScope.flarespawn <- null //meteors playerScope.meteor_timer <- 0 playerScope.meteorScatter <- 0 playerScope.meteorNumber <- 0 playerScope.meteorBeginTime <- 0 playerScope.meteorInitTimer <- 0 playerScope.activateMetoer <- false playerScope.meteorBegins <- false //phase 2 playerScope.last_fire_time <- 0 playerScope.isTrickRoomUp <- false playerScope.PlayerThinkTable.GiantModeThink <- GiantModeThink } function OnGameEvent_player_spawn(params) { local player = GetPlayerFromUserID(params.userid); local class_string = PopExtUtil.Classes[player.GetPlayerClass()] local playerScope = player.GetScriptScope() // ////printl(class_string) // ////printl(player) if (player != null && player.IsBotOfType(TF_BOT_TYPE)) { EntFireByHandle(player, "CallScriptFunction", "GiantModeEnable", 0.1, null, null); } } __CollectGameEventCallbacks(this); //EntFireByHandle(player, "CallScriptFunction", "GiantModeEnable", 0, null, null);