In this section we will take a detailed look at the menuDefs that make up a sample Hud and scoreboard. The Hud is usable for both team and nonteam games in vanilla Quake 3 and has a scoreboard for each game type. The Hud itself is contained in the hud.menu file, while the nonteam scoreboard is in the hud_score.menu file and the team scoreboard is in the hud_teamscore.menu file. The menu files and assets for this sample Hud are avalible on the Downloads page.
The Hud
The assetGlobalDef section of the Hud (which applies to both the Hud and the scoreboards) simply defines the font files used for text display. These are the same font files we used for the menu scripts so the text font used is consistant through the entire game.
As stated in an eariler section, there is no main menu for the Hud that is displayed first but, instead, all the menuDefs are displayed at once. This allows us to have different menuDefs for each section of the Hud, making it easier to do the layout for each item. MenuDefs are displayed in the order that they are defined in the script, with the last menuDef being drawn overtop of all the others.
Background Section
The first menuDef we want to display is the hudbackground. This is used to show the background graphic for the Hud that all other items will be drawn overtop of. We make the menuDef window area cover the entire screen (but not be fullscreen) so we can place our background graphic correctly. Since the team and nonteam games require a different Hud layout we use two different background graphics to suit each game type.
In the nonteambackground item we display the graphic for nonteam games. It uses the ownerdrawflag CG_SHOW_ANYNONTEAMGAME command to make sure this item is visible only if the game is nonteam based. Notice that the foreground color has its alpha set to 0.7. This will make the graphic slightly transparent so we can see the game through it.

In the teambackground item we display the background graphic for team games. It uses the ownerdrawflag CG_SHOW_ANYTEAMGAME command to make sure this item is visible only if the game is team based. Again, the foreground color's alpha is set to 0.7 to make the graphic slightly transparent.

