Ejemplo n.º 1
0
        private static void updateThrusterBar(Entity player, int percentage)
        {
            HudElem thrusterBar = player.GetField <HudElem>("hud_thrusterBar");

            thrusterBar.FadeOverTime(1);
            thrusterBar.Alpha = 1;
            thrusterBar.Parent.FadeOverTime(.5f);
            thrusterBar.Parent.Alpha = .2f;
            thrusterBar.ScaleOverTime(.5f, percentage * 4, 3);
            AfterDelay(2000, () =>
            {
                int thrusterEnergy = player.GetField <int>("thrusterEnergy");
                if (thrusterEnergy >= 25)
                {
                    //HudElem thrusterBar = p.GetField<HudElem>("hud_thrusterBar");
                    if (thrusterBar.Alpha == 1)
                    {
                        thrusterBar.FadeOverTime(.5f);
                        thrusterBar.Alpha = 0;
                        thrusterBar.Parent.FadeOverTime(1);
                        thrusterBar.Parent.Alpha = 0;
                    }
                }
            });
        }
Ejemplo n.º 2
0
    private static void closeTestMenu(Entity player)
    {
        player.AllowAds(true);
        player.AllowJump(true);
        player.AllowSprint(true);
        player.SetMoveSpeedScale(1);
        player.EnableOffhandWeapons();
        player.EnableUsability();
        player.EnableWeaponPickup();
        player.EnableWeapons();
        player.EnableWeaponSwitch();
        //player.SetClientDvar("ui_drawCrosshair", "1");
        player.SetClientDvar("g_hardcore", "0");
        player.SetClientDvar("g_scriptMainMenu", "class");
        player.ClearField("hoveredButton");

        HudElem cursor = player.GetField <HudElem>("cursor");

        cursor.FadeOverTime(.25f);
        cursor.Alpha = 0;

        foreach (HudElem hud in player.GetField <List <HudElem> >("menu"))
        {
            hud.FadeOverTime(.25f);
            hud.Alpha = 0;
            AfterDelay(250, () => hud.Destroy());
        }
        foreach (Button button in Button.menuButtons)
        {
            button.hud       = null;
            button.isHovered = false;
        }

        player.SetField("menuOpen", false);
    }
Ejemplo n.º 3
0
    private static void destroyEmoteMenu(Entity player)
    {
        if (!player.GetField <bool>("emoteMenuOpen"))
        {
            return;
        }

        if (!player.HasField("emoteMenu"))
        {
            return;
        }

        HudElem bg = player.GetField <HudElem>("emoteMenu");

        foreach (HudElem child in bg.Children)
        {
            child.FadeOverTime(.25f);
            child.Alpha = 0;
            AfterDelay(250, child.Destroy);
        }

        bg.FadeOverTime(.25f);
        bg.Alpha = 0;
        AfterDelay(250, bg.Destroy);

        AfterDelay(250, () =>
        {
            player.ClearField("emoteMenu");
            player.SetField("emoteMenuOpen", false);
        });
    }
Ejemplo n.º 4
0
        private static void updateWeaponName(Entity player, string weapon)
        {
            HudElem weaponName = player.GetField <HudElem>("hud_weaponName");

            weaponName.Alpha = 1;
            weaponName.SetText(getWeaponName(player, weapon));
            AfterDelay(1000, () =>
            {
                weaponName.FadeOverTime(1);
                weaponName.Alpha = 0;
            });
        }
Ejemplo n.º 5
0
        public static IEnumerator updateWeaponName(Entity player, string weapon)
        {
            if (!player.HasField("hud_created"))
            {
                yield break;
            }
            HudElem weaponName = player.GetField <HudElem>("hud_weaponName");

            weaponName.FadeOverTime(0);
            weaponName.Alpha = 0;
            weaponName.SetText(getWeaponName(weapon));
            weaponName.MoveOverTime(0);
            weaponName.X = -240;
            weaponName.FadeOverTime(.5f);
            weaponName.Alpha = 1;
            weaponName.MoveOverTime(.5f);
            weaponName.X = -180;
            yield return(Wait(1));

            weaponName.FadeOverTime(1);
            weaponName.Alpha = 0;
        }
