There are currently 5 players online.



1. Introduction back to top

You can open and edit the *.hud files with a simple texteditor. The hud parser uses a simple script language to include and interpret hudscripts and hudcommands. You cant write your own functions nor create dynamic varibles or jump to a specific point in your script. The scriptparser traverses the hud files from top to bottom and executes it line by line, just like a batch file.
Warsow lays out hud elements on a virtual grid of 800x600 units size. The constants #WIDTH and #HEIGHT store this predefined grid size.
Warsow's default hud can be found inside data0_*.pk3 which can be opened with your favourite zip archiver. Make sure you do not modify any of the pk3 files that come with the game.
Your HUD files can be located inside the /basewsw/huds/ folder. Create that directory if it does not yet exist.
To change the HUD in game, go to the “player setup” menu and select it in the “client HUD” option or type cg_clientHUD "hud_name" in the console.

All available commands can be seen by typing help_hud in the console.

2. Default files back to top

Here is a list of the default HUD files, their directories, and a short description of what they do.
directory huds:
This a HUD script that tells what other files to include in the HUD
The HUDs name will be it's filename without the extension

directory huds/inc/default:
Draws the current weapons icon, strong ammo, and weak ammo
Shows a warning, if ammo is low or empty
Draws the award notice
Draws the player name you spectate if you spectate
Draws the chat window
Draws the clock at the top of the HUD
Draws the crosshair in the center of the screen
Draws the directional damage indicator that paints the screen borders red
Shows the download progress bar (server-demo downloads)
Draws the frames per second
Draws the word "frags" and the number of frags
By default, this also changes the word from "frags" to "points" or "spread," depending on what game type you are playing
Draws the health and armor bar, icon, and numbers
Draws the item timers for spectators
Draws the keys pressed
note - uses images stored in data0.pk3 in directory "gfx/hud/keys/"
Displays the minimap
Draws the connection icon if your connection to the server is temporary lost
note - uses one image stored in data0.pk3 in directory "gfx/hud/"
Draws the little entries for who killed who, and how in the upper right corner
Draws the name of the player in the crosshair
Draws the timer for power up items.. (Quad Damage and War Shell)
Draws personal and server best times for races
Draws the scores of alpha and beta teams
Draws the speed in units per second
Draws a strafe helper
Draws the "stunned" message
Draws the gametype dependant icons
Draws the team information screen
Draws the team messages
Draws the team progress (for example flag unlocks in ctf)
Draws the ammunition for each weapon
This file lists the starting points (x,y) for weapon icons, and weapon ammo
note - weaponlist.hud is executed only on the initial spawn of the player, and when the player picks up a new weapon

3. HUD Script Commands back to top

