//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 GetItemInSlot(player, slot) { local item for (local i = 0; i < SLOT_COUNT; i++) { local wep = NetProps.GetPropEntityArray(player, "m_hMyWeapons", i) if ( wep == null || wep.GetSlot() != slot) continue item = wep break } return item } ::Tesla_Flamethrower_Script <- { Cleanup = function() { // keep this at the end delete ::Tesla_Flamethrower_Script } // mandatory events OnGameEvent_recalculate_holidays = function(_) { if (GetRoundState() == 3) { Cleanup() } } OnGameEvent_mvm_wave_complete = function(_) { Cleanup() } function PrintTable(table) { if (table == null) return; this.DoPrintTable(table, 0) } function DoPrintTable(table, indent) { local line = "" for (local i = 0; i < indent; i++) { line += " " } line += typeof table == "array" ? "[" : "{"; ClientPrint(null, 2, line) indent += 2 foreach(k, v in table) { line = "" for (local i = 0; i < indent; i++) { line += " " } line += k.tostring() line += " = " if (typeof v == "table" || typeof v == "array") { ClientPrint(null, 2, line) this.DoPrintTable(v, indent) } else { try { line += v.tostring() } catch (e) { line += typeof v } ClientPrint(null, 2, line) } } indent -= 2 line = "" for (local i = 0; i < indent; i++) { line += " " } line += typeof table == "array" ? "]" : "}"; ClientPrint(null, 2, line) } function CalculateCritFactor(attacker, victim) { if (victim.GetClassname() != "player") { victim = null } function IsMiniCritAttacker(entity) { local CritArray = [16, 19, 31] foreach(crit in CritArray) { if (entity.InCond(crit)) { return true } } return false } function IsMiniCritVictim(entity) { if (victim == null) return false local CritArray = [24, 30] foreach(crit in CritArray) { if (entity.InCond(crit)) { return true } } return false } function IsCritAttacker(entity) { local CritArray = [11, 34, 37, 39, 40, 44, 56] foreach(crit in CritArray) { if (entity.InCond(crit)) { return true } } return false } // Initialize the damage factor to 1.0 local factor = 1.0; // Check if the attacker is a crit attacker local isCritAttacker = IsCritAttacker(attacker); // Check if the attacker is a mini-crit attacker local isMiniCritAttacker = IsMiniCritAttacker(attacker); // Check if the victim is a mini-crit victim local isMiniCritVictim = IsMiniCritVictim(victim); // Determine the factor based on crit and mini-crit conditions if (isCritAttacker && isMiniCritVictim) { // If the attacker is a crit attacker and the victim is a mini-crit victim, crit overrides factor = 3.0; } else if (isCritAttacker) { // If the attacker is a crit attacker, crit factor factor = 3.0; } else if (isMiniCritAttacker) { // If the attacker is a mini-crit attacker, mini-crit factor factor = 1.35; } return factor; } GetItemInSlot = function(player, slot) { local item for (local i = 0; i < SLOT_COUNT; i++) { local wep = NetProps.GetPropEntityArray(player, "m_hMyWeapons", i) if ( wep == null || wep.GetSlot() != slot) continue item = wep break } return item } TelsaSetup = function(ent) { local primary = GetItemInSlot(ent, 0) ent.ValidateScriptScope() local scope = ent.GetScriptScope() ::TeslaThink <- function() { //self is the weapon here local buttons = NetProps.GetPropInt(self, "m_nButtons") local buttons_changed = buttons_last ^ buttons local buttons_pressed = buttons_changed & buttons local buttons_released = buttons_changed & (~buttons) local eyepos_look = self.EyeAngles().Forward() local eyepos_start = self.EyePosition() + self.EyeAngles().Forward() local eyepos_end = self.EyePosition() + self.EyeAngles().Forward() * 600 local eyepos_altfire_end = self.EyePosition() + self.EyeAngles().Forward() * 9999 local primary = GetItemInSlot(self, 0) local primary_ammo_cur = NetProps.GetPropIntArray(self, "m_iAmmo", 1) local muzzle_origin = primary.GetAttachmentOrigin(primary.LookupAttachment("muzzle")) // local damage = null // local chain_damage = null local airblast_damage = null local damage_bonus = primary.GetAttribute("damage bonus", 1); local chain_damage_bonus = primary.GetAttribute("weapon burn dmg increased", 1); local airblast_damage_bonus = primary.GetAttribute("airblast pushback scale", 1); local index_primary = primary.entindex() if (ent_index != index_primary) { //printl("we dont have the wep anymore!") local scope = self.GetScriptScope() NetProps.SetPropString(self, "m_iszScriptThinkFunction", "") AddThinkToEnt(self, null) } damage = 17 * damage_bonus chain_damage = 12 * chain_damage_bonus airblast_damage = 250 * airblast_damage_bonus airblast_damage_total = airblast_damage // Initialize last hit times if needed if (typeof(time_last_hit) == "null") { time_last_hit = 0; // Initialize last attack time } if (typeof(time_zap_last_hit) == "null") { time_zap_last_hit = 0; // Initialize zap hit time } if (typeof(time_ammo_consume) == "null") { time_ammo_consume = 0; // Initialize zap hit time } if (typeof(time_particle_spawn) == "null") { time_particle_spawn = 0; // Initialize zap hit time } if (typeof(time_airblast_attack_hit) == "null") { time_airblast_attack_hit = 0; // Initialize zap hit time } if (typeof(time_airblast_rate) == "null") { time_airblast_rate = 0; // Initialize zap hit time } if (typeof(time_emit_sound) == "null") { time_emit_sound = 0; // Initialize zap hit time } local cur_time = Time(); // For some reason on raf servers, taunt cam is forced. Unforce it here. self.SetForcedTauntCam(0); // Get the player's active weapon local active_wep = self.GetActiveWeapon(); if (active_wep != primary) { return -1 } // Check if the primary fire button is pressed if (buttons & PRIMARY_FIRE && primary_ammo_cur > 0 && airblasting == false) { if ((time_ammo_consume + 0.1) <= cur_time) { NetProps.SetPropIntArray(self, "m_iAmmo", primary_ammo_cur - 1, 1) time_ammo_consume = cur_time } if ((time_particle_spawn + 0.2) <= cur_time) { // Generate a random number between 2 and 4 for how many times the zap will happen local random_count = RandomInt(2, 4); // Loop to run the zap initialization that many times for (local i = 0; i < random_count; i++) { // Get the current eye angles local eyelook = self.EyeAngles(); // Player's current angles (yaw, pitch, roll) // Convert the angles to radians for trigonometric calculations local yawRadians = eyelook.y * (PI / 180); local pitchRadians = eyelook.x * (PI / 180); // Calculate the forward direction (where the player is looking) local forwardVector = Vector(cos(pitchRadians) * cos(yawRadians), cos(pitchRadians) * sin(yawRadians), -sin(pitchRadians)); // Calculate the right direction (perpendicular to the forward direction in the horizontal plane) local rightVector = Vector(sin(yawRadians), -cos(yawRadians), 0); // Up direction is generally (0, 0, 1) in TF2, assuming no roll local upVector = Vector(0, 0, -2); // Define distances for movement in each direction (customizable) local rightDistance = 30; // Move 30 units to the right local upDistance = 10; // Move 10 units up local forwardDistance = 50; // Move 50 units forward // Calculate the final adjusted position by moving along each direction local adjustedPosition = eyepos_start + (rightVector * rightDistance) + (upVector * upDistance) + (forwardVector * forwardDistance); // Now, create the particle system at the new adjusted position local zap_init_attack = SpawnEntityFromTable("info_particle_system", { effect_name = "dxhr_lightningball_hit_zap_red", targetname = "bolt_zap_init_" + i, // Unique name for each particle origin = adjustedPosition, // Use the adjusted position angles = Vector(0, 0, 0) // Keep the angles the same (or adjust if needed) }); local soundlevel = (40 + (20 * log10(6000 / 36.0))).tointeger() if ((time_emit_sound + 0.5) <= cur_time) { local sound = RandomInt(1, 2) if (sound == 1) { EmitSoundEx ({ sound_name = "ambient/energy/weld1.wav", origin = self.GetOrigin(), sound_level = soundlevel }); } else { EmitSoundEx ({ sound_name = "ambient/energy/weld2.wav", origin = self.GetOrigin(), sound_level = soundlevel }); } time_emit_sound = cur_time } // Create the target entity at the original end position local targ_init_attack = SpawnEntityFromTable("info_target", { targetname = "zap_targ_init_" + i, // Unique name for each target spawnflags = 1, origin = eyepos_end, // Target remains at the original end position angles = Vector(0, 0, 0) // Angles can remain (0, 0, 0) }); // Set the orientation of the zap_init_attack to match the player's eye angles zap_init_attack.SetAbsAngles(eyelook); NetProps.SetPropEntityArray(zap_init_attack, "m_hControlPointEnts", targ_init_attack, 0); EntFireByHandle(zap_init_attack, "Start", "", 0.1, null, null); targ_init_attack.AcceptInput("setparent", "!activator", zap_init_attack, targ_init_attack); // zap_init_attack.AcceptInput("setparent", "!activator", self, self); EntFireByHandle(zap_init_attack, "Stop", "", 0.2, null, null); EntFireByHandle(zap_init_attack, "Kill", "", 0.3, null, null); EntFireByHandle(targ_init_attack, "Kill", "", 0.3, null, null); time_particle_spawn = cur_time } } //printl("Current time: " + cur_time); //printl("Time since last attack: " + time_last_hit); // Define the trace parameters local trace_zap = { start = eyepos_start, end = eyepos_end, hullmin = Vector(-10, -10, -10), // Bounding box min hullmax = Vector(10, 10, 10), // Bounding box max mask = MASK_VISIBLE_AND_NPCS, ignore = self // Ignore the current entity itself }; TraceHull(trace_zap); // DebugDrawLine_vCol(trace_zap.start, trace_zap.end, Vector(12, 111, 43), true, 0.2); // If we hit something, process the hit if (trace_zap.hit && trace_zap.enthit.GetClassname() in Damagable_Entities_List) { local enemy = trace_zap.enthit; // Check if the enemy is on the opposing team and if 0.3 seconds have passed if (enemy.GetTeam() != self.GetTeam() && (time_last_hit + 0.3) <= cur_time && enemy.GetTeam() != TEAM_SPECTATOR) { // Update the time of the last hit time_last_hit = cur_time; local crit_mult = CalculateCritFactor(self, enemy) // Apply damage to the enemy enemy.TakeDamageEx(primary, self, primary, Vector(0, 0, 0), enemy.GetOrigin(), damage * crit_mult, 1024); if (enemy.GetClassname() == "player") { enemy.AddCustomAttribute("SET BONUS: move speed set bonus", 0.7, 1.5) } // Create a new table for this enemy and nearby enemies local new_attack_table = []; new_attack_table.append(enemy); // Find surrounding enemies within a radius of 800 units and add to the new table for(local other_enemy; other_enemy = Entities.FindInSphere(other_enemy, enemy.GetOrigin(), 800);) { //no need for spectator check here since we check for if the ent has matching team if (other_enemy.GetClassname() in Damagable_Entities_List && other_enemy.GetTeam() == enemy.GetTeam() && !(other_enemy in new_attack_table)) { new_attack_table.append(other_enemy); // Add nearby enemy to the new table } } // Add the new attack table to the global attack table list global_attack_tables.append(new_attack_table); //printl("Created new attack table with enemies."); } } } // Check each table in global_attack_tables every 0.35 seconds if ((time_zap_last_hit + 0.35) <= cur_time) { // Iterate through each table in the global list of tables foreach (attack_table in global_attack_tables) { if (attack_table.len() > 0) { // Get the first entity in the current table local ent = attack_table[0]; if (ent) { // Perform the desired action on the entity //printl("Performing action on: " + ent.GetClassname()); local crit_mult = CalculateCritFactor(self, ent) // Example action: Apply damage ent.TakeDamageEx(primary, self, primary, Vector(0, 0, 0), ent.GetOrigin(), chain_damage * crit_mult, 1024); if (ent.GetClassname() == "player") { ent.AddCustomAttribute("SET BONUS: move speed set bonus", 0.7, 1.5) } local soundlevel = (40 + (20 * log10(3000 / 36.0))).tointeger() EmitSoundEx ({ sound_name = "npc/assassin/ball_zap1.wav", origin = ent.GetOrigin(), sound_level = soundlevel volume = RandomInt(0.3, 0.6) }); // Spawn the zapper_particle linked to the original enemy local zapper_particle = SpawnEntityFromTable("info_particle_system", { //dxhr_lightningball_hit_zap_red //arm_muzzleflash_zap // not exactly "eletricity" //underworld_skull_zap // probably gonna be annoying to look at after a while effect_name = "dxhr_lightningball_hit_zap_red", targetname = "bolt_zap", origin = ent.GetOrigin() + Vector(0, 0, 55), // Set the origin to the enemy's position angles = Vector(0, 0, 0) }); // Link the particle's control point to the enemy if (attack_table.len() > 1) { local targ = SpawnEntityFromTable("info_target", { targetname = "zap_targ", spawnflags = 1 origin = attack_table[1].GetOrigin() + Vector(0, 0, 55) angles = Vector(0, 0, 0) }) NetProps.SetPropEntityArray(zapper_particle, "m_hControlPointEnts", targ, 0); EntFireByHandle(targ, "Kill", "", 0.3, null, null); } // Execute entfires with appropriate timings EntFireByHandle(zapper_particle, "Start", "", 0.1, null, null); EntFireByHandle(zapper_particle, "Stop", "", 0.2, null, null); EntFireByHandle(zapper_particle, "Kill", "", 0.3, null, null); // Remove entity from the table after attacking to ensure it doesn't get attacked again attack_table.remove(0); //printl("Removed entity from the table: " + ent.GetClassname()); } // If the table is empty, remove it from the global list if (attack_table.len() == 0) { global_attack_tables.remove(0); //printl("Deleted empty attack table."); } } } // Update time for the zap action time_zap_last_hit = cur_time; } if (buttons_pressed & SECONDARY_FIRE && primary_ammo_cur >= 75 && (time_airblast_rate + 2.25) <= cur_time) { NetProps.SetPropIntArray(self, "m_iAmmo", primary_ammo_cur - 75, 1) airblasting = true tries = 4 // attacks 3 times time_airblast_rate = cur_time // needs to be here so that players cannot attack immediately after airblasting local soundlevel = (40 + (20 * log10(3000 / 36.0))).tointeger() EmitSoundEx ({ sound_name = "weapons/drg_wrench_teleport.wav", origin = self.GetOrigin(), sound_level = soundlevel delay = -1.5 }); EmitSoundEx ({ sound_name = "misc/halloween/spell_lightning_ball_cast.wav", origin = self.GetOrigin(), sound_level = soundlevel }); local area_to_zap = { start = eyepos_start, end = eyepos_altfire_end, hullmin = Vector(-10, -10, -10), // Bounding box min hullmax = Vector(10, 10, 10), // Bounding box max mask = (CONTENTS_SOLID|CONTENTS_MOVEABLE|CONTENTS_WINDOW|CONTENTS_GRATE), ignore = self // Ignore the current entity itself }; TraceHull(area_to_zap); if (area_to_zap.hit) { // Check if the hit entity is 'worldspawn' or another valid hit local hit_entity = area_to_zap.enthit; // Entity that was hit by the trace // If worldspawn or another solid object is hit, process the hit location if (hit_entity.GetClassname() == "worldspawn") { // Get the origin of the hit point local hit_position = area_to_zap.pos; // `pos` gives the exact location of the hit local check_pos = NavMesh.FindNavAreaAlongRay(hit_position, hit_position + Vector(0, 0, -50), null) if (check_pos == null) { //printl("Do not execute, not on ground!") return -1 } else { //printl("on ground") // DebugDrawCircle(hit_position, Vector(34, 144, 13), 0, 150, true, 3) local void_particle = SpawnEntityFromTable("info_particle_system", { effect_name = "npc_boss_bomb_aoewarn", targetname = "bolt_zap", origin = hit_position angles = Vector(0, 0, 0) }); // Execute entfires with appropriate timings EntFireByHandle(void_particle, "Start", "", 0.1, null, null); //EntFireByHandle(void_particle, "Stop", "", 0.2, null, null); EntFireByHandle(void_particle, "Kill", "", 3, null, null); for(local enemy; enemy = Entities.FindByClassnameWithin(enemy, "player", hit_position, 150);) { if (enemy.GetTeam() != self.GetTeam() && enemy.GetTeam() != TEAM_SPECTATOR) { if (enemy == null || enemy.InCond(5) || enemy.InCond(51 || enemy.InCond(14))) continue enemy_airblast_table.append(enemy); } } } //printl("Hit position: " + hit_position); // Debug draw the hit box at the exact hit position // DebugDrawBox(hit_position, Vector(-10, -10, -10), Vector(10, 10, 10), 133, 43, 145, 0, 3); // // Optional debug line to visualize the trace // DebugDrawLine_vCol(eyepos_start, eyepos_altfire_end, Vector(34, 44, 133), true, 3); // DebugDrawLine_vCol(hit_position, hit_position + Vector(0, 0, -50), Vector(34, 44, 133), true, 3); } } } if (airblasting == true) { if (enemy_airblast_table.len() == 0) { //printl("no enemy found") if ((time_airblast_rate + 2.25) <= cur_time) { airblasting = false EmitSoundOn("player/recharged.wav", self) time_airblast_rate = cur_time airblast_damage_total = airblast_damage; } } foreach (ent in enemy_airblast_table) { if (enemy_airblast_table.len() > 1) { airblast_damage_total = airblast_damage_total / 2 //too many ents will lead to weird nums; cap damage minimum to 20 if (airblast_damage_total < 20) { airblast_damage_total = 20 } //printl(airblast_damage_total) } } // Iterate through the enemy_airblast_table foreach (enemy_entry in enemy_airblast_table) { // Check if 0.35 seconds have passed since the last zap if ((time_airblast_attack_hit + 1) <= cur_time) { // Inner loop that processes actions for each enemy for (local i = 0; i < tries; i++) { // Perform the action on all enemies in the table foreach (enemy_entry in enemy_airblast_table) { if (NetProps.GetPropInt(enemy_entry, "m_lifeState") != 0) { continue } if (enemy_airblast_table.len() == 1) { local single_target_expl = SpawnEntityFromTable("info_particle_system", { effect_name = "heavy_ring_of_fire", targetname = "explode_single_targ", origin = Vector(0, 0, 0) angles = Vector(0, 180, 180) }); // Execute entfires with appropriate timings single_target_expl.SetOrigin(enemy_entry.GetOrigin()) EntFireByHandle(single_target_expl, "Start", "", 0.1, null, null); EntFireByHandle(single_target_expl, "Stop", "", 0.2, null, null); EntFireByHandle(single_target_expl, "Kill", "", 0.3, null, null); //weapons\crit_power.wav //DispatchParticleEffect("heavy_ring_of_fire", enemy_entry.GetOrigin(), Vector(0, 0, 0)) local soundlevel = (40 + (20 * log10(6000 / 36.0))).tointeger() EmitSoundEx ({ sound_name = "misc/halloween/spell_meteor_impact.wav", origin = enemy_entry.GetOrigin(), sound_level = soundlevel }); } local sound_impact = (40 + (20 * log10(1000 / 36.0))).tointeger() local thunder_strike_particle = SpawnEntityFromTable("info_particle_system", { effect_name = "wrenchmotron_teleport_beam", targetname = "bolt_zap_airblast", origin = Vector(0, 0, 0) angles = Vector(0, 180, 180) }); EmitSoundEx ({ sound_name = "misc/halloween/spell_spawn_boss.wav", origin = enemy_entry.GetOrigin(), sound_level = sound_impact volume = 1 }); NetProps.SetPropEntityArray(thunder_strike_particle, "m_hControlPointEnts", enemy_entry, 0); // Execute entfires with appropriate timings thunder_strike_particle.SetOrigin(enemy_entry.GetOrigin() + Vector(0, 0, 1000)) EntFireByHandle(thunder_strike_particle, "Start", "", 0.1, null, null); EntFireByHandle(thunder_strike_particle, "Stop", "", 0.2, null, null); EntFireByHandle(thunder_strike_particle, "Kill", "", 0.3, null, null); local crit_mult = CalculateCritFactor(self, enemy_entry) enemy_entry.TakeDamageEx(primary, self, primary, Vector(0, 0, 0), enemy_entry.GetOrigin(), airblast_damage_total * crit_mult, 1024); } // Decrease the number of tries tries--; // Check if this is the last try if (tries == 0) { // On the last try, remove all enemies from the table enemy_airblast_table.clear(); // Clears the entire table // Reset airblast_damage_total to airblast_damage airblast_damage_total = airblast_damage; time_airblast_rate = cur_time airblasting = false // Exit the loop since all enemies have been removed break; } } // Update the last hit time for the zap time_airblast_attack_hit = cur_time; } } } buttons_last = buttons; return -1; } // Initial setup ent.SetForcedTauntCam(1) scope.buttons_last <- 0 scope.time_last_hit <- 0 scope.time_ammo_consume <- 0 scope.time_zap_last_hit <- 0 scope.time_particle_spawn <- 0 scope.time_airblast_attack_hit <- 0 scope.time_airblast_rate <- 0 scope.time_emit_sound <- 0 scope.chain_damage <- 0 scope.damage <- 0 scope.tries <- 0 scope.airblasting <- false scope.enemy_airblast_table <- [] scope.airblast_damage_total <- 0 scope.CalculateCritFactor <- CalculateCritFactor scope.Damagable_Entities_List <- { "player" : 1 "obj_teleporter" : 1 "obj_sentrygun" : 1 "obj_dispenser" : 1 "tank_boss" : 1 } // Initialize the global attack tables list scope.global_attack_tables <- [] scope.PrintTable <- PrintTable scope.DoPrintTable <- DoPrintTable scope.GetItemInSlot <- GetItemInSlot scope.ent_index <- primary.entindex() AddThinkToEnt(ent, "TeslaThink") } OnGameEvent_player_spawn = function(params) { local player = GetPlayerFromUserID(params.userid) player.ValidateScriptScope() local playerscope = player.GetScriptScope() local primary = GetItemInSlot(player, 0) local weapon_id = NetProps.GetPropInt(primary, STRING_NETPROP_ITEMDEF) //printl(primary) } OnGameEvent_post_inventory_application = function(params) { local player = GetPlayerFromUserID(params.userid) player.ValidateScriptScope() local playerscope = player.GetScriptScope() local primary = GetItemInSlot(player, 0) //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(Tesla_Flamethrower_Script)