Ejemplo n.º 6
0
        private static void ShotFiredDarkScreenOverlay(Entity player)
        {
            HudElem darkScreenOverlay = NewClientHudElem(player);

            darkScreenOverlay.X         = 0;
            darkScreenOverlay.Y         = 0;
            darkScreenOverlay.AlignX    = HudElem.XAlignments.Left;
            darkScreenOverlay.AlignY    = HudElem.YAlignments.Top;
            darkScreenOverlay.HorzAlign = HudElem.HorzAlignments.Fullscreen;
            darkScreenOverlay.VertAlign = HudElem.VertAlignments.Fullscreen;
            darkScreenOverlay.SetShader("black", 640, 480);
            darkScreenOverlay.Sort  = -10;
            darkScreenOverlay.Alpha = 1;

            AfterDelay(1000, () =>
            {
                darkScreenOverlay.FadeOverTime(1);
                darkScreenOverlay.Alpha = 0;
                AfterDelay(500, () => darkScreenOverlay.Destroy());
            });
        }
Ejemplo n.º 7
0
        public static void giveAllPerks(Entity player)
        {
            bool[] ownedPerks = AIZ.getOwnedPerks(player);
            if (!ownedPerks.Contains(false))
            {
                return;                             //Owns all perks, give up on life...
            }
            if (!ownedPerks[0])
            {
                player.MaxHealth = 250;
                player.Health    = player.MaxHealth;
                player.SetField("PerkBought", "cardicon_juggernaut_1");
                player.SetField("perk1bought", true);
                hud.updatePerksHud(player, false, true);
            }
            if (!ownedPerks[1])
            {
                player.SetPerk("specialty_lightweight", true, true);
                //player.SetPerk("specialty_marathon", true, true);
                player.SetPerk("specialty_longersprint", true, true);
                player.SetField("PerkBought", "specialty_longersprint_upgrade");
                player.SetField("perk2bought", true);
                hud.updatePerksHud(player, false, true);
            }
            if (!ownedPerks[2])
            {
                player.SetPerk("specialty_fastreload", true, true);
                //player.SetPerk("specialty_quickswap", true, true);
                player.SetPerk("specialty_quickdraw", true, true);
                player.SetField("PerkBought", "specialty_fastreload_upgrade");
                player.SetField("perk3bought", true);
                hud.updatePerksHud(player, false, true);
            }
            if (!ownedPerks[3])
            {
                player.SetField("NewGunReady", true);
                player.SetField("PerkBought", "specialty_twoprimaries_upgrade");
                player.SetField("perk4bought", true);
                hud.updatePerksHud(player, false, true);
            }
            if (!ownedPerks[4])
            {
                player.SetPerk("specialty_rof", true, true);
                player.SetField("PerkBought", "weapon_attachment_rof");
                player.SetField("perk5bought", true);
                hud.updatePerksHud(player, false, true);
            }
            if (!ownedPerks[5])
            {
                player.SetPerk("specialty_stalker", true, true);
                player.SetField("PerkBought", "specialty_stalker_upgrade");
                player.SetField("perk6bought", true);
                hud.updatePerksHud(player, false, true);
            }
            if (!ownedPerks[6])
            {
                player.SetField("autoRevive", true);
                player.SetField("PerkBought", "waypoint_revive");
                player.SetField("perk7bought", player.GetField <int>("perk7bought") + 1);
                hud.updatePerksHud(player, false, true);
            }

            HudElem perkIcon = NewClientHudElem(player);

            perkIcon.X         = 0;
            perkIcon.Y         = 0;
            perkIcon.AlignX    = HudElem.XAlignments.Center;
            perkIcon.AlignY    = HudElem.YAlignments.Middle;
            perkIcon.VertAlign = HudElem.VertAlignments.Middle;
            perkIcon.HorzAlign = HudElem.HorzAlignments.Center_Adjustable;
            perkIcon.SetShader("specialty_perks_all", 128, 128);
            perkIcon.Foreground     = true;
            perkIcon.HideWhenInMenu = true;
            perkIcon.Alpha          = 1;
            perkIcon.ScaleOverTime(1, 512, 512);
            perkIcon.FadeOverTime(1);
            perkIcon.Alpha = 0;

            player.PlayLocalSound("earn_superbonus");
            AfterDelay(1000, () =>
                       perkIcon.Destroy());
        }
