//vscript by stardustspy //do not use without my credit PLEASE!!!!!!!!! ::TEAM_RED <- 2 ::TEAM_BLU <- 3 ::TF_NAV_SPAWN_ROOM_RED <- 2 ::TF_NAV_SPAWN_ROOM_BLUE <- 4 ::TF_BOT_FAKE_CLIENT <- 1337 ::MAX_COUNT_WEAPON_EQUPPED <- 8 ::TEAM_SPECTATOR <- 1 ::SOLID_NONE <- 0 ::CONTENTS_SOLID <- 1 ::CONTENTS_WINDOW <- 2 ::CONTENTS_GRATE <- 8 ::CONTENTS_MOVEABLE <- 16384 ::CONTENTS_PLAYERCLIP <- 65536 ::MASK_NPCWORLDSTATIC <- 131083 ::MASK_PLAYERSOLID <- 33636363 ::MASK_NPCSOLID <- 33701899 ::MASK_SOLID <- 33570827 ::MASK_SHOT <- 1174421507 ::MASK_SHOT_HULL <- 100679691 ::IN_ATTACK2 <- 2048 ::PI <- 3.14159265359 ::PRIMARY_FIRE <- Constants.FButtons.IN_ATTACK ::SECONDARY_FIRE <- Constants.FButtons.IN_ATTACK2 ::gamerules <- Entities.FindByClassname(null, "tf_gamerules") ::player_manager <- Entities.FindByClassname(null, "tf_player_manager") ::WORLD_SPAWN <- Entities.FindByClassname(null, "worldspawn") ::MAX_COUNT_PLAYERS <- MaxClients().tointeger() ::MASK_VISIBLE_AND_NPCS <- 33579137 ::DMG_CRITICAL <- 1048576 ::TF_DMG_CUSTOM_HEADSHOT <- 1 ::TF_DMG_CUSTOM_BACKSTAB <- 2 ::TF_DMG_CRITICAL <- 1048576 ::SND_NOFLAGS <- 0 ::SND_CHANGE_VOL <- 1 ::SND_CHANGE_PITCH <- 2 ::SND_STOP <- 4 ::SND_SPAWNING <- 8 ::SND_DELAY <- 16 ::SND_STOP_LOOPING <- 32 ::SND_SPEAKER <- 64 ::SND_SHOULDPAUSE <- 128 ::SND_IGNORE_PHONEMES <- 256 ::SND_IGNORE_NAME <- 512 ::SND_DO_NOT_OVERWRITE_EXISTING_ON_CHANNEL <- 1024 const STRING_NETPROP_ITEMDEF = "m_AttributeManager.m_Item.m_iItemDefinitionIndex" const SLOT_COUNT = 7 const EFL_USER = 1048576 // EFL_IS_BEING_LIFTED_BY_BARNACLE const EFL_USER2 = 1073741824 //EFL_NO_PHYSCANNON_INTERACTION const SINGLE_TICK = 0.015 const DMG_NO_BULLET_FALLOFF = 2097152 PrecacheSound("ambient/energy/weld1.wav") PrecacheSound("ambient/energy/weld2.wav") PrecacheSound("player/recharged.wav") PrecacheSound("npc/assassin/ball_zap1.wav") PrecacheSound("weapons/drg_wrench_teleport.wav") PrecacheSound("misc/halloween/spell_lightning_ball_cast.wav") PrecacheSound("misc/halloween/spell_meteor_impact.wav") PrecacheSound("misc/halloween/spell_spawn_boss.wav") //fold ::ROOT <- getroottable(); if (!("ConstantNamingConvention" in ROOT)) // make sure folding is only done once { foreach (a,b in Constants) foreach (k,v in b) ROOT[k] <- v != null ? v : 0; } function InButton(player, button) { return (GetPropInt(player, "m_nButtons") & button) } function TankSetup(ent) { ent.ValidateScriptScope() local scope = ent.GetScriptScope() ::TankTaunterThink <- function() { local time_server = Time() printl(self) function VectorToQAngle(vector) { local pitch = atan2(vector.z, vector.Length2D()) * (180 / PI) // Calculate pitch local yaw = atan2(vector.y, vector.x) * (180 / PI) // Calculate yaw return QAngle(pitch, yaw, 0) // Return as QAngle (pitch, yaw, roll) } if (typeof(tank_fire_time) == "null") { tank_fire_time = 0; // Initialize last attack time } if (self.IsTaunting()) { local tank_muzzle_origin = self.GetAttachmentOrigin(self.LookupAttachment("tank_muzzle")) local eye_angles = self.EyeAngles() local added_angle = Vector(0, 0, 30) // adjusted to account for player size // Adjust the position to account for left-right movement local x_offset = 0 // Check if player is holding left or right movement keys if (InButton(self, IN_MOVELEFT)) { x_offset = -40 // Move the origin to the left } else if (InButton(self, IN_MOVERIGHT)) { x_offset = 40 // Move the origin to the right } // Adjust the tank muzzle origin based on player movement local corrected_origin = tank_muzzle_origin + (eye_angles.Left() * x_offset) // Determine the forward velocity local forward_vector // Determine the speed based on player movement if (x_offset != 0) { // Create a direction vector based on the corrected origin local direction_vector = (corrected_origin - tank_muzzle_origin) // Calculate the length of the direction vector local direction_length = direction_vector.Length() // Ensure we do not divide by zero if (direction_length > 0) { // Normalize the direction vector local normalized_direction = direction_vector * (1 / direction_length) // Normalize the vector // Scale to the desired speed forward_vector = normalized_direction * 1000 + added_angle// Consistent speed } else { forward_vector = eye_angles.Forward() * 1000 + added_angle // Default speed if no movement } } else { forward_vector = eye_angles.Forward() * 1000 + added_angle// Default forward direction } // Now ensure rockets travel in the correct direction with adjusted speed if (InButton(self, PRIMARY_FIRE) && (tank_fire_time + 2.3) <= time_server) { local rocket = SpawnEntityFromTable("tf_projectile_rocket", { basevelocity = forward_vector, // Use the determined forward vector for velocity teamnum = self.GetTeam(), origin = corrected_origin + Vector(0, 0, 80), // Adjust origin height }) // Calculate the angles from the forward vector local rocket_angle = VectorToQAngle(forward_vector) // Convert forward_vector to QAngle rocket.SetAbsAngles(rocket_angle) // Set the absolute angles for the rocket rocket.SetOwner(self) // Ensure the rocket doesn't collide with owner and gives proper kill credits tank_fire_time = time_server } } return -1; } // Initial setup scope.tank_fire_time <- 0 scope.InButton <- InButton AddThinkToEnt(ent, "TankTaunterThink") } function CheckForTag(ent) { if (ent.HasBotTag("bot_panzerman")) { printl("adding script") TankSetup(ent) } } ::rageScript <- { Cleanup = function() { for (local player; player = Entities.FindByClassname(player, "player");) { NetProps.SetPropString(player, "m_iszScriptThinkFunction", "") AddThinkToEnt(player, null) } // keep this at the end delete ::rageScript } // mandatory events OnGameEvent_recalculate_holidays = function(_) { if (GetRoundState() == 3) { Cleanup() } } OnGameEvent_mvm_wave_complete = function(_) { Cleanup() } OnGameEvent_player_spawn = function(params) { local player = GetPlayerFromUserID(params.userid) player.ValidateScriptScope() local playerscope = player.GetScriptScope() //printl(primary) if (player.IsBotOfType(TF_BOT_FAKE_CLIENT)) { NetProps.SetPropString(player, "m_iszScriptThinkFunction", "") AddThinkToEnt(player, null) EntFireByHandle(gamerules, "RunScriptCode", "CheckForTag(activator)", 0.1, player, player) } } OnGameEvent_post_inventory_application = function(params) { local player = GetPlayerFromUserID(params.userid) player.ValidateScriptScope() local playerscope = player.GetScriptScope() //printl(primary) } OnScriptHook_OnTakeDamage = function(params) { local victim = params.const_entity local weapon = params.weapon local attacker = params.attacker local entity = params.inflictor local damage = params.damage local dmgtype = params.damage_type local dmg_special = params.damage_stats local weapon_id = NetProps.GetPropInt(weapon, STRING_NETPROP_ITEMDEF) } }; __CollectGameEventCallbacks(rageScript)