TF2 HUD Editing Guide

In-Depth: Label Text

labelText is a property of labels and buttons, it defines the text that should appear on the button. There are a few tricks you can do with this property.

Also covered here; Label Shadows


top

Shortcut Keys

Some buttons can have shortcut keys; when you press the key, the button is triggered.

Not all buttons can have this function though. Menu buttons can. The buttons on team and class select menus can. Be sure to check and custom shortcut keys you add work.

How it Works: The Ampersand (&)

By adding the & sumbol before the desired letter (or number) in the buttons labelText property, you make the selected letter/number the shortcut key for that button.

Here is an example:

"PrevPageButton"
{
    "ControlName"	"CExButton"
    "fieldName"		"PrevPageButton"
    "xpos"		"c185"
    "ypos"		"290"
    "zpos"		"1"
    "wide"		"20"
    "tall"		"20"
    "visible"		"1"
    "enabled"		"1"
    "labelText"		"&A"
    "textAlignment"	"center"
    "Command"		"prevpage"
}

Pressing the A key will trigger this button, and the prevpage command. Which, in the packpack menu, will move to the previous page.

I recommend only using letters and numbers. For shortcut keys.

Hidden Shortcut

You can also add a Hidden Button with the shortcut. Maybe you don't have the shortcut letter/number on the visisble button, or the visible button wont allow a shortcut key.

"HiddenPrevPageButton"
{
    "ControlName"	"CExButton"
    "fieldName"		"HiddenPrevPageButton"
    "xpos"		"9999" // button is hidden off the screen
    "ypos"		"9999" // button is hidden off the screen
    "zpos"		"1"
    "wide"		"20"
    "tall"		"20"
    "visible"		"1"
    "enabled"		"1"
    "labelText"		"&A"
    "textAlignment"	"center"
    "Command"		"prevpage"
}

top

Reference Labels

There are two types of reference labels, for two different reasons. They are both used in the labelText property.

Static Reference Labels

These exist so that TF2 has full language support. A reference is used for the labelText and the text is loaded from the users selected language.

"ArmoryLabel"
{
    "ControlName"	"Label"
    "fieldName"		"ArmoryLabel"
    "font"		"HudFontMediumSmallBold"
    "labelText"		"#Armory"
    "textAlignment"	"west"
}

The # symbol indictates the reference label. "#Armory" is replaced with the label text of the appropriate language when the control is loaded.

Language files are located in (default location):

C:\Program Files (games)\Steam\SteamApps\common\Team Fortress 2\tf\resource\tf_<language>.txt

Example: resource\tf_english.txt for English.

Dynamic Reference Labels

These exist so that TF2 can have constantly changing label text. A reference is used for the labelText and tf2 constantly inserts new text into that label. These are only used in-game for things like ammo and health.

"AmmoInClip"
{
    "ControlName"	"CExLabel"
    "fieldName"		"AmmoInClip"
    "font"		"Default"
    "textAlignment"	"west"	
    "labelText"		"%Ammo%"
}

The % symbol indicates the dynamic reference label. Everytime the amount of ammo in your clip changes, this label is updated to show that.


top

Label Shadows

The outline property of fonts looks kind of ugly in most places. So for things like your Health and Ammo it is better to use a shadow label.

A shadow label is a second label positioned behind the first, with a much darker color so that it appears like a shadow. This can help with visibility.

To make a shadow label:

  • Duplicate a Label (copy one and paste it underneath) - the second one will act as the shadow
  • Change the fieldName of the shadow label
  • Change the zpos of the shadow label - be careful with this step, the zpos may be depended upon for appearances
  • Change the FgColor of the shadow label to a black or dark color
  • Change the xpos and ypos of the shadow label to 1 or 2 more

Here is an example (some properties removed, not important for this example):

"AmmoInClip"
{
    "ControlName"	"CExLabel"
    "fieldName"		"AmmoInClip"
    "font"		"HudNumbers"
    "fgcolor"		"White"
    "xpos"		"0"
    "ypos"		"0"
    "zpos"		"5"
    "wide"		"200"
    "tall"		"80"
}
"AmmoInClipShadow"
{
    "ControlName"	"CExLabel"
    "fieldName"		"AmmoInClipShadow"
    "font"		"HudNumbers"
    "fgcolor"		"Black"
    "xpos"		"2"
    "ypos"		"2"
    "zpos"		"4"
    "wide"		"200"
    "tall"		"80"
}

The offset of the xpos and ypos with the dark FgColor will give it a shadow look. The zpos is to make sure its behind the original label.