I'm trying to make buttons on my HUD that are normal rectangles, i.e. no rounded corners, as backgrounds for the health in my hud. This would be similar to yahud's FLV buttons.
I would imagine the buttons are defined in clientscheme.res but there are many, and I don't know which ones would be used in this scenario.
I'm trying to make buttons on my HUD that are normal rectangles, i.e. no rounded corners, as backgrounds for the health in my hud. This would be similar to yahud's FLV buttons.
I would imagine the buttons are defined in clientscheme.res but there are many, and I don't know which ones would be used in this scenario.
If you just want rectangles it'd probably be easier to just make some imagepanels then center them behind your health/ammo?
If you just want rectangles it'd probably be easier to just make some imagepanels then center them behind your health/ammo?
BenroadsIf you just want rectangles it'd probably be easier to just make some imagepanels then center them behind your health/ammo?
This is what I thought of doing first, but I couldn't find a way to change the fillcolor in hudanimations.txt for buffed/low health. I even tried creating separate images for buffed/low health, but I couldn't turn them on and off through the hudanimations.txt events.
I looked into yaHUD and BXHUD and both of them use buttons to achieve the effect so I figured that was the only way to do it.
[quote=Benroads]If you just want rectangles it'd probably be easier to just make some imagepanels then center them behind your health/ammo?[/quote]
This is what I thought of doing first, but I couldn't find a way to change the fillcolor in hudanimations.txt for buffed/low health. I even tried creating separate images for buffed/low health, but I couldn't turn them on and off through the hudanimations.txt events.
I looked into yaHUD and BXHUD and both of them use buttons to achieve the effect so I figured that was the only way to do it.
Uh I was under the impression you could just change the fillcolor of something through animations. I can't say I know much about animation stuff with HUDs but I'm fairly sure you could make a imagepanel and then through the buffed/low animation change the fillcolor
Uh I was under the impression you could just change the fillcolor of something through animations. I can't say I know much about animation stuff with HUDs but I'm fairly sure you could make a imagepanel and then through the buffed/low animation change the fillcolor
BenroadsUh I was under the impression you could just change the fillcolor of something through animations. I can't say I know much about animation stuff with HUDs but I'm fairly sure you could make a imagepanel and then through the buffed/low animation change the fillcolor
I tried, but animating "fillcolor" hasn't done anything for me. According to the top of hudanimations.txt, the only color commands for panels are fgcolor and bgcolor (neither of which worked), and alpha is only for the HUD weapon selection (as it also doesn't work).
[quote=Benroads]Uh I was under the impression you could just change the fillcolor of something through animations. I can't say I know much about animation stuff with HUDs but I'm fairly sure you could make a imagepanel and then through the buffed/low animation change the fillcolor[/quote]
I tried, but animating "fillcolor" hasn't done anything for me. According to the top of hudanimations.txt, the only color commands for panels are fgcolor and bgcolor (neither of which worked), and alpha is only for the HUD weapon selection (as it also doesn't work).
"HealthBG"
{
"ControlName" "CExImageButton"
"fieldName" "HealthBG"
"xpos" "c-193"
"ypos" "343"
"zpos" "1"
"wide" "95"
"tall" "39"
"autoResize" "0"
"pinCorner" "0"
"visible" "1"
"enabled" "1"
"defaultBgColor_Override" "Blank"
"PaintBackgroundType""0"
}
Animate HealthBG BgColor "Negative" Accel 0.0 0.0
You said you looked at yahud so I'm not sure why you didn't do this, but all you have to do is copy and paste the element and change whatever fields you need to. I'm not sure what you're talking about with defining buttons, but CExImageButton doesn't require anything outside of the file you're using it if that's what you mean.
[code]"HealthBG"
{
"ControlName" "CExImageButton"
"fieldName" "HealthBG"
"xpos" "c-193"
"ypos" "343"
"zpos" "1"
"wide" "95"
"tall" "39"
"autoResize" "0"
"pinCorner" "0"
"visible" "1"
"enabled" "1"
"defaultBgColor_Override" "Blank"
"PaintBackgroundType""0"
}[/code]
[code]Animate HealthBG BgColor "Negative" Accel 0.0 0.0[/code]
You said you looked at yahud so I'm not sure why you didn't do this, but all you have to do is copy and paste the element and change whatever fields you need to. I'm not sure what you're talking about with defining buttons, but CExImageButton doesn't require anything outside of the file you're using it if that's what you mean.
trog-snip-
I have done this, here is the result:
http://cloud-2.steampowered.com/ugc/721995326414005878/227AAD2455A7FACEB186A1FF09B999D9EA4814C8/
As you can see, although it animates just fine, the button is still rounded at the corners (the bottom box being a regular image panel that I can't seem to animate the same way).
I would think it has something to do with draw_corner_width/height for the buttons in ClientScheme.res, but there's quite a lot of them and I would have to restart TF2 each time I wanted to test the changes.
[quote=trog]-snip-[/quote]
I have done this, here is the result:
[img]http://cloud-2.steampowered.com/ugc/721995326414005878/227AAD2455A7FACEB186A1FF09B999D9EA4814C8/[/img]
As you can see, although it animates just fine, the button is still rounded at the corners (the bottom box being a regular image panel that I can't seem to animate the same way).
I would think it has something to do with draw_corner_width/height for the buttons in ClientScheme.res, but there's quite a lot of them and I would have to restart TF2 each time I wanted to test the changes.
Hm, not sure then, it's always worked fine like that for me. All I can think of is to just copy all the defintions you're talking about from some other HUD where it works, and see if that fixes it.
Hm, not sure then, it's always worked fine like that for me. All I can think of is to just copy all the defintions you're talking about from some other HUD where it works, and see if that fixes it.
If you use image panels, use the technique that HUDAS uses. Make multiple image panels of different colors (Buff/Low/Normal) and have them change "alpha" rather than color.
Example:
"HealthBarLow"
{
"ControlName" "ImagePanel"
"fieldName" "HealthBarLow"
"xpos" "52"
"ypos" "32"
"zpos" "5"
"wide" "88"
"tall" "38"
"autoResize" "0"
"pinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"alpha" "0"
"fillcolor" "192 28 0 255"
"PaintBackgroundType" "0"
}
Notice alpha is set to 0
So put this in hudanimations_tf.txt, under event HudHealthBonusPulse
Animate HealthBarBuff Alpha "255" Accel 0.0 0.0
And this under event HudHealthBonusPulseStop
Animate HealthBarBuff Alpha "0" Accel 0.0 0.0
So when you get buffs, the box will appear, and as soon as you go back to normal it'll disappear, like it's supposed too.
Of course if you have another box that is normal, make sure to animate it so it goes from 255 to 0 and back. I'm sure you're aware of this but it's worth noting anyway.
If that doesn't work out for you, shoot me a PM and I'll help you out in greater detail.
EDIT: Another solution to your problem may be to add "border" or "border_override" and set it to "noborder"
"border" "noborder"
"border_override" "noborder"
If you use image panels, use the technique that HUDAS uses. Make multiple image panels of different colors (Buff/Low/Normal) and have them change "alpha" rather than color.
Example:
[code]
"HealthBarLow"
{
"ControlName" "ImagePanel"
"fieldName" "HealthBarLow"
"xpos" "52"
"ypos" "32"
"zpos" "5"
"wide" "88"
"tall" "38"
"autoResize" "0"
"pinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"alpha" "0"
"fillcolor" "192 28 0 255"
"PaintBackgroundType" "0"
}
[/code]
Notice alpha is set to 0
So put this in hudanimations_tf.txt, under event HudHealthBonusPulse
[code]
Animate HealthBarBuff Alpha "255" Accel 0.0 0.0
[/code]
And this under event HudHealthBonusPulseStop
[code]
Animate HealthBarBuff Alpha "0" Accel 0.0 0.0
[/code]
So when you get buffs, the box will appear, and as soon as you go back to normal it'll disappear, like it's supposed too.
Of course if you have another box that is normal, make sure to animate it so it goes from 255 to 0 and back. I'm sure you're aware of this but it's worth noting anyway.
If that doesn't work out for you, shoot me a PM and I'll help you out in greater detail.
[b]EDIT:[/b] Another solution to your problem may be to add "border" or "border_override" and set it to "noborder"
[code]
"border" "noborder"
"border_override" "noborder"
[/code]
omni-snip-
Wonderful, thanks omni. I was using the alpha variable incorrectly, as I assumed it would just use the alpha number in the fillcolor field. (The border/border_override solution, on the other hand, did not change anything for me.)
Thanks for your help, guys.
[quote=omni]-snip-[/quote]
Wonderful, thanks omni. I was using the alpha variable incorrectly, as I assumed it would just use the alpha number in the fillcolor field. (The border/border_override solution, on the other hand, did not change anything for me.)
Thanks for your help, guys.