local _root = getroottable() local gamerules = FindByClassname(null, "tf_gamerules") function IncludeScriptInFile(path) { try IncludeScript(format("scrapyard_expert/%s", path), _root) catch(e) printl(e) } function IncludeWave1() { IncludeScriptInFile("nanoboost_bot.nut") IncludeScriptInFile("pyro_bulwark_rework.nut") EntFireByHandle(gamerules, "RunScriptCode", "ClientPrintSafe(null, `^d80e0eThe sinners have risen to destroy EVERYTHING!^`)", 0, null, null) EntFireByHandle(gamerules, "RunScriptCode", "ClientPrintSafe(null, `^d80e0eTheir robotic forms makes them ironclad! Be wary of ^d8b00ewhat class they are!^^`)", 5, null, null) EntFireByHandle(gamerules, "RunScriptCode", "ClientPrintSafe(null, `^99CCFFSnipers^^d80e0e this wave will provide allies with a 50% damage bonus and 50% damage resistence, fully restore their health and 300 additional overhealth!^`)", 10, null, null) } function IncludeWave2() { IncludeScriptInFile("baseball_fireball_rain.nut") IncludeScriptInFile("tele_charge_bot_scrapyard.nut") IncludeScriptInFile("bulwark_exp_wave2.nut") EntFireByHandle(gamerules, "RunScriptCode", "ClientPrintSafe(null, `^d80e0eSightings of ^^99CCFFDemoknights^^d80e0e who obey the ^^9e22f8Horseless Headless Horsemann^^d80e0e have been reported!^`)", 0, null, null) EntFireByHandle(gamerules, "RunScriptCode", "ClientPrintSafe(null, `^d80e0eThey have as such obtained a Teleport ability, and will deal 1/4 of your max health in damage!^`)", 5, null, null) } function IncludeWave3() { IncludeScriptInFile("spawn_deployer.nut") Convars.SetValue("tf_halloween_bot_quit_range", 10000) Convars.SetValue("tf_halloween_bot_chase_duration", 9999) Convars.SetValue("tf_halloween_bot_chase_range", 9999) Convars.SetValue("tf_halloween_bot_health_per_player", 0) PopExt.AddCustomIcon("horsemann_lite", 1, false, true, false, false) PopExt.AddRobotTag("bot_horseman", { OnDeath = function(bot, tag) { PopExt.DecrementWaveIconSpawnCount("horsemann_lite",MVM_CLASS_FLAG_MINIBOSS,0) } }) EntFireByHandle(gamerules, "RunScriptCode", "ClientPrintSafe(null, `^9e22f8The Horseless Headless Horsemann^^d80e0e is on his way...^`)", 0, null, null) } function IncludeWave4() { IncludeScriptInFile("marauder_logic.nut") EntFireByHandle(gamerules, "RunScriptCode", "ClientPrintSafe(null, `^d80e0eOh no....^`)", 0, null, null) } function PrintTankHealth() { for (local player; player = FindByClassname(player, "player");) { EntFireByHandle(player, "RunScriptCode", ClientPrint(player, 3, "Tank spawned with 18,000 Health!"), 0, player, player) } } ::ClientPrintSafe <- function(player, text) { //replace ^ with \x07 at run-time local escape = "^" //just use the normal print function if there's no escape character if (!startswith(text, escape)) { ClientPrint(player, 3, text) return; } //split text at the escape character local splittext = split(text, escape) //remove 0-length strings for (local i = splittext.len() - 1; i >= 0; i--) if (splittext[i].len() < 1) splittext.remove(i); //format into new string local formatted = "" foreach (i, t in splittext) formatted += format("\x07%s", t) //print formatted string ClientPrint(player, 3, formatted) } //HHH Logic //This is the only way we can detect when HHH takes damage and also interact with the bot that controls the healthbar function OnScriptHook_OnTakeDamage(params) { local victim = params.const_entity local attacker = params.attacker local damage = params.damage local dmgtype = params.damage_type local dmgbonus = params.damage_bonus //check if HHH was hurt; if so, damage the bot with the tag for (local boss; boss = FindByClassname(boss, "headless_hatman");) { if (!boss.IsValid()) continue if (victim == boss) { for(local bot; bot = FindByClassname(bot, "player");) { if (!bot.IsBotOfType(TF_BOT_TYPE)) continue if (bot.IsBotOfType(TF_BOT_TYPE)) { if (bot.HasBotTag("bot_horseman")) { //this really sucks but we have to do it if (attacker.InCond(11) || attacker.InCond(34) || attacker.InCond(44)) { // ^ Kritzkrieg, Canteen, MMMph (do flames even hit HHH???), bot.RemoveCondEx(5, true) bot.TakeDamage(damage * 3, 16, boss) bot.AddCondEx(5, 99999, null) } else if (attacker.InCond(16) || attacker.InCond(19)) { // ^ Buff Banner, Cola/Steak bot.RemoveCondEx(5, true) bot.TakeDamage(damage * 1.35, 16, boss) bot.AddCondEx(5, 99999, null) } else { bot.RemoveCondEx(5, true) bot.TakeDamage(damage, 16, boss) bot.AddCondEx(5, 99999, null) } } } } } } } function SpawnHHH() { local hatman = SpawnEntityFromTable("headless_hatman", { targetname = "marvin" }) hatman.SetHealth(10000) hatman.SetCollisionGroup(COLLISION_GROUP_PUSHAWAY) hatman.SetOrigin(Vector(223, 285, -577)) hatman.SetAngles(180, 0, 0) //hatman.SetModelSimple("models/bots/headless_hatman_burnt.mdl") for (local boss; boss = FindByClassname(boss, "headless_hatman");) { if (!boss.IsValid()) continue for(local bot; bot = FindByClassname(bot, "player");) { if (!bot.IsBotOfType(TF_BOT_TYPE)) continue if (bot.IsBotOfType(TF_BOT_TYPE)) { if (bot.HasBotTag("bot_horseman")) { bot.Teleport(true, Vector(4364, 2404, -175.0), false, QAngle(), false, Vector(0, 0, 0)) bot.AddCondEx(64, 99999, null) //stop HHH from targeting bot.AddCondEx(5, 99999, null) // no dmg from players // bot.AddCustomAttribute("dmg taken increased", 0, -1) } } } } }