Results 1 to 6 of 6

Thread: Shader + Text/value

  1. #1
    Private First Class Earliboy's Avatar
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    130
    Thanks
    5
    Thanked 88 Times in 61 Posts

    Question Shader + Text/value

    Hello,
    i don't wanna waste hudelems so i want to use a shader + an value
    PHP Code:
        self.healthbar_cross newClientHudElem(self);
        
    self.healthbar_cross setShader("gfx/hud/hud@health_cross.tga"1010);
        
    self.healthbar_cross.alignX "right";
        
    self.healthbar_cross.alignY "top";
        
    self.healthbar_cross.sort 9001;
        
    self.healthbar_cross.20;
        
    self.healthbar_cross.y2 15
    I want to add self.healthbar_cross setValue(self.preHealth);
    But if i do that, the shader doesnt shows anymore.

    Any ideas? Or is it just not possible?
    And no, i don't want to use another hudelem cause the elem limit for players (thats just useless :/ )
    No ... No ... this is not possible .......

  2. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Either:

    .label + settext/setvalue

    OR

    setshader

    Nothing else.

    Create another hud for the text.

  3. #3
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by Earliboy View Post
    Hello,
    i don't wanna waste hudelems so i want to use a shader + an value
    PHP Code:
        self.healthbar_cross newClientHudElem(self);
        
    self.healthbar_cross setShader("gfx/hud/hud@health_cross.tga"1010);
        
    self.healthbar_cross.alignX "right";
        
    self.healthbar_cross.alignY "top";
        
    self.healthbar_cross.sort 9001;
        
    self.healthbar_cross.20;
        
    self.healthbar_cross.y2 15
    I want to add self.healthbar_cross setValue(self.preHealth);
    But if i do that, the shader doesnt shows anymore.

    Any ideas? Or is it just not possible?
    And no, i don't want to use another hudelem cause the elem limit for players (thats just useless :/ )
    There is no point writing a health bar hud element as their is a stock one. It was never eneabled because Infinity Ward decided to abandon the old COD1 health system and go with the regeneration health system instead. The only thing you have to do with a health bar is:

    1. Decide where it is going to go;
    2. Set the client cvars so that it will show.

    1. To determine where the health bar will go, look in ui_mp/hud.menu and search for "health bar". You will find this:

    PHP Code:
        // HEALTH BAR
        
    menuDef
        
    {
            
    name "Health"
            
    fullScreen MENU_FALSE
            visible MENU_TRUE
            rect 
    -152 -20 0 0 HORIZONTAL_ALIGN_RIGHT VERTICAL_ALIGN_BOTTOM
            
            itemDef
            
    {
                
    name "healthbarback"
                
    rect 13 0 130 12
                forecolor 1.0 1.0 1.0 1.0
                background 
    "gfx/hud/hud@health_back.tga"
                
    ownerdraw CG_PLAYER_BAR_HEALTH_BACK
                visible MENU_TRUE
                decoration
            
    }
            
    itemDef
            
    {
                
    name "healthbar"
                
    rect 14 1 128 10
                forecolor 0.7 0.4 0.0 1.0
                background 
    "gfx/hud/hud@health_bar.tga"
                
    ownerdraw CG_PLAYER_BAR_HEALTH
                visible MENU_TRUE
                decoration
            
    }
            
    itemDef
            
    {
                
    name "healthbarcross"
                
    rect 0 0 12 12
                forecolor 1.0 1.0 1.0 1.0
                background 
    "gfx/hud/hud@health_cross.tga"
                
    ownerdraw CG_PLAYER_BAR_HEALTH_BACK
                visible MENU_TRUE
                decoration
            
    }
        } 
    Those are the stock settings. I changed them in my Demon mod to these:

    PHP Code:
        // HEALTH BAR
        
    menuDef
        
    {
            
    name "Health"
            
    fullScreen MENU_FALSE
            visible MENU_TRUE
            rect 45 448 640 40
            itemDef
            
    {
                
    name "healthbarback"
                
    rect 557.5 12 90 7
                forecolor 1.0 1.0 1.0 1.0
                background 
    "gfx/hud/hud@health_back.tga"
                
    ownerdraw CG_PLAYER_BAR_HEALTH_BACK
                visible MENU_TRUE
                decoration
                dvartest  
    "scr_demon_hardcore"
                
    showDvar  "0" }
            }
            
    itemDef
            
    {
                
    name "healthbar"
                
    rect 558.5 13 88 5
                forecolor 0.7 0.4 0.0 1.0
                background 
    "gfx/hud/hud@health_bar.tga"
                
    ownerdraw CG_PLAYER_BAR_HEALTH
                visible MENU_TRUE
                decoration
                dvartest  
    "scr_demon_hardcore"
                
    showDvar  "0" }
            }
            
    itemDef
            
    {
                
    name "healthbarcross"
                
    rect 545 11 10 10
                forecolor 1.0 1.0 1.0 1.0
                background 
    "gfx/hud/hud@health_cross.tga"
                
    ownerdraw CG_PLAYER_BAR_HEALTH_BACK
                visible MENU_TRUE
                decoration
                dvartest  
    "scr_demon_hardcore"
                
    showDvar  "0" }
            }
        } 
    This places the health bar here:



    (lower right-hand corner in green).

    2. To enable the health bar, just set 2 cvars on the client:

    PHP Code:
            self setClientCvar"cg_drawhealth""1" );
            
    self setClientCvar"hud_fade_healthbar""0" ); 
    That's all you have to do. Believe me - the stock health bar is far superior to anything you can script because it glows and pluses when the player is damaged in a way that would be difficult to script.

  4. The Following User Says Thank You to Tally For This Useful Post:

    kung foo man (10th April 2013)

  5. #4
    Private First Class Earliboy's Avatar
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    130
    Thanks
    5
    Thanked 88 Times in 61 Posts
    Well, my healthbar is working good and fine. I just wanted to change the value of health to the cross shader so u can see your actually health as value.
    I allready done that but i use another extra hudelem for that.

    But thanks for your answers.
    No ... No ... this is not possible .......

  6. #5
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by Earliboy View Post
    Well, my healthbar is working good and fine. I just wanted to change the value of health to the cross shader so u can see your actually health as value.
    I allready done that but i use another extra hudelem for that.

    But thanks for your answers.
    Before I learnt there was a stock healthbar I too wrote one. It too worked good and fine. Only problem is, it 1) takes up valuable client assets (there is a limit on hud elements and it is not a good idea to use one when you don't need to), and 2) the stock one works better than "good and fine".

    Your choice, but I always believe there is no point in re-inventing the wheel unless you really have to.

  7. The Following User Says Thank You to Tally For This Useful Post:

    kung foo man (11th April 2013)

  8. #6
    Private First Class Earliboy's Avatar
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    130
    Thanks
    5
    Thanked 88 Times in 61 Posts
    Ye i could use that one, but i don't want the healthbar at the bottom of the screen, its just too small it nobody cares about it.
    I wanted it like this.

    (The problem was the Cross + the value on the top of the bar). Now i used shader + new hudelem
    Click image for larger version. 

Name:	healtbar_2.png 
Views:	44 
Size:	95.5 KB 
ID:	215
    No ... No ... this is not possible .......

  9. The Following User Says Thank You to Earliboy For This Useful Post:

    kung foo man (11th April 2013)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •