Setting Up the Hud

Since the Hud scripts are the same as menu scripts, they require a certain amount of assets in order for them to work. The basic graphic assets, such as the scrollbar graphics and the FX graphics, are identical to those required by the menu scripts. And like menu scripts, these graphics are loaded using a default file name when the system is initalized but can have that name changed in the assetGlobalDef section of the Hud scripts.

These graphics are contained in the stock Quake 3 pak0.pk3 file. You can use custom versions of these graphics by placing them in the appropriate sub-directory of baseq3. The names and location of these files are changable in the Hud script but by default they are loaded from this directory using these names.

The fx graphics from directory menu\art.

  • fx_base.tga
  • fx_blue.tga
  • fx_cyan.tga
  • fx_grn.tga
  • fx_red.tga
  • fx_teal.tga
  • fx_white.tga
  • fx_yel.tga

These files are unique to Team Arena and must extracted from the TA pak file or supplied by the user. In the TA pak file these graphics are in the ui\assets directory. The names and location of these files are changable in the Hud script but by default they are loaded from this directory using these names.

  • gradiantbar2.tga - used when filling a menu window with a gradiant color
  • scrollbar.tga - used as the background of the scrollbars. This graphic must be square and it is stretched horizontally or vertically to fill the scrollbar area. This is the default background for both horizontal and vertical scrollbars but in the menu scripts you can define a different graphic for each.
  • scrollbar_arrow_dwn_a.tga - the down arrow for a vertical scrollbar
  • scrollbar_arrow_up_a.tga - the up arrow for a vertical scrollbar
  • scrollbar_arrow_left.tga - the left arrow for a horizontal scrollbar
  • scrollbar_arrow_right.tga - the right arrow for a horizontal scrollbar
  • scrollbar_thumb.tga - the thumb for the scrollbar. It is used for both horizontal and vertical scrollbars and should be square as it drawn square to fit on the scrollbar.
  • slider2.tga - the background for a sliderbar. Sliders are all drawn horizontally and the background is streched to fit the defined slider size.
  • sliderbutt_1.tga - the thumb for the sliderbar. This graphic is streched to fit the defined height and width for the thumb.

The following sizes are used by default for scrollbars and sliders. These can be changed in the menu script to suit the graphics that you are using.

  • scrollbar width (for horizontal scrollbars) or scrollbar height (for vertical scrollbars) is 16.
  • slider width is 96 and slider height is 16. The background for the slider is stretched to fit this size.
  • slider thumb width is 12 and the slider thumb height is 20. The slider thumb is stretched to fit this size.

As you can see from the above all these graphics will be present if you are using the scripted menus. If you are not using scripted menus then you'll have to provide them seperately.

There are also some other graphics that are unique to the Hud. These are mostly icon graphics indicating various actions, as well as a couple of cursors. They are to be located in the baseq3/ui/assets/statusbar directory, are 32x32 in size and are named as follows :

  • assault.tga
  • camp.tga
  • defend.tga
  • escort.tga
  • flag_capture.tga
  • flag_in_base.tga
  • team_leader.tga
  • flag_missing.tga
  • follow.tga
  • patrol.tga
  • retrieve.tga
  • selectedarmor.tga
  • selectedhealth.tga
  • selectcursor.tga
  • sizecursor.tga

These graphics must be present or you'll get errors appearing in the console. I have provided a package containing these graphics on the Downloads page for those that don't have Team Arena. For those extracting these from the TA pak file, you will notice that the two cursor graphics are in the ui/assets directory. They must be placed in the baseq3/ui/assets/statusbar directory when using the Hud code from this site.

Like the menu scripts, you have to tell the system what Hud script files you wish to load via a text file that specifies the script file name and location. By default the text file is named hud.txt but that can be changed by changing the contents of the cg_hudFiles cvar.

The format of the text file is as follows :

   {
     loadMenu { "ui/hud.menu" } 
     loadMenu { "ui/hud_score.menu" }
     loadMenu { "ui/hud_teamscore.menu" }
   }

The loadMenu commands must be placed between curly braces ( "{" and "}" ), one command per line. Each loadMenu command specifies a path and name of a Hud script file we wish to load. Team Arena uses the .menu extension to designate a script file but any extension can be used.

Here we are telling the program to load and use three menu script files, hud.menu, hud_score.menu and hud_teamscore.menu, all in the ui directory. Only these three script files will be used by the program in the Hud system, regardless of how many other script files are present in the directory.

One interesting point about the method used to designate the text file containing the loadMenu commands. Since the name of the file can be changed by changing the contents of a cvar, we can allow the user to select from a variety of different Huds by changing this cvar in a menu script. The Weapons Factory mod has this feature. We can also use it to have a different Hud for different classes of players in class based team mods.

 

Return to Home Page