Basic Hud Section
In this section we will display those items that would comprise the Basic Hud, ie. the player's head, ammo, armor and health. These will all be placed in the center of the Hud so we define our basichud menuDef's window area to cover the entire bottom of the screen where our background graphic is displayed.
The player's health is shown by the health item. This is a text item that uses the ownerdraw CG_PLAYER_HEALTH command to provide the health value. The three addColorRange commands are used to color the text differently, depending on the level of the health.
The head item displays a model of the player's head using the ownerdraw CG_PLAYER_HEAD command. The model's size is set to 40x40.
The amount of ammo the player has for the currently selected weapon is displayed by the ammovalue item. It is a text item that uses the ownerdraw CG_PLAYER_AMMO_VALUE command to provide the ammo value. The two addColorRange commands are used to color the text differently, depending on the amount of ammo avalible.
The ammoicon item displays a model of the ammo for the selected weapon using the ownerdraw CG_PLAYER_AMMO_ICON command. The model's size is 28x28.
The amount of armor the player currently has is displayed by the armorvalue item. It is a text item that uses the ownerdraw CG_PLAYER_ARMOR_VALUE command to provide the armor value. The three addColorRange commands are used to color the text differently, depending on the amount of armor.
The armoricon item displays a model of the armor using the ownerdraw CG_PLAYER_ARMOR_ICON command. The model's size is 28x28.
Item and Powerup Section
This section, part of the Intermediate Hud, displays the Item and the Powerups that the player currently possesses. These are displayed vertically on the upper right side of the background graphic so we make the itempwrup menuDef's window area cover just this area.
The Item that the player currently holds is displayed by the item item using the ownerdraw CG_PLAYER_ITEM command. The graphic that is displayed is 28x28 in size.
The Powerups that the player currently has are displayed by the powerup item using the ownerdraw CG_AREA_POWERUP command. Since this command displays both a graphic and text we must use the textscale command to set the size of the text. The size of the graphic is set by the item's window size. Since we wish to have the Powerups displayed in a vertical list we use the align HUD_VERTICAL command. The spacing between each Powerup is set by the special command to 3 pixels.
Nonteam Hud Section
All of the above sections are common to both team and nonteam games so they are displayed for every Hud. This section displays information only for nonteam based games. This information is displayed in the lower right corner of the background so we set the basichudnonteam menuDef's window are to cover just this. We also use the ownerdrawflag CG_SHOW_ANYNONTEAMGAME command in the menuDef so it will only be visible in a nonteam game. If the menuDef is not visible then none of it's items will be visible either, regardless of their own visiblity.
The fraglimittext item is a text item used to display the Frag Limit: title. This text must be displayed in a seperate item from the frag limit value due to the way the value is displayed by its ownerdraw command.
The fraglimit item uses the ownerdraw CG_CAPFRAGLIMIT command to display the frag limit value using the text formatting commands in the item. The placement of the text by this command is a bit funny so some experimentation is required to get it right.
The scoretext item is a text item used to display the Score: title. This text must be displayed in a seperate item from the score value due to the way the value is displayed by its ownerdraw command.
The score item uses the ownerdraw CG_PLAYER_SCORE command to display the score value using the text formatting commands in the item. The placement of the text by this command is a bit funny so some experimentation is required to get it right.
This completes the Hud for nonteam based games. All the required Hud information is displayed in the above sections to meet the player's needs in a nonteam game. The rest of the sections looked at here will deal with team games and will provide information specific to them. All of the menuDefs in the following sections contain the ownerdrawflag CG_SHOW_ANYTEAMGAME command to ensure they only appear during team games.
Selected Team Member and Team Info Section
This section deals with information about the player's teammates, either individually or as the team as a whole. It is displayed on the upper left side of the team background so the selectedteam menuDef's window area cover just that. It uses the ownerdrawflag CG_SHOW_ANYTEAMGAME command in the menuDef to make this information visible only in a team game.
The teaminfo item displays the information about the entire team using the ownerdraw CG_TEAMINFO command. Since part of the information is text it uses the text formatting commands in the item for that. This information must only be displayed when we are in Team Info mode so we use the ownerdrawflag CG_SHOW_TEAMINFO command to ensure this happens. This is required since we are sharing the same screen area with information about individual team members.
The rest of the items in this section are meant to be displayed only when we are in Noteam Info mode so they all include the ownerdrawflag CG_SHOW_NOTEAMINFO command in them to make this happen. See the Miscellaneous Design Information section for information about the Team/Noteam Info modes.
The selectedstatus item uses the ownerdraw CG_SELECTEDPLAYER_STATUS command to display a 16x16 graphic showing the selected team member's current status.
The selectedpwrup item uses the ownerdraw CG_SELECTEDPLAYER_POWERUP command to display a 16x16 graphic showing the selected team member's current powerup.
The selectedname item is a text item that uses the ownerdraw CG_SELECTEDPLAYER_NAME command to display the name of the selected team member. It uses the textscale and textstyle commands to format the name.
The selectedlocation item is a text item that uses the ownerdraw CG_SELECTEDPLAYER_LOCATION command to display the location of the selected team member. It uses the textscale and textstyle commands to format the text.
The selectedhealth item is a text item that uses the ownerdraw CG_SELECTEDPLAYER_HEALTH command to display the health value of the selected team member. It uses the textscale and textstyle commands to format the text. The color of the text is set using the three addColorRange commands to reflect the actual value.
The selectedarmoricon item is used to display a graphic of the armor. This graphic, ui/assets/statusbar/selectedarmor.tga, is displayed at a size of 22x11 and is colored to match the value of the armor the selected team member has. Since this item has a style WINDOW_STYLE_SHADER command in it, in order to display the graphic, the ownerdraw CG_SELECTEDPLAYER_ARMOR command will not display anything (it only displays something if the style is the default text style). Instead it is used by the addColorRange commands to set the foreground color, which is used to color the displayed graphic.
The selectedarmor item is a text item that uses the ownerdraw CG_SELECTEDPLAYER_ARMOR command to display the armor value of the selected team member. It uses the textscale and textstyle commands to format the text. The color of the text is set using the three addColorRange commands to reflect the actual value.
The selectedweapon item uses the ownerdraw CG_SELECTEDPLAYER_WEAPON command to display the selected team member's current weapon as a 24x24 graphic.
Player Status Section
In this section we display information about the status of the player, such as his location, team color, status and if he has the flag in CTF games. This information is shown on the lower left of the background and the playerstatus menuDef's window area is set to this.
In a CTF game the player must know when he has the enemy's flag so we use two items to show this. The hasflagwarning item displays a pulsing, rotating graphic using the flagalert_good shader to alert the player to the fact he has the flag. It uses the ownerdrawflag CG_SHOW_IF_PLAYER_HAS_FLAG command so it is visible only when the player has the flag. The hasflag item uses the ownerdraw CG_PLAYER_HASFLAG command to display a 40x40 graphic of the flag overtop of the hasflagwarning item, whenever the player has the flag.
The playerstatus item uses the ownerdraw CG_PLAYER_STATUS command to display a 16x16 graphic indicating the player's current status.
The playerlocation item is a text item that uses the ownerdraw CG_PLAYER_LOCATION command to display the location of the player. It uses the textscale and textstyle commands to format the text.
The color of the team the player is on is also important, since you get no other indication of your current team. To show this we use two items. The teamcolor item uses the ownerdraw CG_TEAM_COLOR command to fill the item's window area with the player's team color. The teamcolortext item is a text item that places Team Color over the top of the teamcolor item. It uses the text formatting commands in the item to place the text.
Scoring Section
The scores for each team are displayed on the middle right of the background so we set the scoring menuDef's window area to there. This area will show the scores for each team and, for CTF games, the flag status for each team and a warning if the other team has your flag.
The flagwarning item displays a pulsing, rotating graphic using the flagalert_red shader whenever the other team has your flag. The ownerdrawflag CG_SHOW_OTHERTEAMHASFLAG command ensures it is only shown at this time.
The blueflag item shows a graphic indicating the status of the Blue flag using the ownerdraw CG_BLUE_FLAGSTATUS command. Since the flag status is only used in CTF games we use the ownerdrawflag CG_SHOW_CTF command to display this during those games.
The score for the Blue team is shown using two items. The bluescoretext item is a text item that displays the Blue text above the Blue team's score. The bluescore item is also a text item that uses the ownerdraw CG_BLUE_SCORE command to display the score value. It uses the textscale and textstyle commands to format the text. Both of these items have their foreground color set to blue to help indicate the Blue team.
The redflag item shows a graphic indicating the status of the Red flag using the ownerdraw CG_RED_FLAGSTATUS command. Since the flag status is only used in CTF games we use the ownerdrawflag CG_SHOW_CTF command to display this during those games.
The score for the Red team is shown using two items. The redscoretext item is a text item that displays the Red text above the Red team's score. The redscore item is also a text item that uses the ownerdraw CG_RED_SCORE command to display the score value. It uses the textscale and textstyle commands to format the text. Both of these items have their foreground color set to red to help indicate the Red team.
Cap Limit and Player Score Section
The last section of the team Hud shows the capture limit for the game and the player's current score. This is shown on the lower right part of the background so we set the playerscore menuDef's window area to that.
The Capture limit is displayed using two items. The caplimittext item is a text item that displays the Cap Limit text above the actual cap limit value. The caplimit item displays the actual value using the ownerdraw CG_CAPFRAGLIMIT command. The placement of the text by this command is a bit funny so some experimentation is required to get it right. It uses the textscale and textstyle commands to format the text.
The Score is displayed using two items. The scoretext item is a text item that displays the Score text above the actual score value. The score item displays the actual value using the ownerdraw CG_PLAYER_SCORE command. The placement of the text by this command is a bit funny so some experimentation is required to get it right. It uses the textscale and textstyle commands to format the text.
Part II : Nonteam Scoreboard
[Part I] [Part II] [Part III]