public static void nukeDetonation(Entity owner, bool isStreak) { nukeOffsetScalar = 1;//Reset the scalar if (isStreak && owner != null && AIZ.isPlayer(owner)) { int total = botsInPlay.Count; owner.SetField("cash", owner.GetField <int>("cash") + (100 * total)); hud.scorePopup(owner, 100 * total); hud.scoreMessage(owner, AIZ.gameStrings[208]); } if (isStreak) { nukeOffsetScalar = 0; //AfterDelay(50, () => nukeOffsetScalar = 1); } bonusDrops.onNuke(); AfterDelay(500, () => killstreaks.nukeInbound = false); //Testing /* * SetDvar("fixedtime", 2); * SetSlowMotion(1, 0.5f, .4f); * AfterDelay(500, () => SetSlowMotion(.5f, 1, .5f)); * AfterDelay(1000, () => SetDvar("fixedtime", 0)); */ }
private static IEnumerator giveDeathMachine(Entity player) { player.GiveWeapon("iw5_pecheneg_mp_thermal_rof"); StartAsync(AIZ.switchToWeapon_delay(player, "iw5_pecheneg_mp_thermal_rof", .2f)); player.DisableWeaponSwitch(); player.AllowAds(false); player.SetPerk("specialty_rof", true, false); player.SetClientDvar("perk_weapRateMultiplier", "0.5"); player.SetField("hasAlteredROF", true); //player.SetPerk("specialty_bulletaccuracy", true, false); //player.SetClientDvar("ui_drawCrosshair", "0"); player.SetSpreadOverride(1); yield return(Wait(30)); if (AIZ.isPlayer(player) && player.IsAlive) { if (!player.GetField <bool>("perk5bought")) { player.UnSetPerk("specialty_rof", true); } //player.UnSetPerk("specialty_bulletaccuracy", true); //player.SetClientDvar("ui_drawCrosshair", "1"); player.TakeWeapon("iw5_pecheneg_mp_thermal_rof"); player.SwitchToWeapon(player.GetField <string>("lastDroppableWeapon")); player.EnableWeaponSwitch(); player.AllowAds(true); player.ResetSpreadOverride(); } }
public static void checkForEndRound() { if (botUtil.botsInPlay.Count == 0 && botUtil.botsForWave == botUtil.spawnedBots) { if (Wave == totalWaves) { AIZ.zState = "ended"; StartAsync(hud.endGame(true)); return; } //g_AIZ.zState = "intermission"; AfterDelay(100, () => AIZ.startIntermission()); foreach (Entity players in Players) { if (AIZ.isPlayer(players) && players.HasField("isDown") && !players.GetField <bool>("isDown") && (!AIZ.isHellMap || (AIZ.isHellMap && killstreaks.visionRestored))) { players.VisionSetNakedForPlayer(AIZ.vision); } if (AIZ.isPlayer(players)) { players.PlayLocalSound("mp_bonus_start"); players.PlayLocalSound("US_1mc_encourage_win"); } if (isCrawlerWave || isBossWave) { AIZ.giveMaxAmmo(players); } } } //if (!e_hud.stringsCleared && !isBossWave && Wave > 4 && f_botUtil.botsInPlay.Count < 10 && f_botUtil.botsForWave - f_botUtil.spawnedBots == 0) StartAsync(e_hud.clearAllGameStrings()); checkForCompass(); }
private static void checkForHellMapVision() { if (AIZ.isHellMap) { foreach (Entity player in Players) { if (AIZ.isPlayer(player) && player.HasField("isDown") && !player.GetField <bool>("isDown") && !killstreaks.visionRestored) { player.VisionSetNakedForPlayer(AIZ.hellVision); } } } }
private static void giveRandomPerkToAll() { foreach (Entity player in Players) { if (!AIZ.isPlayer(player) || !player.IsAlive || !player.HasField("isDown")) { continue; } int perk = AIZ.rng.Next(7); perk++; //Log.Write(LogLevel.All, "Giving perk {0}", perk); StartAsync(giveRandomPerk(player, perk)); } }
public static IEnumerator doNuke(Entity bonus) { PhysicsExplosionSphere(bonus.Origin, 5000000, 5000000, 10); Entity fx = SpawnFX(AIZ.fx_nuke, bonus.Origin); TriggerFX(fx); AfterDelay(5000, () => fx.Delete()); fx.PlaySound("exp_suitcase_bomb_main"); botUtil.nukeDetonation(null, false); bonus.Delete(); yield return(Wait(3.5f)); foreach (Entity players in Players) { if (!AIZ.isPlayer(players) || !players.IsAlive || !players.HasField("cash")) { continue; } if (botUtil.doublePointsTime > 0) { players.SetField("cash", players.GetField <int>("cash") + 800); hud.scorePopup(players, 800); } else { players.SetField("cash", players.GetField <int>("cash") + 400); hud.scorePopup(players, 400); } hud.scoreMessage(players, AIZ.gameStrings[208]); } //Testing //SetSlowMotion(1, 0.5f, .4f); //AfterDelay(1000, () => SetSlowMotion(.5f, 1, 1)); }
private static void doBotDamage(int damage, Entity player, string weapon, Entity botHitbox, string MOD, Vector3 point, bool skipFeedback = false) { int hitDamage; if (AIZ.weaponIsUpgrade(weapon)) { hitDamage = damage / 2; //Base upgraded damage } else if (AIZ.isHellMap) { hitDamage = damage / 2; //Hellmap damage } else { hitDamage = damage / (1 + ((int)roundSystem.Wave / 2)); //Base damage } if (MOD == "MOD_MELEE") { hitDamage = damage / (((int)roundSystem.Wave + 1) / 2); //Melee damage } if (weapon == "iw5_p99_mp_tactical_xmags" && MOD == "MOD_MELEE") { hitDamage = 350; //P99 Upgraded damage } if (weapon == "iw5_riotshield_mp") { hitDamage = damage * 2; //Upgraded shield } if (AIZ.isWeaponDeathMachine(weapon)) { hitDamage = damage * 4; } if (MOD != "MOD_MELEE") { if (weapon.Contains("iw5_deserteagle_mp") || weapon == "at4_mp" || weapon.Contains("iw5_44magnum_mp") || weapon.StartsWith("iw5_mp412")) { hitDamage = damage; //Specials damage } //Weapon tweaks if (AIZ.isSniper(weapon) || weapon.Contains("iw5_dragunov_mp")) { hitDamage = (damage *= 2); //Sniper damage } if (AIZ.isShotgun(weapon)) { hitDamage = (int)(hitDamage * 4f); //Shotgun multiplier } if (weapon == "gl_mp") { hitDamage = 10000; //GL } else if (weapon == "iw5_xm25_mp") { hitDamage = damage; } else if (weapon == "xm25_mp") { hitDamage = damage * 2; } else if (weapon == "iw5_mk14_mp") { hitDamage *= 2; } else if (weapon.StartsWith("iw5_mk14_mp_reflex_xmags_camo11")) { hitDamage *= 3; } else if (weapon == "iw5_1887_mp_camo11") { hitDamage = 100; } else if (weapon == "iw5_mk12spr_mp_acog_xmags") { hitDamage = 500; //Heli Sniper damage } //if (weapon == "uav_strike_missile_mp") hitDamage = damage;//Thundergun } if (MOD == "MOD_HEADSHOT") { hitDamage *= 3; } else if (MOD == "MOD_PASSTHRU") { hitDamage = damage; //Script usage } else if ((MOD == "MOD_EXPLOSIVE" || MOD == "MOD_GRENADE_SPLASH") && botHitbox.GetField <int>("damageTaken") >= botHitbox.GetField <int>("currentHealth") * 0.7f && botHitbox.GetField <Entity>("parent").HasField("head")) { botToCrawler(botHitbox); } if (instaKillTime > 0 && !botHitbox.HasField("isBoss")) { botHitbox.SetField("damageTaken", botHitbox.GetField <int>("currentHealth")); } else { botHitbox.SetField("damageTaken", botHitbox.GetField <int>("damageTaken") + hitDamage); } if ((botHitbox.GetField <int>("damageTaken") >= botHitbox.GetField <int>("currentHealth") * 0.85f && MOD == "MOD_HEADSHOT" && botHitbox.GetField <Entity>("parent").HasField("head")) || (instaKillTime > 0 && botHitbox.GetField <Entity>("parent").HasField("head"))) { Entity head = botHitbox.GetField <Entity>("parent").GetField <Entity>("head"); head.Hide(); botHitbox.GetField <Entity>("parent").GetField <Entity>("headHitbox").SetCanDamage(false); PlayFX(AIZ.fx_headshotBlood, head.Origin); if (instaKillTime == 0) { OnInterval(1000, () => runBotBleedout(player, botHitbox)); } } if (!AIZ.isPlayer(player) || !player.HasField("isDown")) { return; } if (!botHitbox.GetField <Entity>("parent").GetField <bool>("primedForNuke")) { int pointGain = 10; if (doublePointsTime > 0) { pointGain *= 2; } if (MOD != "MOD_PASSTHRU") { player.SetField("cash", player.GetField <int>("cash") + pointGain); hud.scorePopup(player, pointGain); } AIZ.addRank(player, pointGain); } if (skipFeedback || !AIZ.isPlayer(player) || !player.HasField("hud_damageFeedback")) { return; } HudElem combatHighFeedback = player.GetField <HudElem>("hud_damageFeedback"); combatHighFeedback.Alpha = 1; player.PlayLocalSound("MP_hit_alert"); combatHighFeedback.FadeOverTime(1); combatHighFeedback.Alpha = 0; }
public static void onBotDamage(Entity hitbox, Parameter damage, Parameter attacker, Parameter direction_vec, Parameter point, Parameter meansOfDeath, Parameter modelName, Parameter partName, Parameter tagName, Parameter iDFlags, Parameter weapon, bool isCrawler, bool isBoss) { if ((string)weapon == "iw5_usp45_mp_akimbo_silencer02" || AIZ.isRayGun((string)weapon)) { return; } Entity currentBot = hitbox.GetField <Entity>("parent"); if (!botsInPlay.Contains(currentBot)) { return; } Entity player = (Entity)attacker; if ((string)weapon == "remote_uav_weapon_mp" && attacker.As <Entity>().HasField("owner"))//UAV tweaks { player = attacker.As <Entity>().GetField <Entity>("owner"); meansOfDeath = "MOD_PASSTHRU"; damage = 50; } else if ((string)weapon == "sentry_minigun_mp")//Sentry tweaks { player = attacker.As <Entity>().GetField <Entity>("owner"); meansOfDeath = "MOD_PASSTHRU"; damage = 10; } else if ((string)weapon == "manned_gl_turret_mp")//Sentry tweaks { player = attacker.As <Entity>().GetField <Entity>("owner"); meansOfDeath = "MOD_PASSTHRU"; damage = 300; } else if ((string)weapon == "remote_tank_projectile_mp" || (string)weapon == "uav_strike_projectile_mp") { player = attacker.As <Entity>().GetField <Entity>("owner"); meansOfDeath = "MOD_PASSTHRU"; } else if ((string)weapon == "ac130_25mm_mp")//A10 tweaks { //player = attacker.As<Entity>().GetField<Entity>("owner"); meansOfDeath = "MOD_PASSTHRU"; } //Utilities.PrintToConsole((string)meansOfDeath); if ((string)meansOfDeath == "MOD_BLEEDOUT") { Vector3 org = currentBot.GetTagOrigin("j_head"); PlayFX(AIZ.fx_headshotBlood, org); doBotDamage((int)damage, player, (string)weapon, hitbox, (string)meansOfDeath, point.As <Vector3>(), true); } else { if ((string)weapon != "sentry_minigun_mp" && (string)weapon != "manned_gl_turret_mp" && (string)weapon != "remote_uav_weapon_mp" && (string)meansOfDeath != "MOD_EXPLOSIVE_BULLET") { PlayFX(AIZ.fx_blood, point.As <Vector3>()); //Only play FX if the weapon isn't a script weapon } doBotDamage((int)damage, player, (string)weapon, hitbox, (string)meansOfDeath, point.As <Vector3>()); } string botState = currentBot.GetField <string>("state"); if (botState != "hurt" && botState != "attacking" && (string)meansOfDeath != "MOD_BLEEDOUT") { if (!isCrawler && !isBoss) { playAnimOnBot(currentBot, getHurtAnim(hitbox)); } else if (isBoss) { playAnimOnBot(currentBot, anim_runHurt); } currentBot.SetField("state", "hurt"); AfterDelay(500, () => currentBot.SetField("state", "post_hurt")); } updateBotLastActiveTime(currentBot); if (hitbox.GetField <int>("damageTaken") >= hitbox.GetField <int>("currentHealth")) { currentBot.SetField("isAlive", false); if (currentBot.HasField("isOnCompass") && currentBot.GetField <bool>("isOnCompass")) { /* * Objective_Delete(currentBot.GetField<int>("compassID")); * h_mapEdit._objIDList[currentBot.GetField<int>("compassID")] = false; * h_mapEdit._objIDs.Remove(currentBot); * currentBot.ClearField("compassID"); */ mapEdit.removeObjID(currentBot); currentBot.SetField("isOnCompass", false); } hitbox.SetCanDamage(false); hitbox.SetCanRadiusDamage(false); hitbox.SetModel("tag_origin");//Change model to avoid the dead bot's hitbox blocking shots //if (isBoss) hitbox.Delete(); if (AIZ.isPlayer(player)) { if (currentBot.HasField("primedForNuke") && !currentBot.GetField <bool>("primedForNuke")) { int pointGain = 50; if ((string)meansOfDeath == "MOD_HEADSHOT") { pointGain = 100; } if ((string)meansOfDeath == "MOD_MELEE") { pointGain = 130; } if (doublePointsTime > 0) { pointGain *= 2; } if ((string)meansOfDeath != "MOD_PASSTHRU") { player.SetField("cash", player.GetField <int>("cash") + pointGain); hud.scorePopup(player, pointGain); } AIZ.addRank(player, pointGain); } player.Kills++; if (player.HasField("aizHud_created")) { player.SetField("points", player.GetField <int>("points") + 1); HudElem pointNumber = player.GetField <HudElem>("hud_pointNumber"); pointNumber.SetValue(player.GetField <int>("points")); } killstreaks.checkKillstreak(player); } currentBot.MoveTo(currentBot.Origin, 0.05f); if (isCrawler || currentBot.HasField("hasBeenCrippled")) { playAnimOnBot(currentBot, crawlerAnim_death); } else { //Log.Write(LogLevel.All, (string)meansOfDeath); /* * if ((string)meansOfDeath == "MOD_EXPLOSIVE" || (string)meansOfDeath == "MOD_GRENADE_SPLASH") * { * currentBot.Angles = VectorToAngles(point.As<Vector3>() - currentBot.Origin); * int randomAnim = g_AIZ.rng.Next(anim_death_explode.Length); * currentplayAnimOnBot(bot, anim_death_explode[randomAnim]); * } * else */ //{ int randomAnim = AIZ.rng.Next(anim_deaths.Length); playAnimOnBot(currentBot, anim_deaths[randomAnim]); //} } if (currentBot.HasField("hasBeenCrippled")) { currentBot.ClearField("hasBeenCrippled"); } if (isCrawler) { AfterDelay(500, () => currentBot.MoveTo(currentBot.Origin + new Vector3(0, 0, 2500), 5)); } AfterDelay(5000, () => despawnBot(currentBot, isCrawler, isBoss)); botsInPlay.Remove(currentBot); onBotUpdate(); roundSystem.checkForEndRound(); if (isCrawler && roundSystem.isCrawlerWave && (botsInPlay.Count == 0 && botsForWave == spawnedBots) && perkDropsEnabled && AIZ.isHellMap) { bonusDrops.spawnBonusDrop(bonusDrops.dropTypes.perk, currentBot.Origin); return; } if (!isBoss) { bonusDrops.dropTypes bonusType = bonusDrops.checkForBonusDrop(); if (bonusType != bonusDrops.dropTypes.none) { bonusDrops.spawnBonusDrop(bonusType, currentBot.Origin); } } } }
//private readonly static Entity level = Entity.GetEntity(2046); public static void startNextRound() { checkForEndGame();//Before we start, make sure there are players to start Wave++; //MakeDvarServerInfo("sv_privateClientsForClients", Wave);//Set round number to private client display //foreach (Entity players in Players) //if (AIZ.isPlayer(players) && players.HasField("isDown")) players.SetField("currentRound", Wave); //level.Notify("round_changed"); botUtil.spawnedBots = 0; isCrawlerWave = Wave % 5 == 0 && !isBossWave; isBossWave = Wave % 10 == 0; if (isBossWave) { botUtil.botsForWave = bossCount; if (bossCount == 1) { bossCount = 5; } else { bossCount += 5; } foreach (Entity players in Players) { if (AIZ.isPlayer(players) && players.HasField("isDown") && !players.GetField <bool>("isDown")) { players.VisionSetNakedForPlayer(AIZ.bossVision); } } } else if (isCrawlerWave) { //e_hud.stringsCleared = false; botUtil.botsForWave = crawlerCount; crawlerCount += 25; if (Wave != 5) { botUtil.crawlerHealth += 250; } } else//isNormalWave { botUtil.botsForWave = 10 * Wave; if (Wave != 1) { botUtil.health += botUtil.healthScalar; } } if (!isBossWave) { hud.stringsCleared = false; } checkForHellMapVision(); OnInterval(500, botUtil.startBotSpawn); onRoundChange(); AIZ.zState = "ingame"; foreach (Entity players in Players) { if (AIZ.isPlayer(players) && players.HasField("isDown")) { players.PlayLocalSound("mp_bonus_end"); int randomStart = AIZ.rng.Next(8); string sound = ""; switch (randomStart) { case 0: sound = "US_1mc_fightback"; break; case 1: sound = "US_1mc_goodtogo"; break; case 2: sound = "US_1mc_holddown"; break; case 3: sound = "US_1mc_keepfighting"; break; case 4: sound = "US_1mc_pushforward"; break; case 5: sound = "US_1mc_readytomove"; break; case 6: sound = "US_1mc_positions_lock"; break; case 7: sound = "US_1mc_security_complete"; break; } players.PlayLocalSound(sound); } } }