home · browse · search · game entities · user directory · message board · IRC | register

June 22, 2007, 6:33 am PDT
forgot password?

Popular Resources
  • Half-Life 2 Mod FAQ
  • Valve Hammer Editor
  • Hammer 3.5 beta test
  • Half-Life Utilities
  • game data files
  • ZHLT 2.5.3 custom build
  • Half-Life SDK
  • Feedback
    If you've got any feedback, suggestions, or bugs to report regarding the Collective website, go here!

  • Feedback (302)
  • Newsletter
    Enter your email address in the above form to add yourself to the email newsletter list. Click here for more info.

    Hosted Sites
  • Valve ERC
  • Collective
  • TFMapped
  • Spirit of Half-Life
  • Selective Design
  • Pixel Reviews
  • recent articles

    NPC and Item Placement Theory
    17/03/05 11:35pm PST
    Non-Player Character (NPC) and item placement can influence both the gameflow and immersion of a level. This article aims to give some pointers on how to properly place them.
    - Hugh 'Hugh' Lloyd

    Got Props?
    13/03/05 08:32am PST
    A common problem in HL2 mapping is props not showing up in game. This article explains why and offers solutions.
    - Jeff 'Yesukai' Pritchard

    Simulating Randomness
    18/12/04 11:29pm PST
    This article focuses on how to properly simulate random events that should occur at a certain average frequency, or within a certain probability per period of time.
    - Skyler 'Zipster' York

    Adding Single-Player Weapons to Half-Life 2
    15/12/04 06:52pm PST
    Covers the process behind adding weapons to a single-player Half-Life 2 modification.
    - Skyler 'Zipster' York

    Your world in HL2
    06/12/04 12:17am PST
    This article gives tips and advice to anyone wanting to make custom photorealistic textures to be used in Half-Life 2.
    - Oksid

    Hiding in Shadow
    21/08/04 01:11pm PDT
    Describes how to create a function that has monsters disregard you if you are hiding in a certain level of "darkness," which can be set from within map properties.
    - Anders [Wolf] Jenbo (NoBody)

    XSI EXP for Half-Life 2 Tutorial - Camera Control
    23/09/04 12:43am PDT
    A SOFTIMAGE|XSI tutorial explaining all of the camera controls available to you in XSI!
    - Josh Enes

    Bump Mapping in Half-Life
    08/08/04 11:58am PDT
    Details a method of achieving real-time bump mapping in Half-Life, and provides an implementation of the algorithm.
    - Francis 'DeathWish' Woodhouse

    Real-Time "TRON 2.0" Glow For Low-Spec Hardware
    19/06/04 02:06pm PDT
    A sequel to the original "Real-Time 'TRON 2.0' Glow" article, this describes how to implement real-time glow that works on low-spec graphics cards.
    - Francis 'DeathWish' Woodhouse

    Hitboxes and Code
    05/06/04 06:25pm PDT
    How do I make only one part of a monster take damage? Learn about the relationship between model hitboxes and what you can do with them in a characters code.
    - Jonathan 'Teh_Freak' Smith

    Customizable Hud Color
    [Wed Jul 02, 2003 / 06:30pm PDT] J.P.Barry - comments (35) comments enabled

    Take a good look at the HUD of half-life. Bored with that ol' dull dank orangey yellow? Well if you are then, this tutorial will allow you and your friends to choose any colour for the HUD regardless. Now you can have the greenish blue HUD of your dreams, or show your true colours with a lovely bright red HUD and if you get bored of your new HUD you can change it whenever you want, even in game !

    How do you do this? Well you have to open up the cl_dll project.

    We are going to store the HUD colour for the client in three cvars, one for each RGB component. These are 'hud_red', 'hud_green' and 'hud_blue'. We need to initialize these first so open up hud.cpp and open up init() (line 306).

    You will find two CVAR_CREATEs, add these three after them.

         CVAR_CREATE( "hud_red","255", FCVAR_ARCHIVE );
         CVAR_CREATE( "hud_green", "160", FCVAR_ARCHIVE );
         CVAR_CREATE( "hud_blue", "0", FCVAR_ARCHIVE );

    The FCVAR_ARCHIVE ensures that they will be remembered when you quit Half-Life.

    Now to business, load up cl_util.h and go to UnpackRGB() (line 153). We are going to 'hijack' the processing of the HUD colour as it is being separated from its hex value to its RGB components.


    inline void UnpackRGB(int &r;, int &g;, int &b;, unsigned long ulRGB)
         r = (ulRGB & 0xFF0000) >>16;
         g = (ulRGB & 0xFF00) >> 8;
         b = ulRGB & 0xFF;


    inline void UnpackRGB(int &r;, int &g;, int &b;, unsigned long ulRGB)
         if ( ulRGB == RGB_YELLOWISH )
              r = CVAR_GET_FLOAT( "hud_red" );
              g = CVAR_GET_FLOAT( "hud_green" );
              b = CVAR_GET_FLOAT( "hud_blue" );
              r = (ulRGB & 0xFF0000) >>16;
              g = (ulRGB & 0xFF00) >> 8;
              b = ulRGB & 0xFF;

    What this does is it sees if the colour is the default yellow color of the HUD and if it is it replaces it with the our cvar's values.

    This will ensure that all of the orange colored graphics will be coloured in your custom colour. This will work for all the graphics with one annoying exception (there's always one, isn't there?) The little bar between the health and the armor values has hard-coded values. This is an infamous problem for anyone whose tried to change the HUD's colour. To fix, open up health.cpp and scroll down to line 233.


    FillRGBA(x, y, iWidth, iHeight, 255, 160, 0, a);


    FillRGBA(x, y, iWidth, iHeight, r, g, b, a);

    That's it, now recompile the DLL and run the game. You can now edit the three cvars to get the desired color of your choice.

    Be forewarned though, the HUD is transparent so if you set all the cvars to 0, in order to get black, the HUD becomes totally transparent so use relatively high values and you'll be fine.

    Additional Feature

    You may have people who want to change their HUD but unfortunately they haven't a clue how to use the console. To fix this unavoidable problem you can add the cvars to the menu, under Multiplayer->Customize->Advanced Options. To do this open up user.scr in a text editor, scroll down to

              "Multiplayer decal limit"
              { NUMBER 0.000000 4096.000000 }
              { "300.000000" }

    and add the following

              "Hud Red"
              { NUMBER 0 255 }
              { "255" }
              "Hud Green"
              { NUMBER 0 255 }
              { "160" }
              "Hud Blue"
              { NUMBER 0 255 }
              { "0" }

    Close and Save.

    There you are, now anyone and everyone can have the power to personalize their games. Power to the People!
    article created on Wed Jul 02, 2003 / 01:40pm PDT
    this item has been viewed 13184 times
    [Half-Life / coding]

    Only registered users can post comments. Have you registered yet?

    35 results, 2 pages, viewing page 1.
    prev [ 1 2 ] next

    user comments

    displaying comments of normal or higher rating


    Chris 'autolycus' Bokitch
    Wed Jul 02, 2003 / 06:34pm PDT

      Great article - concise and well explained! If it's this easy, there's no excuse to not add this to a mod. :)
    comment modified on Wed Jul 02, 2003 / 06:36pm PDT


    Logan "Drizzt" Ver Hoef
    Wed Jul 02, 2003 / 09:35pm PDT


    YAY! Now I can have a forest-green HUD. Or something.


    Michael Mallet
    Thu Jul 03, 2003 / 06:19pm PDT

      I'm adding this to my mod for sure.
    Fits in very well too.


    Hugh 'Hugh' Lloyd
    Fri Jul 04, 2003 / 12:48pm PDT

      This article's beautiful. Hope it works for HL2. ;)


    Skyler 'Zipster' York
    Sat Jul 05, 2003 / 12:33am PDT

      I will concur that it is this easy.


    Michiel "MuzzleFlash" Breddels
    Sat Jul 05, 2003 / 05:58am PDT

      YAY! I successfully compile the client.dll file. But where did MSV put it? I can't find it. How can you tell MSV to place a compilled dll in the right MOD folder automatically?

    I compiled the client.dll, and i want to be placed in
    Half-Life\mymod\cl_dlls automatically.



    Michiel "MuzzleFlash" Breddels
    Sat Jul 05, 2003 / 06:09am PDT

      Hmmm, MSV places the compiled dll in
    C:\Half-Life\SDK\Single-Player Source\cl_dll\Release.

    Anyway, IT WORKS!!! OWNED! Even the new settings in the customize menu work.

    Thanks J.P.Barry.

    comment modified on Sat Jul 05, 2003 / 06:14am PDT


    Sat Jul 05, 2003 / 06:39am PDT

      MuzzleFlash. I'm afraid I don't know exactly if this is the same for your editing program but in MS VC++ 6.0, in order to get it to automatically compile to mod\cl_dlls go Project->Settings... then go to the tab 'Link' and in the textbox 'Output file name' put the directory of the cl_dll directory.

    e.g. C:\Sierra\Half-Life\mod\cl_dlls\client.dll

    Hope this works in your version.


    Michiel "MuzzleFlash" Breddels
    Sat Jul 05, 2003 / 08:17am PDT

      Yes, i use MSV C++ 6.0
    And it works.

    Thanks again.



    Chris 'autolycus' Bokitch
    Thu Jul 10, 2003 / 04:54pm PDT

      Do not post links to cheats or cheat enabling programs.

    Also, do not make patronizing remarks to the admins.


    Also, keep on topic or take it to the appropriate message board.
    [OT posts removed]
    comment modified on Fri Jul 11, 2003 / 03:44pm PDT


    Iron Curtain
    Sun Jul 13, 2003 / 11:03am PDT

      Why isn't this working???
    I followed the tutorial precisely, compiled the DLL without any errors and HL still displays the HUD in this pesky orange...
    I'm using the german versions of MSVC and HL but this shouldn't be the reason...can anybody help????


    Michiel "MuzzleFlash" Breddels
    Sun Jul 13, 2003 / 01:05pm PDT

      Did you placed the new client.dll and users.scr in the right folder? Make sure you make a backup of the original files first.



    Iron Curtain
    Sun Jul 13, 2003 / 01:49pm PDT

      no..thats not it ... actually the client.dll is loaded (the menu etries for the hud-colors show up) but not properly carried out or something..i don't know (f*ck)
    there is absolutely no error in the source code nor in the liblist.gam or the MOD-folder (all files placed in the folder are loaded properly)..any guesses???

    Does this work with the 2.3 SDK???
    comment modified on Sun Jul 13, 2003 / 02:00pm PDT


    Mon Jul 14, 2003 / 02:17pm PDT

      Thats some pretty cool stuff there :)


    Adrian Shephard
    Mon Jul 14, 2003 / 05:36pm PDT

      Which one do you change to change the whole color of the HUD? (I'm new to this);p I managed to get the weapon sprite to be green when its out of ammo but I want to change the whole HUD color.


    Adrian Shephard
    Mon Jul 14, 2003 / 08:14pm PDT

      I figured it out. Where it says this in cl_util.h:

    inline void UnpackRGB(int &r;, int &g;, int &b;, unsigned long ulRGB)
    if ( ulRGB == RGB_YELLOWISH )
    r = CVAR_GET_FLOAT( "hud_red" );
    g = CVAR_GET_FLOAT( "hud_green" );
    b = CVAR_GET_FLOAT( "hud_blue" );
    r = (ulRGB & 0xFF0000) >>16;
    g = (ulRGB & 0xFF00) >> 8;
    b = ulRGB & 0xFF;

    change "YELLOWISH" to "(yourcolor)ISH" I'll give you an example mine is "GREENISH", and dont forget you have to change the color numbers too.


    Gunsmith Dragon
    Fri Jul 18, 2003 / 07:12pm PDT

      Wow. This is a neat addition. Even though I'm new to coding, this was really easy to add in!

    Just one thing: how do you make it permanent? I'd like to make the hud white for the mod I'm working on.


    ~Gunsmith Dragon


    Sun Jul 20, 2003 / 10:41am PDT

      how i can decompile the cl_dll.dll ? i need a decompiler ? :( what program? %)
    comment modified on Sun Jul 20, 2003 / 06:36pm PDT


    Skyler 'Zipster' York
    Mon Jul 21, 2003 / 12:43am PDT


      Just one thing: how do you make it permanent? I'd like to make the hud white for the mod I'm working on.

    Replace CVAR_GET_FLOAT( "hud_xxx" ); with a number from 0 to 255 to hardcode a color. I think white would be 255 for all three values. But that's a pretty intense white, you might want to experiment with lesser values. Whatever the case, it would be in the grayscale spectrum, so all values should be the same.

      how i can decompile the cl_dll.dll ? i need a decompiler ?

    Programs exist for decompiling modules into assembly code, but that's hardly useful, and you won't be able to make any changes anyway.


    Tue Jul 22, 2003 / 04:54pm PDT

      why i wont be able to make any changes? if you know any program, tell me :)

    35 results, 2 pages, viewing page 1.
    prev [ 1 2 ] next

    VERC © 2004. All content copyright its respective owner, all rights reserved.
    script execution time: 0.520833015442 seconds