public static HudElem createPrimaryProgressBar(Entity player, int xOffset, int yOffset) { HudElem progressBar = HudElem.CreateIcon(player, "progress_bar_fill", 0, 9);//NewClientHudElem(player); progressBar.SetField("frac", 0); progressBar.Color = new Vector3(1, 1, 1); progressBar.Sort = -2; progressBar.Shader = "progress_bar_fill"; progressBar.SetShader("progress_bar_fill", 1, 9); progressBar.Alpha = 1; progressBar.SetPoint("center", "", 0, -61); progressBar.AlignX = HudElem.XAlignments.Left; progressBar.X = -60; HudElem progressBarBG = HudElem.CreateIcon(player, "progress_bar_bg", 124, 13);//NewClientHudElem(player); progressBarBG.SetPoint("center", "", 0, -61); progressBarBG.SetField("bar", progressBar); progressBarBG.Sort = -3; progressBarBG.Color = new Vector3(0, 0, 0); progressBarBG.Alpha = .5f; return(progressBarBG); }
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()); }
public static IEnumerator giveRandomPerk(Entity player, int perk = -1) { bool[] ownedPerks = AIZ.getOwnedPerks(player); if (!ownedPerks.Contains(false)) { yield break; //Owns all perks, give up on life... } if (perk == -1) { perk = AIZ.rng.Next(7); perk++; } if (ownedPerks[perk - 1]) { //re-roll int randomPerk = AIZ.rng.Next(7); randomPerk++; StartAsync(giveRandomPerk(player, randomPerk)); yield break; } hud.scoreMessage(player, AIZ.gameStrings[99]); switch (perk) { case 1: player.MaxHealth = 250; player.Health = player.MaxHealth; player.SetField("PerkBought", "cardicon_juggernaut_1"); break; case 2: player.SetPerk("specialty_lightweight", true, true); //player.SetPerk("specialty_marathon", true, true); player.SetPerk("specialty_longersprint", true, true); player.SetField("PerkBought", "specialty_longersprint_upgrade"); break; case 3: player.SetPerk("specialty_fastreload", true, true); //player.SetPerk("specialty_quickswap", true, true); player.SetPerk("specialty_quickdraw", true, true); player.SetField("PerkBought", "specialty_fastreload_upgrade"); break; case 4: player.SetField("NewGunReady", true); player.SetField("PerkBought", "specialty_twoprimaries_upgrade"); break; case 5: player.SetPerk("specialty_rof", true, true); player.SetField("PerkBought", "weapon_attachment_rof"); break; case 6: player.SetPerk("specialty_stalker", true, true); player.SetField("PerkBought", "specialty_stalker_upgrade"); break; case 7: player.SetField("autoRevive", true); player.SetField("PerkBought", "waypoint_revive"); break; case 8: player.SetPerk("specialty_scavenger", true, true); player.SetField("PerkBought", "specialty_scavenger_upgrade"); break; } if (perk != 7) { player.SetField("perk" + perk + "bought", true); } else { player.SetField("perk7bought", player.GetField <int>("perk7bought") + 1); } HudElem perkIcon = NewClientHudElem(player); perkIcon.X = 0 * (perk - 1); perkIcon.Y = -54; perkIcon.AlignX = HudElem.XAlignments.Left; perkIcon.AlignY = HudElem.YAlignments.Bottom; perkIcon.VertAlign = HudElem.VertAlignments.Bottom_Adjustable; perkIcon.HorzAlign = HudElem.HorzAlignments.Left; perkIcon.SetShader(player.GetField <string>("perkBought"), 128, 128); perkIcon.Foreground = true; perkIcon.HideWhenInMenu = true; perkIcon.Alpha = 1; perkIcon.ScaleOverTime(1, 30, 30); player.PlayLocalSound("earn_perk"); yield return(Wait(1)); perkIcon.Destroy(); hud.updatePerksHud(player, false, true); }
public static IEnumerator giveJuggernaut(Entity player, string juggType) { yield return(WaitForFrame()); //remove light armor if (player.HasPerk("specialty_lightarmor")) { removeLightArmor(player, player.GetField <int>("previousMaxHealth")); } //remove explosive bullets if (player.HasPerk("specialty_explosivebullets")) { player.UnSetPerk("specialty_explosivebullets"); } bool createObjectiveIcon = true; switch (juggType) { case "juggernaut": player.SetField("isJuggernaut", true); giveJuggLoadout(player, player.SessionTeam, juggType); player.SetMoveSpeedScale(.65f); break; case "juggernaut_recon": player.SetField("isJuggernautRecon", true); giveJuggLoadout(player, player.SessionTeam, juggType); player.SetMoveSpeedScale(.75f); Entity portable_radar = GSCFunctions.Spawn("script_model", player.Origin); portable_radar.SetField("team", player.SessionTeam); portable_radar.MakePortableRadar(player); player.SetField("personalRadar", portable_radar); radarMover(player, portable_radar); break; case "tjugg_juggernaut": player.SetField("isJuggernaut", true); giveJuggLoadout(player, player.SessionTeam, "gamemode"); player.SetMoveSpeedScale(.7f); Entity portable_radar1 = GSCFunctions.Spawn("script_model", player.Origin); portable_radar1.SetField("team", player.SessionTeam); portable_radar1.MakePortableRadar(player); player.SetField("personalRadar", portable_radar1); radarMover(player, portable_radar1); break; case "jugg_juggernaut": player.SetField("isJuggernaut", true); giveJuggLoadout(player, player.SessionTeam, "gamemode"); player.SetMoveSpeedScale(.7f); if (GSCFunctions.GetMatchRulesData("juggData", "showJuggRadarIcon") == "0") { createObjectiveIcon = false; } break; } updateMoveSpeedScale(player); player.DisableWeaponPickup(); if (GSCFunctions.GetDvarInt("camera_thirdPerson") == 0) { HudElem juggernautOverlay = GSCFunctions.NewClientHudElem(player); juggernautOverlay.X = 0; juggernautOverlay.Y = 0; juggernautOverlay.AlignX = HudElem.XAlignments.Left; juggernautOverlay.AlignY = HudElem.YAlignments.Top; juggernautOverlay.HorzAlign = HudElem.HorzAlignments.Fullscreen; juggernautOverlay.VertAlign = HudElem.VertAlignments.Fullscreen; juggernautOverlay.SetShader(level.GetField <Dictionary <string, Entity> >("juggSettings")[juggType].GetField <string>("overlay"), 640, 480); juggernautOverlay.Sort = -10; juggernautOverlay.Archived = true; juggernautOverlay.HideIn3rdPerson = true; } juggernautSounds(player); player.SetPerk("specialty_radarjuggernaut", true, false); teamPlayerCardSplash(level.GetField <Dictionary <string, Entity> >("juggSettings")[juggType].GetField <string>("splashUsedName"), player); player.PlaySoundToTeam(voice[player.SessionTeam] + "use_juggernaut", player.SessionTeam, player); player.PlaySoundToTeam(voice[otherTeam[player.SessionTeam]] + "enemy_juggernaut", otherTeam[player.SessionTeam]); updateKillstreaks(player, true); StartAsync(juggRemover(player)); //reapply flag if (player.HasField("carryFlag")) { yield return(WaitForFrame()); player.Attach(player.GetField <string>("carryFlag"), "J_spine4", true); } Notify("juggernaut_equipped", player); //Log data? }
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 }); }
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)); }
private static IEnumerator spawnStations(Vector3 alliesPos, Vector3 axisPos) { yield return(Wait(.1f)); if (isHalftime) { alliesStation = GSCFunctions.Spawn("script_model", axisPos + new Vector3(0, 0, 100)); } else { alliesStation = GSCFunctions.Spawn("script_model", alliesPos + new Vector3(0, 0, 100)); } alliesStation.SetModel("tag_origin"); Entity alliesStationBack = GSCFunctions.Spawn("script_model", alliesStation.Origin); alliesStationBack.SetModel("tag_origin"); alliesStation.SetField("back", alliesStationBack); alliesStation.SetField("team", "allies"); OnInterval(50, () => monitorZone(alliesStation)); if (isHalftime) { axisStation = GSCFunctions.Spawn("script_model", alliesPos + new Vector3(0, 0, 100)); } else { axisStation = GSCFunctions.Spawn("script_model", axisPos + new Vector3(0, 0, 100)); } axisStation.SetModel("tag_origin"); Entity axisStationBack = GSCFunctions.Spawn("script_model", axisStation.Origin); axisStationBack.SetModel("tag_origin"); axisStation.SetField("back", axisStationBack); axisStation.SetField("team", "axis"); OnInterval(50, () => monitorZone(axisStation)); alliesStation.SetField("isScoring", false); alliesStation.SetField("team", "allies"); axisStation.SetField("isScoring", false); axisStation.SetField("team", "axis"); GSCFunctions.Objective_Add(alliesSiteAttackerID, "active", alliesStation.Origin, "waypoint_target"); GSCFunctions.Objective_Team(alliesSiteAttackerID, "allies"); GSCFunctions.Objective_Add(alliesSiteDefenderID, "active", alliesStation.Origin, "waypoint_defend"); GSCFunctions.Objective_Team(alliesSiteDefenderID, "axis"); GSCFunctions.Objective_Add(axisSiteAttackerID, "active", axisStation.Origin, "waypoint_target"); GSCFunctions.Objective_Team(axisSiteAttackerID, "axis"); GSCFunctions.Objective_Add(axisSiteDefenderID, "active", axisStation.Origin, "waypoint_defend"); GSCFunctions.Objective_Team(axisSiteDefenderID, "allies"); //Hud alliesSiteAttackerWaypoint = GSCFunctions.NewTeamHudElem("allies"); alliesSiteAttackerWaypoint.Alpha = 0.5f; alliesSiteAttackerWaypoint.Archived = true; alliesSiteAttackerWaypoint.HideIn3rdPerson = false; alliesSiteAttackerWaypoint.HideWhenDead = false; alliesSiteAttackerWaypoint.HideWhenInDemo = false; alliesSiteAttackerWaypoint.HideWhenInMenu = false; alliesSiteAttackerWaypoint.LowResBackground = false; alliesSiteAttackerWaypoint.SetShader("waypoint_target", 10, 10); alliesSiteAttackerWaypoint.X = alliesStation.Origin.X; alliesSiteAttackerWaypoint.Y = alliesStation.Origin.Y; alliesSiteAttackerWaypoint.Z = alliesStation.Origin.Z; alliesSiteAttackerWaypoint.SetWaypoint(true, true, false, false); alliesSiteAttackerWaypoint.SetWaypointEdgeStyle_RotatingIcon(); alliesSiteDefenderWaypoint = GSCFunctions.NewTeamHudElem("axis"); alliesSiteDefenderWaypoint.Alpha = 0.5f; alliesSiteDefenderWaypoint.Archived = true; alliesSiteDefenderWaypoint.HideIn3rdPerson = false; alliesSiteDefenderWaypoint.HideWhenDead = false; alliesSiteDefenderWaypoint.HideWhenInDemo = false; alliesSiteDefenderWaypoint.HideWhenInMenu = false; alliesSiteDefenderWaypoint.LowResBackground = false; alliesSiteDefenderWaypoint.SetShader("waypoint_defend", 10, 10); alliesSiteDefenderWaypoint.X = alliesStation.Origin.X; alliesSiteDefenderWaypoint.Y = alliesStation.Origin.Y; alliesSiteDefenderWaypoint.Z = alliesStation.Origin.Z; alliesSiteDefenderWaypoint.SetWaypoint(true, true, false, false); alliesSiteDefenderWaypoint.SetWaypointEdgeStyle_RotatingIcon(); axisSiteAttackerWaypoint = GSCFunctions.NewTeamHudElem("axis"); axisSiteAttackerWaypoint.Alpha = 0.5f; axisSiteAttackerWaypoint.Archived = true; axisSiteAttackerWaypoint.HideIn3rdPerson = false; axisSiteAttackerWaypoint.HideWhenDead = false; axisSiteAttackerWaypoint.HideWhenInDemo = false; axisSiteAttackerWaypoint.HideWhenInMenu = false; axisSiteAttackerWaypoint.LowResBackground = false; axisSiteAttackerWaypoint.SetShader("waypoint_target", 10, 10); axisSiteAttackerWaypoint.X = axisStation.Origin.X; axisSiteAttackerWaypoint.Y = axisStation.Origin.Y; axisSiteAttackerWaypoint.Z = axisStation.Origin.Z; axisSiteAttackerWaypoint.SetWaypoint(true, true, false, false); axisSiteAttackerWaypoint.SetWaypointEdgeStyle_RotatingIcon(); axisSiteDefenderWaypoint = GSCFunctions.NewTeamHudElem("allies"); axisSiteDefenderWaypoint.Alpha = 0.5f; axisSiteDefenderWaypoint.Archived = true; axisSiteDefenderWaypoint.HideIn3rdPerson = false; axisSiteDefenderWaypoint.HideWhenDead = false; axisSiteDefenderWaypoint.HideWhenInDemo = false; axisSiteDefenderWaypoint.HideWhenInMenu = false; axisSiteDefenderWaypoint.LowResBackground = false; axisSiteDefenderWaypoint.SetShader("waypoint_defend", 10, 10); axisSiteDefenderWaypoint.X = axisStation.Origin.X; axisSiteDefenderWaypoint.Y = axisStation.Origin.Y; axisSiteDefenderWaypoint.Z = axisStation.Origin.Z; axisSiteDefenderWaypoint.SetWaypoint(true, true, false, false); axisSiteDefenderWaypoint.SetWaypointEdgeStyle_RotatingIcon(); playStationFX(); }
private static void spawnBall(Vector3 location) { ballEnt = GSCFunctions.Spawn("script_model", location + new Vector3(0, 0, 1030)); ballEnt.SetModel("viewmodel_light_marker"); ballEnt.SetField("beingCarried", false); ballEnt.SetField("carrier", level); ballEnt.SetField("parentEnt", level); ballEnt.SetField("lastThrow", 999999999); ballEnt.MoveTo(ballEnt.Origin - new Vector3(0, 0, 1000), 10, .5f, 1); ballEnt.EnableLinkTo(); ballEnt.NotSolid(); baseFX = GSCFunctions.SpawnFX(ballSiteFX, location); //ballFX = GSCFunctions.Spawn("script_model", ballEnt.Origin); //ballFX.SetModel("tag_origin"); //ballFX.LinkTo(ballEnt, "tag_origin"); StartAsync(ball_waitForPrematch()); //Huds ballObjAllies_defend = GSCFunctions.NewTeamHudElem("allies"); ballObjAllies_defend.Alpha = 0.5f; ballObjAllies_defend.Archived = true; ballObjAllies_defend.HideIn3rdPerson = false; ballObjAllies_defend.HideWhenDead = false; ballObjAllies_defend.HideWhenInDemo = false; ballObjAllies_defend.HideWhenInMenu = false; ballObjAllies_defend.LowResBackground = false; ballObjAllies_defend.SetShader("waypoint_targetneutral", 10, 10); ballObjAllies_defend.SetTargetEnt(ballEnt); ballObjAllies_defend.SetWaypoint(true, true, false, false); ballObjAllies_defend.SetWaypointEdgeStyle_RotatingIcon(); ballObjAllies_kill = GSCFunctions.NewTeamHudElem("allies"); ballObjAllies_kill.Alpha = 0f; ballObjAllies_kill.Archived = true; ballObjAllies_kill.HideIn3rdPerson = false; ballObjAllies_kill.HideWhenDead = false; ballObjAllies_kill.HideWhenInDemo = false; ballObjAllies_kill.HideWhenInMenu = false; ballObjAllies_kill.LowResBackground = false; ballObjAllies_kill.SetShader("waypoint_kill", 10, 10); //ballObjAllies_kill.SetTargetEnt(ballEnt); //ballObjAllies_kill.SetWaypoint(true, true, false, false); //ballObjAllies_kill.SetWaypointEdgeStyle_RotatingIcon(); ballObjAxis_defend = GSCFunctions.NewTeamHudElem("axis"); ballObjAxis_defend.Alpha = 0.5f; ballObjAxis_defend.Archived = true; ballObjAxis_defend.HideIn3rdPerson = false; ballObjAxis_defend.HideWhenDead = false; ballObjAxis_defend.HideWhenInDemo = false; ballObjAxis_defend.HideWhenInMenu = false; ballObjAxis_defend.LowResBackground = false; ballObjAxis_defend.SetShader("waypoint_targetneutral", 10, 10); ballObjAxis_defend.SetTargetEnt(ballEnt); ballObjAxis_defend.SetWaypoint(true, true, false, false); ballObjAxis_defend.SetWaypointEdgeStyle_RotatingIcon(); ballObjAxis_kill = GSCFunctions.NewTeamHudElem("axis"); ballObjAxis_kill.Alpha = 0f; ballObjAxis_kill.Archived = true; ballObjAxis_kill.HideIn3rdPerson = false; ballObjAxis_kill.HideWhenDead = false; ballObjAxis_kill.HideWhenInDemo = false; ballObjAxis_kill.HideWhenInMenu = false; ballObjAxis_kill.LowResBackground = false; ballObjAxis_kill.SetShader("waypoint_kill", 10, 10); }
private static IEnumerator initGameHud() { yield return(Wait(1)); //Delete GSC hud and set custom hud int startOfIcons = 0; for (int i = 65536; i < 65800; i++) { HudElem temp = HudElem.GetHudElem(i); if (temp.FontScale == 1.6f && (string)temp.GetField(4) == "small") { startOfIcons = i - 1; break; } } if (startOfIcons == 0) { yield break; } ballIcon_allies = HudElem.GetHudElem(startOfIcons); ballText_allies = HudElem.GetHudElem(startOfIcons + 1); ballIcon_axis = HudElem.GetHudElem(startOfIcons + 4); ballText_axis = HudElem.GetHudElem(startOfIcons + 5); HudElem ballIcon2_allies = HudElem.GetHudElem(startOfIcons + 2); HudElem ballText2_allies = HudElem.GetHudElem(startOfIcons + 3); HudElem ballIcon2_axis = HudElem.GetHudElem(startOfIcons + 6); HudElem ballText2_axis = HudElem.GetHudElem(startOfIcons + 7); //ballIcon2_allies.Destroy(); ballIcon2_allies.Alpha = 0; //ballIcon2_axis.Destroy(); ballIcon2_axis.Alpha = 0; //ballText2_allies.Destroy(); ballText2_allies.Alpha = 0; //ballText2_axis.Destroy(); ballText2_axis.Alpha = 0; ballIcon_allies.SetShader("equipment_emp_grenade", 32, 32); ballIcon_axis.SetShader("equipment_emp_grenade", 32, 32); ballText_allies.SetText("HOME"); ballText_axis.SetText("HOME"); //axisSiteAttackerWaypoint = HudElem.GetHudElem(65540);//Allies attacker //axisSiteDefenderWaypoint = HudElem.GetHudElem(65541);//Axis defend //alliesSiteDefenderWaypoint = HudElem.GetHudElem(65542);//Allies defend //alliesSiteAttackerWaypoint = HudElem.GetHudElem(65543);//Axis attack startOfIcons = 0; HudElem[] gameHud = new HudElem[4] { alliesSiteAttackerWaypoint, alliesSiteDefenderWaypoint, axisSiteAttackerWaypoint, axisSiteDefenderWaypoint }; for (int i = 65544; i < 65800; i++) { HudElem temp = HudElem.GetHudElem(i); if ((string)temp.GetField(4) == "default" && temp.Alpha == 0.5019608f && !gameHud.Contains(temp)) { temp = HudElem.GetHudElem(i + 1); if ((string)temp.GetField(4) == "default" && temp.Alpha == 0.5019608f && !gameHud.Contains(temp))//Check for the second one after { startOfIcons = i; break; } } } if (startOfIcons == 0) { yield break; } HudElem flagIcon = HudElem.GetHudElem(startOfIcons); flagIcon.Destroy(); flagIcon = HudElem.GetHudElem(startOfIcons + 1); flagIcon.Destroy(); flagIcon = HudElem.GetHudElem(startOfIcons + 2); flagIcon.Destroy(); flagIcon = HudElem.GetHudElem(startOfIcons + 3); flagIcon.Destroy(); }
private static void handleEquipment(Entity player) { HudElem equipIcon = player.GetField <HudElem>("hud_equip"); HudElem equipTXT = player.GetField <HudElem>("hud_equipTXT"); if (player.HasWeapon("c4_mp")) { player.TakeWeapon("c4_mp"); player.SetOffhandPrimaryClass("frag"); player.GiveWeapon("frag_grenade_mp"); player.GiveWeapon("c4_mp"); player.SetWeaponAmmoClip("c4_mp", 2); player.SetWeaponAmmoStock("c4_mp", 2); equipIcon.SetShader("hud_icon_c4", 20, 20); equipTXT.SetText("[[{vote yes}]]"); player.OnNotify("equipUse", (p) => { if (player.CurrentWeapon != "c4_mp") { player.SwitchToWeapon("c4_mp"); equipIcon.Alpha = 1; } else { player.SwitchToWeapon(player.GetField <string>("lastDroppableWeapon")); } }); } else if (player.HasWeapon("claymore_mp")) { player.TakeWeapon("claymore_mp"); player.SetOffhandPrimaryClass("frag"); player.GiveWeapon("frag_grenade_mp"); player.GiveWeapon("claymore_mp"); player.SetWeaponAmmoClip("claymore_mp", 2); player.SetWeaponAmmoStock("claymore_mp", 2); equipIcon.SetShader("hud_icon_claymore", 20, 20); equipTXT.SetText("[[{vote yes}]]"); player.OnNotify("weapon_fired", (ent, weapon) => { if ((string)weapon == "claymore_mp") { if (player.GetWeaponAmmoClip("claymore_mp") == 0) { equipIcon.SetShader("", 20, 20); equipTXT.SetText(""); } } }); player.OnNotify("equipUse", (ent) => { if (player.CurrentWeapon != "claymore_mp") { player.SwitchToWeapon("claymore_mp"); equipIcon.Alpha = 1; } else { player.SwitchToWeapon(player.GetField <string>("lastDroppableWeapon")); } }); } else if (player.HasWeapon("rpg_mp")) { player.GiveWeapon("iw5_usp45_mp"); equipIcon.SetShader("hud_icon_rpg_dpad", 20, 20); equipTXT.SetText("[[{vote yes}]]"); player.OnNotify("weapon_fired", (ent, weap) => { if ((string)weap == "rpg_mp") { if (player.GetAmmoCount("rpg_mp") == 0) { AfterDelay(1000, () => player.TakeWeapon("rpg_mp")); equipIcon.SetShader("", 20, 20); equipTXT.SetText(""); } } }); player.OnNotify("equipUse", (ent) => { if (player.CurrentWeapon != "rpg_mp") { player.SwitchToWeapon("rpg_mp"); equipIcon.Alpha = 1; } else { player.SwitchToWeapon(player.GetField <string>("lastDroppableWeapon")); } }); } else if (!player.HasWeapon("rpg_mp") && !player.HasWeapon("claymore_mp") && !player.HasWeapon("c4_mp")) { equipIcon.SetShader("", 20, 20); equipTXT.Alpha = 0; } }
private void UsableHud(Entity player) { HudElem message = HudElem.CreateFontString(player, "big", 1.5f); message.SetPoint("CENTER", "CENTER", 1, 115); message.Alpha = 0.65f; HudElem perk = HudElem.NewClientHudElem(player); player.SetField("currentusable_entref", 0); player.OnInterval(100, e => { try { List <IUsable> _closingusables = new List <IUsable>(); foreach (var item in usables) { if (player.Origin.DistanceTo(item.Origin) >= item.Range) { continue; } else { _closingusables.Add(item); } } if (_closingusables.Count > 0) { _closingusables.Sort(); var ent = _closingusables[0]; if (player.GetField <int>("currentusable_entref") != ent.EntRef || ent.GetType().BaseType == typeof(Turret)) { message.SetText(ent.GetUsableText(player)); if (ent.GetType() == typeof(PerkColaMachine)) { var ent2 = ent as PerkColaMachine; var type = ent2.PerkCola; perk.SetShader(type.Icon, 15, 15); perk.X = ent.Origin.X; perk.Y = ent.Origin.Y; perk.Z = ent.Origin.Z + 50f; perk.Call("setwaypoint", 1, 1); perk.Alpha = 0.7f; } else { perk.Alpha = 0; } player.SetField("currentusable_entref", ent.EntRef); } } else { player.SetField("currentusable_entref", 0); message.SetText(""); perk.Alpha = 0; } } catch (Exception) { } return(player.IsPlayer); }); }
public static void updateAmmoHud(Entity player, bool updateName, string newWeapon = "") { if (!player.HasField("hud_created") || (player.HasField("hud_created") && !player.GetField <bool>("hud_created"))) { return; } HudElem ammoStock = player.GetField <HudElem>("hud_ammoStock"); HudElem ammoClip = player.GetField <HudElem>("hud_ammoClip"); HudElem equipment = player.GetField <HudElem>("hud_equipment"); HudElem ammoBar = player.GetField <HudElem>("hud_weaponBar"); string weapon = player.CurrentWeapon; if (newWeapon != "") { weapon = newWeapon; } //build grenades hud int lethalAmmoCount = 0; string grenade = " "; if (player.HasWeapon("c4_mp")) { lethalAmmoCount = player.GetAmmoCount("c4_mp"); string extraLethal = lethalAmmoCount > 1 ? createHudShaderString("hud_icon_c4", false, 48, 48) : ""; grenade = lethalAmmoCount > 0 ? createHudShaderString("hud_icon_c4", false, 48, 48) + extraLethal + "" : ""; } else if (player.HasWeapon("throwingknife_mp")) { lethalAmmoCount = player.GetAmmoCount("throwingknife_mp"); grenade = lethalAmmoCount > 0 ? createHudShaderString("killiconimpale", false, 48, 48) + "" : ""; } int tacticalAmmoCount = player.GetAmmoCount("flash_grenade_mp"); string special = ""; string extraTactical = tacticalAmmoCount > 1 ? createHudShaderString("hud_us_flashgrenade", false, 48, 48) : " "; special = (player.HasWeapon("flash_grenade_mp") && tacticalAmmoCount > 0) ? createHudShaderString("hud_us_flashgrenade", false, 48, 48) + extraTactical + " " : " "; int ammoClipValue = player.GetWeaponAmmoClip(weapon); int ammoStockValue = player.GetWeaponAmmoStock(weapon); ammoStock.SetValue(ammoStockValue); ammoClip.SetValue(ammoClipValue); ammoStock.Alpha = 1; ammoClip.Alpha = 1; equipment.SetText(special + grenade); float ammoPercent = ammoClipValue / (float)WeaponClipSize(weapon); if (ammoPercent < .02f) { ammoPercent = .02f; } int maxWidth = (int)ammoBar.GetField("maxWidth"); ammoBar.SetShader("clanlvl_box", (int)(ammoPercent * maxWidth), 24); if (updateName) { StartAsync(updateWeaponName(player, weapon)); updateWeaponImage(player, weapon); updateWeaponLevel(player, weapon, true); } }
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); }
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); }