Ejemplo n.º 8
0
Archivo: bots.cs Proyecto: Slvr11/horde
        private static void doBotDamage(int damage, Entity player, string weapon, Entity botHitbox, string MOD, Vector3 point, bool skipFeedback = false)
        {
            float hitDamage = damage;

            if (weaponNames.Keys.Contains(getBaseWeaponName(weapon)))
            {
                hitDamage += weaponLevels[player.EntRef][getBaseWeaponName(weapon)] * 2;
            }

            if (MOD != "MOD_MELEE")
            {
                //Weapon tweaks
                if (weapon == "iw5_as50_mp_as50scope")
                {
                    hitDamage = 10000;                                   //Heli Sniper damage
                }
                else if (weapon == "iw5_44magnum_mp")
                {
                    hitDamage = 400;
                }
            }

            if (MOD == "MOD_HEADSHOT")
            {
                hitDamage *= 1.5f;
            }

            else if (MOD == "MOD_PASSTHRU")
            {
                hitDamage = damage;                            //Script usage
            }
            botHitbox.SetField("damageTaken", botHitbox.GetField <int>("damageTaken") + hitDamage);

            if (player.Classname != "player" || !player.HasField("isDown"))
            {
                return;
            }

            int pointGain = 10;

            if (MOD == "MOD_HEADSHOT")
            {
                pointGain = 30;
            }

            if (MOD != "MOD_PASSTHRU")
            {
                scorePopup(player, pointGain);
            }
            addRank(player, pointGain);

            if (skipFeedback || player.Classname != "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;
        }
Ejemplo n.º 9
0
    public void introSequence(Entity player)
    {
        player.FreezeControls(true);
        HudElem wait = HudElem.CreateFontString(player, HudElem.Fonts.HudBig, 1.5f);

        wait.Alpha = 0;
        wait.SetPoint("CENTER", "CENTER", 0, 160);
        wait.HideWhenInMenu = false;
        wait.GlowAlpha      = 1;
        wait.GlowColor      = new Vector3(1, 0, 0);
        OnInterval(1800, () =>
        {
            if (IntroCompleters.Count == SpawnedPlayers.Count && SpawnedPlayers.Count > 1)
            {
                return(false);
            }

            if (Players.Count < 2)
            {
                wait.SetText("Waiting for other players");
                AfterDelay(300, () =>
                           wait.SetText("Waiting for other players."));
                AfterDelay(600, () =>
                           wait.SetText("Waiting for other players.."));
                AfterDelay(900, () =>
                           wait.SetText("Waiting for other players..."));
                AfterDelay(1200, () =>
                           wait.SetText("Waiting for other players.."));
                AfterDelay(1500, () =>
                           wait.SetText("Waiting for other players."));
                AfterDelay(1800, () =>
                           wait.SetText("Waiting for other players"));
                return(true);
            }
            else
            {
                wait.SetText("Waiting for other players to be ready");
                AfterDelay(300, () =>
                           wait.SetText("Waiting for other players to be ready."));
                AfterDelay(600, () =>
                           wait.SetText("Waiting for other players to be ready.."));
                AfterDelay(900, () =>
                           wait.SetText("Waiting for other players to be ready..."));
                AfterDelay(1200, () =>
                           wait.SetText("Waiting for other players to be ready.."));
                AfterDelay(1500, () =>
                           wait.SetText("Waiting for other players to be ready."));
                AfterDelay(1800, () =>
                           wait.SetText("Waiting for other players to be ready"));
                return(true);
            }
        });
        OnInterval(100, () =>
        {
            if (IntroCompleters.Count != SpawnedPlayers.Count)
            {
                player.VisionSetNakedForPlayer("black_bw", 1);
                player.FreezeControls(true);
                return(true);
            }
            else if (IntroCompleters.Count == SpawnedPlayers.Count && SpawnedPlayers.Count > 1)
            {
                player.VisionSetNakedForPlayer("cobra_sunset3", 1);
                player.FreezeControls(false);
                wait.FadeOverTime(1);
                wait.Alpha = 0;
                return(false);
            }
            return(true);
        });
        HudElem title = HudElem.CreateFontString(player, HudElem.Fonts.HudSmall, 1.5f);

        title.Alpha = 0;
        title.SetPoint("CENTER", "CENTER", 0, -150);
        title.HideWhenInMenu = false;
        title.SetText("^2Primed...");
        title.GlowAlpha = 1;
        title.GlowColor = new Vector3(1, 0, 0);
        title.FadeOverTime(1);
        title.Alpha = 1;
        OnInterval(100, () =>
        {
            if (IntroCompleters.Count == SpawnedPlayers.Count && SpawnedPlayers.Count > 1)
            {
                title.FadeOverTime(1);
                title.Alpha = 0;
                return(false);
            }
            return(true);
        });

        AfterDelay(1000, () =>
        {
            HudElem text1 = HudElem.CreateFontString(player, HudElem.Fonts.HudBig, 1.2f);
            text1.Alpha   = 0;
            text1.SetPoint("CENTER", "CENTER", 0, -20);
            text1.HideWhenInMenu = false;
            OnInterval(500, () =>
            {
                text1.SetText(string.Format("^1There are {0} players in this game.", SpawnedPlayers.Count));
                if (IntroCompleters.Count == SpawnedPlayers.Count && SpawnedPlayers.Count > 1)
                {
                    return(false);
                }
                return(true);
            });
            text1.GlowAlpha = 1;
            text1.GlowColor = new Vector3(1, 0, 0);
            text1.FadeOverTime(1);
            text1.Alpha = 1;
            OnInterval(100, () =>
            {
                if (IntroCompleters.Count == SpawnedPlayers.Count && SpawnedPlayers.Count > 1)
                {
                    text1.FadeOverTime(1);
                    text1.Alpha = 0;
                    return(false);
                }
                return(true);
            });
        });

        AfterDelay(3000, () =>
        {
            HudElem text2 = HudElem.CreateFontString(player, HudElem.Fonts.HudBig, 1.2f);
            text2.Alpha   = 0;
            text2.SetPoint("CENTER", "CENTER", 0, 10);
            text2.HideWhenInMenu = false;
            OnInterval(500, () =>
            {
                text2.SetText(string.Format("^1{0} of them are Primed.", Primers.Count));
                if (IntroCompleters.Count == SpawnedPlayers.Count && SpawnedPlayers.Count > 1)
                {
                    return(false);
                }
                return(true);
            });
            text2.GlowAlpha = 1;
            text2.GlowColor = new Vector3(1, 0, 0);
            text2.FadeOverTime(1);
            text2.Alpha = 1;
            OnInterval(100, () =>
            {
                if (IntroCompleters.Count == SpawnedPlayers.Count && SpawnedPlayers.Count > 1)
                {
                    text2.FadeOverTime(1);
                    text2.Alpha = 0;
                    return(false);
                }
                return(true);
            });
        });

        AfterDelay(5000, () =>
        {
            HudElem warn = HudElem.CreateFontString(player, HudElem.Fonts.HudBig, 1.6f);
            warn.Alpha   = 0;
            warn.SetPoint("CENTER", "CENTER", 0, 50);
            warn.HideWhenInMenu = false;
            warn.SetText("^1Watch Out!");
            warn.GlowAlpha = 1;
            warn.GlowColor = new Vector3(1, 0, 0);
            warn.FadeOverTime(1);
            warn.Alpha = 1;
            OnInterval(100, () =>
            {
                if (IntroCompleters.Count == SpawnedPlayers.Count && SpawnedPlayers.Count > 1)
                {
                    warn.FadeOverTime(1);
                    warn.Alpha = 0;
                    return(false);
                }
                return(true);
            });
        });

        AfterDelay(7000, () =>
        {
            IntroCompleters.Add(player);
            wait.FadeOverTime(1);
            wait.Alpha = 1;
            OnInterval(100, () =>
            {
                if (IntroCompleters.Count == SpawnedPlayers.Count && SpawnedPlayers.Count > 1)
                {
                    wait.FadeOverTime(1);
                    wait.Alpha = 0;
                    return(false);
                }
                return(true);
            });
        });
    }
Ejemplo n.º 10
0
        private static HudElem[] createEndGameScreen(bool win, string endText)
        {
            HudElem outcomeTitle = HudElem.CreateServerFontString(HudElem.Fonts.HudBig, 1.5f);

            outcomeTitle.SetPoint("CENTER", "", 0, -134);
            outcomeTitle.Foreground     = true;
            outcomeTitle.GlowAlpha      = 1;
            outcomeTitle.HideWhenInMenu = false;
            outcomeTitle.Archived       = false;

            HudElem outcomeText = HudElem.CreateServerFontString(HudElem.Fonts.HudBig, 1);

            outcomeText.Parent     = outcomeTitle;
            outcomeText.Foreground = true;
            outcomeText.SetPoint("TOP", "BOTTOM", 0, 18);
            outcomeText.GlowAlpha      = 1;
            outcomeText.HideWhenInMenu = false;
            outcomeText.Archived       = false;

            outcomeTitle.GlowColor = new Vector3(0, 0, 0);
            if (win)
            {
                outcomeTitle.SetText("Victory!");
                outcomeTitle.Color = new Vector3(.3f, .7f, .2f);
            }
            else
            {
                outcomeTitle.SetText("Defeat!");
                outcomeTitle.Color = new Vector3(.7f, .3f, .2f);
            }
            outcomeText.GlowColor = new Vector3(.2f, .3f, .7f);
            outcomeText.SetText(endText);
            outcomeTitle.SetPulseFX(100, 60000, 1000);
            outcomeText.SetPulseFX(100, 60000, 1000);

            HudElem leftIcon    = NewHudElem();
            string  alliesTeam  = GetMapCustom("allieschar");
            string  icon_allies = TableLookup("mp/factionTable.csv", 0, alliesTeam, 1);

            leftIcon.SetShader(icon_allies, 70, 70);
            leftIcon.Parent = outcomeText;
            leftIcon.SetPoint("TOP", "BOTTOM", -60, 45);
            //leftIcon.SetShader("cardicon_soap", 70, 70);
            leftIcon.Foreground     = true;
            leftIcon.HideWhenInMenu = false;
            leftIcon.Archived       = false;
            leftIcon.Alpha          = 0;
            leftIcon.FadeOverTime(.5f);
            leftIcon.Alpha = 1;

            HudElem rightIcon = NewHudElem();
            string  axisTeam  = GetMapCustom("axischar");
            string  icon_axis = TableLookup("mp/factionTable.csv", 0, axisTeam, 1);

            rightIcon.SetShader(icon_axis, 70, 70);
            rightIcon.Parent = outcomeText;
            rightIcon.SetPoint("TOP", "BOTTOM", 60, 45);
            //rightIcon.SetShader("cardicon_nuke", 70, 70);
            rightIcon.Foreground     = true;
            rightIcon.HideWhenInMenu = false;
            rightIcon.Archived       = false;
            rightIcon.Alpha          = 0;
            rightIcon.FadeOverTime(.5f);
            rightIcon.Alpha = 1;

            HudElem leftScore = HudElem.CreateServerFontString(HudElem.Fonts.HudBig, 1.25f);

            leftScore.Parent = leftIcon;
            leftScore.SetPoint("TOP", "BOTTOM", 0, 0);
            if (win)
            {
                leftScore.GlowColor = new Vector3(.2f, .8f, .2f);
                leftScore.SetText("Win");
            }
            else
            {
                leftScore.GlowColor = new Vector3(.8f, .2f, .2f);
                leftScore.SetText("Lose");
            }
            leftScore.GlowAlpha      = 1;
            leftScore.Foreground     = true;
            leftScore.HideWhenInMenu = false;
            leftScore.Archived       = false;
            leftScore.SetPulseFX(100, 60000, 1000);

            HudElem rightScore = HudElem.CreateServerFontString(HudElem.Fonts.HudBig, 1.25f);

            rightScore.Parent = rightIcon;
            rightScore.SetPoint("TOP", "BOTTOM", 0);
            rightScore.GlowAlpha = 1;
            if (!win)
            {
                rightScore.GlowColor = new Vector3(.2f, .8f, .2f);
                rightScore.SetText("Win");
            }
            else
            {
                rightScore.GlowColor = new Vector3(.8f, .2f, .2f);
                rightScore.SetText("Lose");
            }
            rightScore.Foreground     = true;
            rightScore.HideWhenInMenu = false;
            rightScore.Archived       = false;
            rightScore.SetPulseFX(100, 60000, 1000);

            return(new HudElem[] { outcomeTitle, outcomeText, rightScore, leftScore, rightIcon, leftIcon });
        }
Ejemplo n.º 11
0
        public static void startIntermission()
        {
            horde.gameState = "intermission";
            foreach (Entity player in Players)
            {
                if (player.SessionState != "playing" || !player.IsAlive)
                {
                    horde.spawnPlayer(player);
                }
            }

            isLootRound = round == 1 || round % 5 == 0;
            if (isLootRound)
            {
                if (round != 1)
                {
                    round++;
                    horde.roundCounter.SetValue(round);
                }
                horde.spawnLoot();

                foreach (Entity players in Players)
                {
                    if (players.Classname != "player")
                    {
                        continue;
                    }
                    if (players.SessionTeam != "allies")
                    {
                        continue;
                    }

                    OnInterval(250, () => horde.trackLootForPlayer(players));
                }

                HudElem lootTimer = hordeUtils.createTimer(25, "LOOT ROUND");
                PlaySoundAtPos(Vector3.Zero, "mp_killstreak_carepackage");
                AfterDelay(25000, () =>
                {
                    lootTimer.FadeOverTime(.5f);
                    lootTimer.Alpha = 0;
                    AfterDelay(500, () =>
                    {
                        hordeUtils.destroyTimer(lootTimer);
                        hordeUtils.deleteAllLootCrates();
                    });
                    AfterDelay(5000, () => startNextRound());
                    horde.gameState = "ingame";
                    isLootRound     = false;
                });
                return;
            }

            int     time  = 20;
            HudElem timer = hordeUtils.createTimer(time, "NEXT ROUND");

            AfterDelay(20000, () =>
            {
                timer.FadeOverTime(.5f);
                timer.Alpha = 0;
                AfterDelay(500, () => hordeUtils.destroyTimer(timer));
                AfterDelay(5000, () => startNextRound());
                horde.gameState = "ingame";
                return;
            });
        }
Ejemplo n.º 12
0
    public static void openTestMenu(Entity player)
    {
        if (player.GetField <bool>("menuOpen"))
        {
            closeTestMenu(player);
            return;
        }

        player.AllowAds(false);
        player.AllowJump(false);
        player.AllowSprint(false);
        player.SetMoveSpeedScale(0);
        player.DisableOffhandWeapons();
        player.DisableUsability();
        player.DisableWeaponPickup();
        player.DisableWeapons();
        player.DisableWeaponSwitch();
        //player.SetClientDvar("ui_drawCrosshair", "0");
        player.SetClientDvar("g_hardcore", "1");
        player.SetClientDvar("g_scriptMainMenu", "a");
        player.SetField("originalAngles", player.GetPlayerAngles());
        player.SetField("cursorPos", Vector3.Zero);
        player.SetField("lastCursorPos", Vector3.Zero);
        player.SetField("lastAngles", Vector3.Zero);

        HudElem cursor = player.GetField <HudElem>("cursor");

        cursor.FadeOverTime(.5f);
        cursor.Alpha = 1;

        //Opening main menu
        player.SetField("menuOpen", true);
        List <HudElem> menu = player.GetField <List <HudElem> >("menu");
        HudElem        bg   = NewClientHudElem(player);

        bg.AlignX = HudElem.XAlignments.Left;
        bg.AlignY = HudElem.YAlignments.Top;
        bg.Alpha  = 0;
        bg.FadeOverTime(.5f);
        bg.Alpha            = 1;
        bg.Color            = Vector3.Zero;
        bg.Foreground       = false;
        bg.HideIn3rdPerson  = false;
        bg.HideWhenDead     = false;
        bg.HideWhenInDemo   = false;
        bg.HideWhenInMenu   = false;
        bg.HorzAlign        = HudElem.HorzAlignments.Fullscreen;
        bg.VertAlign        = HudElem.VertAlignments.Fullscreen;
        bg.LowResBackground = false;
        bg.X    = 0;
        bg.Y    = 0;
        bg.Sort = 0;
        bg.SetShader("white", 640, 480);
        menu.Add(bg);

        HudElem menuTitle = NewClientHudElem(player);

        menuTitle.AlignX = HudElem.XAlignments.Center;
        menuTitle.AlignY = HudElem.YAlignments.Top;
        menuTitle.Alpha  = 0;
        menuTitle.FadeOverTime(.5f);
        menuTitle.Alpha           = 1;
        menuTitle.Color           = new Vector3(0, 1, 0);
        menuTitle.Foreground      = false;
        menuTitle.HideIn3rdPerson = false;
        menuTitle.HideWhenDead    = false;
        menuTitle.HideWhenInDemo  = false;
        menuTitle.HideWhenInMenu  = false;
        menuTitle.HorzAlign       = HudElem.HorzAlignments.Center_Adjustable;
        menuTitle.VertAlign       = HudElem.VertAlignments.Top_Adjustable;
        menuTitle.X         = 0;
        menuTitle.Y         = 15;
        menuTitle.Sort      = 1;
        menuTitle.Font      = HudElem.Fonts.HudBig;
        menuTitle.FontScale = 1;
        menuTitle.SetText("TEST MENU");
        menu.Add(menuTitle);

        foreach (Button button in Button.menuButtons)
        {
            HudElem buttonBG = NewClientHudElem(player);
            buttonBG.AlignX = HudElem.XAlignments.Center;
            buttonBG.AlignY = HudElem.YAlignments.Middle;
            buttonBG.Alpha  = 0;
            buttonBG.FadeOverTime(.5f);
            buttonBG.Alpha            = 1;
            buttonBG.Color            = new Vector3(1, 1, 1);
            buttonBG.Foreground       = false;
            buttonBG.HideIn3rdPerson  = false;
            buttonBG.HideWhenDead     = false;
            buttonBG.HideWhenInDemo   = false;
            buttonBG.HideWhenInMenu   = false;
            buttonBG.HorzAlign        = HudElem.HorzAlignments.Center_Adjustable;
            buttonBG.VertAlign        = HudElem.VertAlignments.Middle;
            buttonBG.LowResBackground = false;
            buttonBG.X    = button.X;
            buttonBG.Y    = button.Y;
            buttonBG.Sort = 2;
            buttonBG.SetShader("hud_iw5_killstreak_box", button.Width, button.Height);
            menu.Add(buttonBG);

            HudElem buttonText = HudElem.CreateFontString(player, HudElem.Fonts.HudSmall, (button.Width + button.Height) / 256);
            buttonText.Parent = buttonBG;
            buttonText.SetPoint("center", "center");
            buttonText.SetText(button.Text);
            buttonText.Alpha = 0;
            buttonText.FadeOverTime(.5f);
            buttonText.Alpha = 1;
            menu.Add(buttonText);

            button.hud = buttonBG;
        }

        player.SetField("menu", new Parameter(menu));

        OnInterval(50, () => trackMouseMovement(player));
    }
Ejemplo n.º 13
0
        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;
        }
