Skip to content

Medigun Info

Matt Haynie edited this page Jul 15, 2018 · 13 revisions

The Medigun info module is broken up into two main parts: separated and embedded panels. Whichever one you choose to use (or both), it is recommended to download https://github.com/Wiethoofd/TF2-MedigunInfo. This will give you a starting point for the separated medigun panels, and includes icons for the different mediguns.

Separated Medigun Panels

Separated panels are free-floating panels with their own "stacking" abilities. Because they are in their own root panel (and other reasons), it is not possible to use PinToSibling to attach them to existing HUD panels. These panels can be configured by editing /tf/resource/ui/MedigunInfo.res.

Example

ConVars

ConCommands

Embedded Medigun Panels

Embedded medigun panels adds extra controls and makes additional data available to specgui player panels.

Example

ConVars

SpectatorTournament.res

In order to use embedded medigun panels, the playerpanels_kv section in /tf/resource/ui/spectatortournament.res must be modified to add support.

Medigun Icons

Enabling medigun icons is as simple as adding an ImagePanel named MedigunIconRed or MedigunIconBlue. Only one will ever be visible at a time. For performance reasons, these names are case sensitive. The icons are loaded from materials in /tf/materials/vgui/hud/mediguninfo/ (included in download).

MedigunIconRed // or MedigunIconBlue
{
    ControlName    ImagePanel
    fieldName      MedigunIconRed // or MedigunIconBlue
    scaleImage     1

    // "image" uses vmts in the CE addons folder: /materials/vgui/hud/mediguninfo/
    // Customize images for "type_team(_resistance)"
    // type: dead, medigun, kritzkrieg, quickfix, vaccinator
    // team: blue, red
    // resistance: bullet, explosive, fire 
}

Medigun Charge Percentage Text

Medigun charge percentage text is already supported in the base game. Just add a CExLabel and use the dialog variable chargeamount:

NameDoesntMatter
{
    ControlName    CExLabel
    fieldName      NameDoesntMatter
    labelText      "%chargeamount%"
}

Medigun Progress Bars

We can re-use the chargeamount dialog variable to power our progress bars. If you want the progress bar's visibility to be controlled based on whether the player has a Medigun, you need to name it MedigunChargeRed or MedigunChargeBlue. Bonus feature: you can use the direction setting for (Continuous)ProgressBar to change which direction the progress bar runs. Valid values are north/east/south/west.

MedigunChargeRed // or MedigunChargeBlue
{	
    ControlName    ContinuousProgressBar
    fieldname      MedigunChargeRed // or MedigunChargeBlue
    variable       chargeamount
    direction      north
}

Medigun Type Labels

Embedded medigun info makes an additional dialog variable available: medigun. This is a string that contains one of the values from the ce_mediguninfo_embedded_????_text cvars.

NameDoesntMatter
{
    ControlName CExLabel
    fieldname   NameDoesntMatter
    labelText   "%medigun%"
}