//////////////////////////ANA GUN //////////////////////////////////////////////spawnerBOOST ADMINISTERED local areas = {} GetAllAreas(areas) PrecacheSound("mvm/mvm_tele_deliver.wav") PrecacheSound("weapons/rescue_ranger_fire.wav") ::FailsafeDeployRobots <- function() { local projectileOrigin = self.GetOrigin() blownUp = true if (blownUp == true) { local nav = GetNearestNavArea(projectileOrigin, 125, true, true) // make bigger incase its stuck in some stupid corner local minareasize = 1500; if (nav == null) return //if (nav.GetSizeX() * nav.GetSizeY() > minareasize) local navArea = nav.GetCenter() for(local bot; bot = FindByClassname(bot, "player");) { if (!bot.IsBotOfType(TF_BOT_TYPE)) continue if (bot.HasBotTag("bot_deploy")) { if (nav != null) { bot.Teleport(true, navArea + Vector(RandomInt(-15, 15), RandomInt(-15, 15), 20), false, QAngle(), false, Vector(0, 0, 0)) } if (particle == null) { particle = SpawnEntityFromTable("info_particle_system", { effect_name = "teleportedin_blue", targetname = "teleport" origin = bot.GetOrigin() }) } EntFireByHandle(particle, "Start", "", -1, null, null) bot.AddCondEx(6, 3, null) bot.AddCondEx(5, 2, null) bot.RemoveBotTag("bot_deploy") bot.RemoveCustomAttribute("move speed penalty") bot.RemoveCustomAttribute("no_jump") bot.RemoveCustomAttribute("cannot pick up intelligence") if (bot != null) { EmitSoundEx({ sound_name = "mvm/mvm_tele_deliver.wav", origin = projectileOrigin, volume = 0.25 // plays 4 times }); } } if (bot == null) { break } } } } ::SpawnerThink <- function() { // local classname = self.GetPlayerClass() // if (classname != 2) return local spawner_buttons = NetProps.GetPropInt(self, "m_nButtons"); local spawner_buttons_changed = spawner_buttons_last ^ spawner_buttons; local spawner_buttons_pressed = spawner_buttons_changed & spawner_buttons; local spawner_buttons_released = spawner_buttons_changed & (~spawner_buttons); local spawner_origin = self.GetOrigin() if (gunSetup == false) { 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("projectile spread angle penalty", 12, -1) bomb.SetClip1(1); } gunSetup = true } function ShootDeployBots(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(); EmitSoundEx({ sound_name = "weapons/rescue_ranger_fire.wav", origin = spawner_origin, }); EmitSoundEx({ sound_name = "weapons/rescue_ranger_fire.wav", origin = spawner_origin, volume = 0.5 }); NetProps.SetPropVector(player, "pl.v_angle", eye_angle + Vector()) } if (spawner_buttons_pressed & Constants.FButtons.IN_ATTACK3) { ShootDeployBots(self, QAngle(0, 0)) callback = false //kill all particle entities, new ones are created after the projectile is deleted for (local ent; ent = FindByName(ent, "teleport");) { ent.Kill() } } TeleTrackTime() //tag is removed upon teleporting, ensure all waiting bots cannot move for(local bot; bot = FindByClassname(bot, "player");) { if (!bot.IsBotOfType(TF_BOT_TYPE)) continue if (bot.HasBotTag("bot_deploy")) { bot.AddCustomAttribute("move speed penalty", 0.00001, -1) bot.AddCustomAttribute("no_jump", 1, -1) bot.AddCustomAttribute("cannot pick up intelligence", 1, -1) } if (bot == null) { break } } for(local projectile; projectile = FindByClassname(projectile, "tf_projectile_*");) { //get every entity local owner = NetProps.GetPropEntity(bomb, "m_hOwner"); local onground = NetProps.GetPropBool(projectile, "m_bTouched") //is projectile launched by the script made launcher local launcher = NetProps.GetPropEntity(projectile, "m_hLauncher") //if the projectile lands on a prop, "onground" is not set to false //in such cases, give the projectile a death callback //this wont run if the projectile is removed via Kill() if (callback == false) { PopExtUtil.SetDestroyCallback(projectile, FailsafeDeployRobots) projectile.ValidateScriptScope() local projectileScope = projectile.GetScriptScope() projectileScope.blownUp <- false projectileScope.particle <- null callback = true } if (projectile.GetTeam() == self.GetTeam() && launcher == bomb) { local projectileOrigin = projectile.GetOrigin() projectile.SetModelSimple("models/weapons/c_models/c_toolbox/c_toolbox.mdl") projectile.SetModelScale(2, 0) if (onground == true) { local nav = GetNearestNavArea(projectileOrigin, 25, true, true) local minareasize = 1500; if (nav == null) continue //if (nav.GetSizeX() * nav.GetSizeY() > minareasize) local navArea = nav.GetCenter() for(local bot; bot = FindByClassname(bot, "player");) { if (!bot.IsBotOfType(TF_BOT_TYPE)) continue if (bot.HasBotTag("bot_deploy")) { if (nav != null) { bot.Teleport(true, navArea + Vector(RandomInt(-15, 15), RandomInt(-15, 15), 20), false, QAngle(), false, Vector(0, 0, 0)) } if (particle == null) { particle = SpawnEntityFromTable("info_particle_system", { effect_name = "teleportedin_blue", targetname = "teleport" origin = bot.GetOrigin() }) } EntFireByHandle(particle, "Start", "", -1, null, null) // particle.Kill() // particle = null bot.AddCondEx(6, 3, null) bot.AddCondEx(5, 2, null) bot.RemoveBotTag("bot_deploy") bot.RemoveCustomAttribute("move speed penalty") bot.RemoveCustomAttribute("no_jump") bot.RemoveCustomAttribute("cannot pick up intelligence") if (bot != null) { EmitSoundEx({ sound_name = "mvm/mvm_tele_deliver.wav", origin = projectileOrigin, volume = 0.25 // plays 4 times }); } } if (bot == null) { break } } projectile.Kill() } } if (projectile == null) { //once we are done with every player stop the loop break } } spawner_buttons_last = spawner_buttons; } //////////////////////////ON GAME EVENTS ::SpawnerEnable <- function() { ////printl(self) local playerScope = self.GetScriptScope() local wep = PopExtUtil.GetItemInSlot(self, 1) local wepScope = self.GetScriptScope() 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_deployer")) { self.ValidateScriptScope(); playerScope.spawner_buttons_last <- 0; playerScope.gunSetup <- false; playerScope.teleTimer <- 15 playerScope.serverTime <- 0 playerScope.callback <- false playerScope.particle <- null playerScope.TeleTrackTime <- function() { //caberCountTime acts as time if (teleTimer == null) return local time = floor(Time()) if (time != serverTime) { // Once every second serverTime = time if (teleTimer > 0) { teleTimer-- particle = null } if (teleTimer == 0) { bomb.SetClip1(1); self.PressSpecialFireButton(0.1) teleTimer = 15 } //printl(teleTimer) //printl(teleTimer) } } PopExtUtil.AddThinkToEnt(self, "SpawnerThink"); } } } function OnGameEvent_player_spawn(params) { local player = GetPlayerFromUserID(params.userid); local playerScope = player.GetScriptScope() local wep = PopExtUtil.GetItemInSlot(player, 0) local getwepID = NetProps.GetPropInt(wep, "m_AttributeManager.m_Item.m_iItemDefinitionIndex") if (player != null && player.IsBotOfType(TF_BOT_TYPE)) { EntFireByHandle(player, "CallScriptFunction", "SpawnerEnable", 0.1, null, null); } //EntFireByHandle(player, "CallScriptFunction", "spawnerEnable", 0.1, null, null); } __CollectGameEventCallbacks(this);