Ejemplo n.º 14
0
        public static HudElem createTimer(int time, string label)
        {
            HudElem timerBG = NewHudElem();

            //roundBG.SetPoint("BOTTOM LEFT", "BOTTOM LEFT", 10, -5);
            timerBG.AlignX           = HudElem.XAlignments.Center;
            timerBG.AlignY           = HudElem.YAlignments.Middle;
            timerBG.Alpha            = 0;
            timerBG.Archived         = false;
            timerBG.Foreground       = false;
            timerBG.HideIn3rdPerson  = false;
            timerBG.HideWhenDead     = false;
            timerBG.HideWhenInDemo   = false;
            timerBG.HideWhenInMenu   = false;
            timerBG.Color            = Vector3.Zero;
            timerBG.LowResBackground = false;
            timerBG.HorzAlign        = HudElem.HorzAlignments.Center_Adjustable;
            timerBG.VertAlign        = HudElem.VertAlignments.Middle;
            timerBG.X = -165;
            timerBG.Y = 75;
            timerBG.SetShader("clanlvl_box", 128, 48);
            timerBG.FadeOverTime(.5f);
            timerBG.Alpha = .5f;

            HudElem timer = NewHudElem();

            //timer.SetPoint("CENTER", "CENTER", -150, 50);
            timer.Parent          = timerBG;
            timer.Alpha           = 0;
            timer.Archived        = false;
            timer.Font            = HudElem.Fonts.Objective;
            timer.FontScale       = 2f;
            timer.Foreground      = true;
            timer.HideIn3rdPerson = false;
            timer.HideWhenDead    = false;
            timer.HideWhenInDemo  = false;
            timer.HideWhenInMenu  = false;
            timer.X = 0;
            timer.Y = 0;
            timer.SetPoint("left", "left", 20);
            timer.SetTenthsTimer(time);
            timer.FadeOverTime(.5f);
            timer.Alpha = 1f;

            if (label != "" || !string.IsNullOrEmpty(label))
            {
                HudElem timerText = HudElem.CreateServerFontString(HudElem.Fonts.Default, 1);
                timerText.Parent = timer;
                timerText.Alpha  = 0;
                timerText.SetPoint("left", "left", 45, 12);
                timerText.Archived        = false;
                timerText.Foreground      = true;
                timerText.HideIn3rdPerson = false;
                timerText.HideWhenDead    = false;
                timerText.HideWhenInDemo  = false;
                timerText.HideWhenInMenu  = false;
                timerText.Color           = new Vector3(1, 1, 0.2f);
                timerText.SetText(label + createHudShaderString("hud_killstreak_dpad_arrow_down", false, 38, 48));
                timerText.FadeOverTime(.5f);
                timerText.Alpha = 1;
            }

            return(timer);
        }
