Custom huds

AfterShock introduced fully customizable huds using hudfiles. The hudfiles allow you to modify everything displayed in the hud. To show what is possible with hudfiles, AfterShock comes with a few example-config. To test the example huds just modify the cg_hud cvar to "hud/hud1.cfg". To add a new hud just make a folder named hud in your aftershock-folder and add a cfg-file, for example myhud.cfg.

The hudfile layout
The hudfile syntax is simple and looks like that: HudElement1 {      Command1 {Value1{ Value2 { ... } } }      Command2 {Value1{ Value2 { ... } } } } HudElement2 { Command1 {Value1{ ... } }; Command2 {Value1{ ... } } } You can use both, multi-line and single-line arguments using the ; symbol. You can comment your hudfile using the # key, the whole line after the #-symbol is a comment.
 * 1) This is a comment

The HudElements

 * !DEFAULT: This has to be the first hudelement in the hudfile. It defines the default values of the HudElement. You can override it later if you want new default values
 * AmmoMessage: The onscreen message on low/empty ammo
 * AttackerIcon: The icon of the last player you received damage from.
 * AttackerName: The name of the last player you received damage from
 * Console: The console
 * Countdown: All the countdown messages (gamestart, roundstart, timein), 3, 2, 1, FIGHT
 * Chat1-8: The chatlines used for public chat and some console prints
 * DeathNotice1-5: The lines used for deathnotice
 * FlagStatus_OWN: The flagstatus-icon of your team
 * FlagStatus_NME: The flagstatus-icon of the enemy team
 * FollowMesssage: The player you follow as spec
 * FPS: The fps count
 * FragMessage: The message "You fragged ... "
 * GameTime: The ingame timer
 * GameType: The gametype shown on gamestart
 * ItemPickupName: The name of the item you picked up
 * ItemPickupIcon: The icon of the item you picked up
 * ItemPickupTime: The time you picked up the last item
 * NetGraph: The lagometer
 * NetGraphPing: Your ping
 * PlayerSpeed: The speed of the player in the xy-plane.
 * PlayerAccel: Shows green/red bars depending on acceleration
 * PreDecorate1-8: Decoration loaded before the rest of the hud
 * PostDecorate1-8: Decoration loaded after the rest of the hud
 * PowerUp1-4_Time: The time remaining on the powerup you are wearing ( PowerUp1_Time, ... )
 * PowerUp1-4_Icon: The icon of the powerup
 * RankMessage: Your rank ( "1st place with ... frags" )
 * ReadyStaus: the "You are not ready" or "You are ready" message during warmup
 * RespawnTimer: Shows the remaining time to itemspawn of the major items on the map
 * Reward: The rewards ( impressive, ... )
 * RewardCount: The number of rewards you earned of this kind
 * RoundTime: The roundtimer used in clanarena/elimination-gametype
 * Score_Limit: Shows the fraglimit/capturelimit
 * Score_OWN: The score of you or your team
 * Score_NME: The score of the enemy or the enemy team
 * SpecMessage: The spectator message
 * StatusBar_ArmorBar: The value of your current armor showed as a bar
 * StatusBar_ArmorCount: The value of your current armor
 * StatusBar_ArmorIcon: The armoricon
 * StatusBar_AmmoBar
 * StatusBar_AmmoCount
 * StatusBar_AmmoIcon: The icon of the current weapon you are using
 * StatusBar_HealthBar
 * StatusBar_HealthCount
 * StatusBar_HealthIcon
 * StatusBar_Flag: Shows the flagicon if you are carrying the flag
 * TargetName: The name of the player you look at
 * TargetStatus: the (health|armor) of the teammate you look at
 * TeamCount_NME: The number of enemies alive in clanarena/elimination-gametype
 * TeamCount_OWN: The number of teammates alive in clanarena/elimination-gametype
 * TeamIcon_NME: The icon or background of the TeamCount_NME element
 * TeamIcon_OWN: The icon or background of the TeamCount_OWN element
 * Team1-8: The chatlines used for teamchat
 * TeamOverlay1-8: The 8 lines of the teamoverlay, showing the status of your teammates in teamgames
 * VoteMessage: The message shown on vote
 * WarmupInfo: Shows "Warmup" if the game is still in warmup
 * WeaponList: The weaponbar

List of HudElement-Commands
All HudElements can be modified using the HudElements-Commands. Some of the commands have no impact on some of the HudElements( for example you cannot modify a picture using the fontsize command ) and some of the features are not implemented yet.
 * bgcolor : 4 float values, defines the color of the background
 * color : 4 float values, defines the primary color
 * fill : if bgcolor is set, fill will draw a filled rect, otherwise just a box
 * rect : defines the coordinates of the HudElement. Value range for x is 0 - 640 and for y 0 - 480
 * fontsize : the fontsize of this HudElement
 * image  : some HudElements can use custom images( for example StatusBar_HealthIcon )
 * text : drawtext, this is not used by many HudElements yet
 * textalign  : the align of the text or the WeaponList element, L left, R right and C centered
 * textstyle : 1 adds shadow to the font
 * time : the time the HudElement is shown, works for some HudElements( for example WeaponList, AttackerIcon )
 * teamcolor : if set, this will override the color with teamcolors(red/blue) if the gametype is a teamgametype
 * enemycolor : if set, this will override the color with enemycolors(red/blue) if the gametype is a teamgametype
 * teambgcolor : same as teamcolor with bgcolor
 * enemybgcolor : same as enemycolor with bgcolor

Color and Bgcolor

 * The AfterShock hud works r g b a, which is red green blue alpha. Each channel can have a value from 0.0 to 1.0.

color 1 0 0 1              #red, full alpha color 0.5 0.5 0.5 0.5      #grey, transparent color 0.25 0.75 0.25 0.5   #green mix, transparent
 * the color command will NOT override any ingame colors, for example in the rank-message "1st place with FRAGS" will not change the color, because it is set ingame.
 * If the enemycolor/teamcolor flag ist set, the color will be the enemy/team color if the gametype is a teamgametype. If the gametype is not a teamgametype, the color will be the defined one.

HudElement {    color 0 1 0 1 teamcolor }
 * This will be green in non-teamgames and red/blue in teamgames depending on the team you play in.

How to center a text

 * If you want to center a text string, set the x-position to 0 and the width to 640 and use textalign C.

HudElement {    rect 0  640  textalign C }

How to use the WeaponList HudElement?
In this section you will learn how to setup the WeaponList for your needs. The layout of the WeaponList depends on your rect parameters, is the width > height the WeaponList will be Horizontal, is the width < height the WeaponList will be vertical. To mark the selected weapon you can use the color command or use an image. You can set the background of the WeaponList using the bgcolor command, if you want team/enemy-colors use the flags team/enemybgcolor.

The Scoreboard
The scoreboard shows as long as you hit TAB.