Skip to content

Medigun Info

Matt Haynie edited this page Jan 14, 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
{
    fieldname      ImagePanel
    ControlName    MedigunIconRed // or MedigunIconBlue

    // "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. 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.

NameDoesntMatter
{	
    ControlName    ContinuousProgressBar
    fieldname      NameDoesntMatter
    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%"
}
Clone this wiki locally