Ejemplo n.º 15
0
    private static void buildEmoteMenu(Entity player)
    {
        if (player.GetField <bool>("emoteMenuOpen"))
        {
            return;
        }

        if (player.GetField <bool>("isEmoting"))
        {
            return;
        }

        if (!player.IsAlive)
        {
            return;
        }

        player.SetField("emoteMenuOpen", true);

        HudElem bg = NewClientHudElem(player);

        bg.AlignX          = HudElem.XAlignments.Center;
        bg.AlignY          = HudElem.YAlignments.Middle;
        bg.HorzAlign       = HudElem.HorzAlignments.Center;
        bg.VertAlign       = HudElem.VertAlignments.Middle;
        bg.Alpha           = 0;
        bg.Archived        = false;
        bg.Foreground      = true;
        bg.HideIn3rdPerson = false;
        bg.HideWhenDead    = true;
        bg.HideWhenInDemo  = false;
        bg.HideWhenInMenu  = false;
        bg.X     = 0;
        bg.Y     = 0;
        bg.Color = new Vector3(1, 1, 1);
        bg.SetShader("compassping_portable_radar_sweep", 0, 0);

        bg.ScaleOverTime(0.5f, 320, 320);
        bg.FadeOverTime(0.5f);
        bg.Alpha = 1;

        HudElem bgCross = NewClientHudElem(player);

        bgCross.Parent          = bg;
        bgCross.AlignX          = HudElem.XAlignments.Center;
        bgCross.AlignY          = HudElem.YAlignments.Middle;
        bgCross.HorzAlign       = HudElem.HorzAlignments.Center;
        bgCross.VertAlign       = HudElem.VertAlignments.Middle;
        bgCross.Alpha           = 0;
        bgCross.Archived        = false;
        bgCross.Foreground      = true;
        bgCross.HideIn3rdPerson = false;
        bgCross.HideWhenDead    = true;
        bgCross.HideWhenInDemo  = false;
        bgCross.HideWhenInMenu  = false;
        bgCross.X     = 0;
        bgCross.Y     = 120;
        bgCross.Color = new Vector3(0, .8f, .8f);
        bgCross.SetShader("damage_feedback", 0, 0);

        bgCross.ScaleOverTime(0.5f, 260, 460);
        bgCross.FadeOverTime(0.5f);
        bgCross.Alpha = .7f;

        HudElem selections1 = NewClientHudElem(player);

        selections1.Parent          = bg;
        selections1.AlignX          = HudElem.XAlignments.Center;
        selections1.AlignY          = HudElem.YAlignments.Top;
        selections1.HorzAlign       = HudElem.HorzAlignments.Center;
        selections1.VertAlign       = HudElem.VertAlignments.Middle;
        selections1.Alpha           = 0;
        selections1.Archived        = false;
        selections1.Foreground      = true;
        selections1.HideIn3rdPerson = false;
        selections1.HideWhenDead    = true;
        selections1.HideWhenInDemo  = false;
        selections1.HideWhenInMenu  = false;
        selections1.X    = 0;
        selections1.Y    = -120;
        selections1.Font = HudElem.Fonts.HudSmall;
        //selections1.FontScale = .8f;
        selections1.FontScale = .1f;
        selections1.SetText("   " + emoteList_names[0] + "\n\n\n\n         (^3[{+actionslot 4}]^7)\n\n\n\n\n\n         (^3[{+actionslot 7}]^7)\n\n\n\n" + emoteList_names[3]);

        selections1.FadeOverTime(0.5f);
        selections1.Alpha = 1;
        selections1.ChangeFontScaleOverTime(.5f);
        selections1.FontScale = 1f;

        HudElem selections2 = NewClientHudElem(player);

        selections2.Parent          = bg;
        selections2.AlignX          = HudElem.XAlignments.Center;
        selections2.AlignY          = HudElem.YAlignments.Middle;
        selections2.HorzAlign       = HudElem.HorzAlignments.Center;
        selections2.VertAlign       = HudElem.VertAlignments.Middle;
        selections2.Alpha           = 0;
        selections2.Archived        = false;
        selections2.Foreground      = true;
        selections2.HideIn3rdPerson = false;
        selections2.HideWhenDead    = true;
        selections2.HideWhenInDemo  = false;
        selections2.HideWhenInMenu  = false;
        selections2.X         = 0;
        selections2.Y         = 0;
        selections2.Font      = HudElem.Fonts.HudSmall;
        selections2.FontScale = .1f;
        selections2.SetText(emoteList_names[1] + "    (^3[{+actionslot 5}]^7)          (^3[{+actionslot 6}]^7)  " + emoteList_names[2]);

        selections2.FadeOverTime(0.5f);
        selections2.Alpha = 1;
        selections2.ChangeFontScaleOverTime(.5f);
        selections2.FontScale = 1f;

        player.SetField("emoteMenu", bg);
    }