Capitalisation of the command names does not matter.
setScale (arguments: 1)
Sets the scaling method for cursor and size commands.
setCursor (arguments: 2)
Changes cursor position on the hud parsers virtual grid
Parameters: horizontal position, vertical position
moveCursor (arguments: 2)
Moves the cursor position relative to current position
Parameters: horizontal offset, vertical offset
setAlign (arguments: 2)
Changes alignment of things like images or text
Parameters: horizontal alignment (#LEFT|#CENTER|#RIGHT), vertical alignment (#TOP|#MIDDLE|#BOTTOM)
setSize (arguments: 2)
Sets width and height. Used in various hudcommands for pictures, models and containers
setFontSize (arguments: 1)
Sets font size.
setFontFamily (arguments: 1)
Sets font Family.
Available arguments by default: Droid Sans, Droid Sans Mono, Hemi Head Rg, Kimberley Bl, warsow, Silhouette, Virtue.
setFontStyle (arguments: 1)
Sets font Style. Available arguments: Bold, Italic, Normal
Accepts 'con_fontsystemsmall', 'con_fontsystemmedium' and 'con_fontsystembig' as shortcut to default game fonts
setColor (arguments: 4)
Sets color setting in RGBA mode. Used to change colors of boxes, bars, text and images
setColorToTeamColor (arguments: 1)
Sets cursor color to the color of the team provided in the argument
setColorAlpha (arguments: 1)
Changes the alpha value of the current color
setRotationSpeed (arguments: 3)
Sets rotation speeds as vector. Used for models
setCustomWeaponIcons (arguments: 3)
modifies an individual image on the graphical weaponlist
1st argument specifies the weapon it should affect (either by id, or better use #ITEM_GUNBLADE etc constants)
2nd argument tells if you want to replace the NOGUN icon (0) or the regular weapon icon (1)
3rd argument is the path to the graphic you want to use as a replacement
setCustomWeaponSelect (arguments: 1)
modifies the image around current selected weapon on the list of weapons
the only and required argument is a file path to a valid graphic
drawObituaries (arguments: 2)
Draws graphical death messages. Arguments: horizontal alignment, iconsize
Draws award messages
Draws a clock that shows remaining play time
Draws the help message
drawPlayername (arguments: 1)
Draws the name of the player with id provided by the argument
Draws the name of a player that is being pointed at (the player under the crosshair)
drawTeamMates (arguments: 0)
Draws indicators where team mates are
drawStatString (arguments: 1)
Draws configstring of argument id
drawItemName (arguments: 1)
Draws the name of the thing that is given as argument in form of item index
drawString (arguments: 1)
Draws the text in argument at cursor position using currently set font and color
drawStringNum (arguments: 1)
Can be used to output referenced numbers as text, using currently set font, position and color
drawNum (arguments: 1)
Draws numbers of given character size. Use setSize to set character size
drawStretchNum (arguments: 1)
Draws numbers stretched inside a given size
drawBar (arguments: 2)
Draws a bar of size setting, the bar's longest dimension, or its width if it's a square, is filled in proportion to the arguments
Arguments: value, maxvalue
drawPicBar (arguments: 3)
Draws an image bar of size setting, is filled in proportion to the arguments.
Arguments: value, maxvalue, imagefile
Draws the game crosshair
drawKeyState (arguments: 1)
Draws icons showing if the argument key is pressed. Possible arg: forward, backward, left, right, fire, jump, crouch, special
Use setSize to scale and setCursor to position each element.
Draws the disconnection icon
drawChat (arguments: 3)
Draws the game chat messages
drawPicByIndex (arguments: 1)
Draws a pic with argument as imageIndex
drawPicByItemIndex (arguments: 1)
Draws a item icon pic with argument as itemIndex
drawPicByName (arguments: 1)
Draws a pic with argument being the file path
drawModelByIndex (arguments: 1)
Draws a model with argument being the modelIndex
drawModelByName (arguments: 2)
Draws a model with argument being the path to the model file
drawModelByItemIndex (arguments: 1)
Draws an item model with argument being the item index
drawWeaponIcons (arguments: 4)
Draws the icons of weapon/ammo owned by the player, arguments are offset x, offset y, size x, size y
drawCaptureAreas (arguments: 3)
Draws capture area HUD icons. arguments are icon-width, icon-height and alignment (either horizontal or vertical)
drawMiniMap (arguments: 2)
Shows miniature map overview for spectators. arguments are playernames (0|1), itemnames (0|1)
drawWeaponWeakAmmo (arguments: 3)
Draws the amount of weak ammo owned by the player, arguments are offset x, offset y, fontsize
drawWeaponStrongAmmo (arguments: 3)
Draws the amount of strong ammo owned by the player, arguments are offset x, offset y, fontsize
Draws the Team Info (locations) box
drawTimer (arguments: 1)
Draws a digital clock using currently set font. The only argument is a timer variable or integer
drawPicVar (arguments: 6)
Draws a picture from a sequence, depending on the value of a given parameter
Parameters: value, minval, maxval, firstimg, lastimg, imagename##
(replacing ## by the picture number, no leading zeros, starting at 0)
drawLocationName (arguments: 1)
Draws the location name with argument being location tag/index
if (arguments: 1)
Conditional expression. Argument accepts operands >, <, ==, >=, <=, etc
End of conditional expression block

NOTE: Warsow hudscript does not know of "else" or a "switch" type statement

4. HUD Script Operators back to top

+   Add operator
- Subtract operator
* Multiply operator
/ Divide operator
& Bitwise AND operator
| Bitwise OR operator
ˆ XOR operator
== Equals operator
!= Not equals operator
> Bigger than operator
>= Bigger than or equal to operator
< Smaller than or equal to operator
<= Smaller than or equal to operator
&& Logical AND operator
|| Logical OR operator

NOTE: Hudcode is parsed from right to left. Keep that in mind if you plan to do multiple operations in a single line.

5. HUD scripts REFERENCE names back to top

Reference names must be written UPPER CASE
  • %ARMOR
  • %SCORE
  • %TEAM
  • %AMMO
  • %SPEED
  • %FPS
  • %RACE
  • %ZOOM
  • %MOUSE_X
  • %MOUSE_Y

6. HUD scripts CONSTANT names back to top

Constant names must be written UPPER CASE
  • #LEFT
  • #RIGHT
  • #TOP
  • #WIDTH
  • #NOGUN
  • #GUN

7. Hudscript examples back to top

7.1. running a command back to top

this example says Hello Warsowland!
drawString "Hello Warsowland!"

calls the command drawString and supplies the argument "Hello Warsowland!" to it.
but the command will output "Hello Warsowland!" somewhere on the screen in some color.
to set a color and a position that makes sense, you must run setColor and setCursor commands before you call drawString.

7.2. multiple arguments and mathematical calculations back to top

this example will draw a big number 4
setColor 1, 1, 1, 0.8
setSize #WIDTH / 4, 150
drawNum 4

the 1st line calls setColor with 4 arguments and sets a white color that is also 20% transparent. drawNum in 3rd line will use this color
the 2nd line runs setSize and defines the size to 1/4th of the gridwidth horizontaly, and 150units on the grid vertically, drawNum in the next line will make use this size setting
the last line calls drawNum and simply gives the number 4 as argument to it. you cant do any calculations while calling certain commands like drawNum, drawTimer or drawString.

7.3. conditional expressions back to top

An example that will show the words You have been blessed on screen everytime you pick up ultrahealth
if %PICKUP_ITEM == #ITEM_ULTRA_HEALTH           // the next line is only executed if the statement is true
drawString "You have been blessed"

Starts a conditional expression
a variable reference name that holds the id of the actual picked up item
a logic operator that says: "is the same as"
a predefined constant to compare with
// the next line is only executed if the statement is true
a comment
a command with the single argument "You have been blessed"
Ends the conditional expression block

7.4. complex expressions back to top

this is more a theoretical part for freaks rather than something usefull :>
if 0 == %SHOW_POINTED_PLAYER & 512

means: if console variable cg_showPointedPlayer does not have the 10th bit set
what you need to know to understand it:
  • hudscript is parsed per line and from right to left
  • %SHOW_POINTED_PLAYER is a readout of cg_showPointedPlayer user-set console variable
  • & is a bitwise AND operator

7.5. drawing teamname back to top

Using the function drawStatString you can draw the team alpha and beta names (they are dependent on the clantags set).
In gametypes like duel and da, the teamnames take the form of: clan/name.
drawStatString 20

Draws the team Alpha name
drawStatString 21

Draws the team Beta name

8. Tips back to top

8.1. CFG script for reloading HUD back to top

Here is an example of cfg script, which can help you during HUD scripting process. Create a text file, rename it to cfg_hud.cfg and add the following:
bind H "+hud"
alias +hud "cg_clientHUD classic;cg_specHUD classic;clear"
alias -hud "cg_clientHUD your_hud_name;cg_specHUD your_hud_name;exec cfg_hud"

Save the file, load the Warsow and type /exec cfg_hud in console. After that you will need to press H key in game to reload the hud.

8.2. I would like to use my own font. How can I do it? back to top

You can use any font in .ttf or .otf format. You should place it in /basewsw/fonts.

8.3. Which font should I use for text outputs? back to top

You can use any font you like, but you should remember since Warsow has UI translation it is better to use fonts which have full set of symbols (not only Latin!). Otherwise your messages couldn't be seen on other languages except Latin-based.

8.4. Where I can find examples to make my own HUD based on them? back to top

  • You can find HUDs in Warsow 1.5\basewsw\data0_15.pk3. Extract huds folder from pk3-file to Warsow 1.5\basewsw\.
  • other wise you can use custom HUDs which can be found in this wiki or at our forum


Copyright © 2016

Warsow in social media