//////////////////////////GUARDIAN SHIELD ///////////////////////////THIS WONT HAVE REPURCUSSIONS PrecacheModel("models/props_mvm/mvm_comically_small_player_shield.mdl") PrecacheSound("misc/halloween/spell_lightning_ball_impact.wav") ::ShieldGuardThink <- function() { local origin = self.GetOrigin() local forwardvelo = self.EyePosition()+self.EyeAngles().Forward()*75 local eyepos = self.EyePosition()+self.EyeAngles() local eyelook = self.EyeAngles() local shield_buttons = NetProps.GetPropInt(self, "m_nButtons"); local shield_buttons_changed = shield_buttons_last ^ shield_buttons; local shield_buttons_pressed = shield_buttons_changed & shield_buttons; local shield_buttons_released = shield_buttons_changed & (~shield_buttons); local health = self.GetHealth() //FlareFiringTimer() if (flarecheck == false) { 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(); } flarecheck = true } if (shield_buttons_pressed & Constants.FButtons.IN_ATTACK2 && shootcheck == false) { shootcheck = true } if (shootcheck == true) { flaretime++ if (flaretime == 1) { NetProps.SetPropEntity(flaregun, "m_hOwner", self); NetProps.SetPropFloat(flaregun, "m_flNextPrimaryAttack", 0); flaregun.PrimaryAttack(); } if (flaretime == 10) { NetProps.SetPropEntity(flaregun, "m_hOwner", self); NetProps.SetPropFloat(flaregun, "m_flNextPrimaryAttack", 0); flaregun.PrimaryAttack(); } if (flaretime == 20) { NetProps.SetPropEntity(flaregun, "m_hOwner", self); NetProps.SetPropFloat(flaregun, "m_flNextPrimaryAttack", 0); flaregun.PrimaryAttack(); shootcheck = false flaretime = 0 } } if (hasShield == false) { shield = SpawnEntityFromTable("entity_medigun_shield", { //targetname = "shield" teamnum = self.GetTeam() skin = self.GetTeam() == TF_TEAM_RED ? 0 : 1 }) DispatchSpawn(shield) shield.AddEFlags(Constants.FEntityEFlags.EFL_NO_THINK_FUNCTION); hasShield = true shield.SetModel("models/props_mvm/mvm_comically_small_player_shield.mdl") } if (shield.IsValid()) { shield.SetOrigin(forwardvelo + Vector(0, 0, -75)) shield.SetAbsAngles(eyelook) } if (health <= 375 && shield.IsValid() && shieldNoActive == false) { shield.Kill() shieldNoActive = true EmitSoundEx({ sound_name = "misc/halloween/spell_lightning_ball_impact.wav", origin = origin + Vector(0, 0, 7), }); EmitSoundEx({ sound_name = "misc/halloween/spell_lightning_ball_impact.wav", origin = origin + Vector(0, 0, 7), volume = 0.5 // both at full volume is kinda loud }); } shield_buttons_last = shield_buttons; return -1 } ::ShieldEnable <- 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_shield")) { self.ValidateScriptScope(); playerScope.shield <- null; playerScope.hasShield <- false; playerScope.shield_buttons_last <- 0; playerScope.flaretime <- 0; playerScope.flarecheck <- false; playerScope.shootcheck <- false; playerScope.shieldNoActive <- false; playerScope.botAltTimer <- 6 playerScope.serverTime <- 0 playerScope.FlareFiringTimer <- function() { //caberCountTime acts as time if (botAltTimer == null) return local time = floor(Time()) if (time != serverTime) { // Once every second serverTime = time if (botAltTimer > 0) { botAltTimer-- } if (botAltTimer == 0) { botAltTimer = 6 self.PressAltFireButton(0.1) } //printl(caberTimer) } } PopExtUtil.AddThinkToEnt(self, "ShieldGuardThink"); } } } //////////////////////////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", "ShieldEnable", 0.1, null, null); // } // } // __CollectGameEventCallbacks(this);