//////////////////////////BASEBALL REPLACE BALL WITH SPELL ///////////////////////////THE RANDOMGUY INCIDENT ::BallThink <- function() { local ballphys = GetPhysVelocity(self) self.SetModelSimple("models/empty.mdl") if (spell == null && spawnedSpell == false) { spell = SpawnEntityFromTable("tf_projectile_spellmeteorshower", { teamnum = myPlayer.GetTeam(), origin = myPlayer.EyePosition()+myPlayer.EyeAngles().Forward()*32, angles = myPlayer.EyeAngles() }) spell.SetOwner(myPlayer) spell.SetPhysVelocity(ballphys) spawnedSpell = true } if (NetProps.GetPropBool(self, "m_bTouched") == true && self.IsValid()) // m_bTouched exists on sandman ball { self.Kill() } } ::BaseballThink <- function() { local origin = self.GetOrigin() local melee = PopExtUtil.GetItemInSlot(self, 2) local ammocount = NetProps.GetPropIntArray(self, "m_iAmmo", 4) melee.AddAttribute("attach particle effect", 13, -1) melee.AddAttribute("effect bar recharge rate increased", 0.275, -1) melee.AddAttribute("maxammo grenades1 increased", 3, -1) melee.AddAttribute("max health additive penalty", 0, -1) if (ammocount == 0) { melee.AddAttribute("no_attack", 1, -1) } if (ammocount == 3) { melee.RemoveAttribute("no_attack") } for(local ball; ball = FindByClassname(ball, "tf_projectile_stun_ball");) { ball.ValidateScriptScope(); local ballScope = ball.GetScriptScope() if (!("ProjectileThinkTable" in ballScope)) { ballScope.ProjectileThinkTable <- {} } if (!("BallThink" in ballScope.ProjectileThinkTable) && ball.GetOwner() == self) { self.ValidateScriptScope(); ballScope.spell <- null; ballScope.myPlayer <- self; ballScope.spawnedSpell <- false; PopExtUtil.AddThinkToEnt(ball, "BallThink"); } } return -1 } ::BaseballEnable <- function() { ////printl(self) local playerScope = self.GetScriptScope() local wep = PopExtUtil.GetItemInSlot(self, 1) 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_baseball")) { self.ValidateScriptScope(); PopExtUtil.AddThinkToEnt(self, "BaseballThink"); } } } //////////////////////////ON GAME EVENTS // function OnGameEvent_player_spawn(params) // { // local player = GetPlayerFromUserID(params.userid); // local playerScope = player.GetScriptScope() // local wep = PopExtUtil.GetItemInSlot(player, 2) // local getwepID = NetProps.GetPropInt(wep, "m_AttributeManager.m_Item.m_iItemDefinitionIndex") // // if (player != null && player.IsBotOfType(TF_BOT_TYPE)) // // { // EntFireByHandle(player, "CallScriptFunction", "BaseballEnable", 0.1, null, null); // // } // } // __CollectGameEventCallbacks(this);