Upvote Upvoted 4 Downvote Downvoted
flashing bar on damage
posted in Q/A Help
1
#1
3 Frags +

Hi, so I've been trying to incorporate into PVHud a wide, thin horizontal bar runing between the health and ammo counts that is invisible, except flashes red on damage (like a visual hitsound). I've managed to get something, however all I can do is a tiny red line, and I don't know how to increase the size.

In HudAnimations_tf, I have:

event DamagedPlayer
{
Animate HitIndicator FgColor "255 0 0 255" Linear 0.0 0.1
Animate HitIndicator FgColor "0 0 0 0" Linear 0.2 0.200001
}

In hudlayout.res, I have:

HitIndicator
{
"controlName" "CExLabel"
"fieldName" "HitIndicator"
"visible" "1"
"enabled" "1"
"zpos" "2"

"xpos" "c-100"
"ypos" "c-100"
"wide" "200"
"tall" "200"

"font" "???"
"labelText" "_"
"textAlignment" "center"

"fgcolor" "0 0 0 0"
}

If anyone could help me with getting a font to work and increasing its size or (ideally) using an ImagePanel to get a really thin line that animates like this, I would be very thankful.

Hi, so I've been trying to incorporate into PVHud a wide, thin horizontal bar runing between the health and ammo counts that is invisible, except flashes red on damage (like a visual hitsound). I've managed to get something, however all I can do is a tiny red line, and I don't know how to increase the size.

In HudAnimations_tf, I have:

[quote]
event DamagedPlayer
{
Animate HitIndicator FgColor "255 0 0 255" Linear 0.0 0.1
Animate HitIndicator FgColor "0 0 0 0" Linear 0.2 0.200001
}
[/quote]

In hudlayout.res, I have:
[quote] HitIndicator
{
"controlName" "CExLabel"
"fieldName" "HitIndicator"
"visible" "1"
"enabled" "1"
"zpos" "2"

"xpos" "c-100"
"ypos" "c-100"
"wide" "200"
"tall" "200"

"font" "???"
"labelText" "_"
"textAlignment" "center"

"fgcolor" "0 0 0 0"
}[/quote]

If anyone could help me with getting a font to work and increasing its size or (ideally) using an ImagePanel to get a really thin line that animates like this, I would be very thankful.
2
#2
1 Frags +

you could try taking one of the crosshairs that do it (knhud does) offsetting it so that it is situated where you want, and then making it some insane size

if you turned the opacity (the 4th color number) to 0 on all but the part that flashes, it should work just the same

you could try taking one of the crosshairs that do it (knhud does) offsetting it so that it is situated where you want, and then making it some insane size

if you turned the opacity (the 4th color number) to 0 on all but the part that flashes, it should work just the same
3
#3
0 Frags +
BLoodSireyou could try taking one of the crosshairs that do it (knhud does) offsetting it so that it is situated where you want, and then making it some insane size

if you turned the opacity (the 4th color number) to 0 on all but the part that flashes, it should work just the same

Thanks, but the problem I'm having is when I change the wide and tall, nothing really happens (ie idk how to change size). Also I don't really know how to incorporate fonts into a hud (where to put the font files? how to make them work?). Thanks for your help anyway

[quote=BLoodSire]you could try taking one of the crosshairs that do it (knhud does) offsetting it so that it is situated where you want, and then making it some insane size

if you turned the opacity (the 4th color number) to 0 on all but the part that flashes, it should work just the same[/quote]

Thanks, but the problem I'm having is when I change the wide and tall, nothing really happens (ie idk how to change size). Also I don't really know how to incorporate fonts into a hud (where to put the font files? how to make them work?). Thanks for your help anyway
4
#4
0 Frags +

What is the fonts tall value in clientscheme? Like if you were too look for your ??? font in the custom font definition area you could make a new definition just for this hitbar thing and have it have a very large tall value so the bar would be a bit larger. Not sure how practical this would be but it should work.

EDIT:

http://puu.sh/4EQXX.png

That's a general idea of what the definition would look like.

Also, while this video isn't exactly what you're looking for Rays did a really good video about transferring fonts from hud to hud to use them in crosshairs and you could apply this to installing brand new fonts.

http://www.youtube.com/watch?v=wPH6On2F0Pw

What is the fonts tall value in clientscheme? Like if you were too look for your ??? font in the custom font definition area you could make a new definition just for this hitbar thing and have it have a very large tall value so the bar would be a bit larger. Not sure how practical this would be but it should work.

EDIT:

[img]http://puu.sh/4EQXX.png[/img]

That's a general idea of what the definition would look like.

Also, while this video isn't exactly what you're looking for Rays did a really good video about transferring fonts from hud to hud to use them in crosshairs and you could apply this to installing brand new fonts.

[youtube]http://www.youtube.com/watch?v=wPH6On2F0Pw[/youtube]
5
#5
0 Frags +

Well, since you're using a CExLabel, you have to define a font. Then, for the labelText, add more underscores "_______________________" like such until you find the correct length.

Well, since you're using a CExLabel, you have to define a font. Then, for the labelText, add more underscores "_______________________" like such until you find the correct length.
6
#6
0 Frags +

Put this in your HudDamageAccount.res and edit xpos, ypos, wide and tall to your desired specifications. This way its easier cause the animation when doing damage is already done for the whole file. All you need is create your own element.

"HitIndicator"
{
"controlName" "ImagePanel"
"fieldName" "bar"
"xpos" "c-100"
"ypos" "r138"
"zpos" "1"
"wide" "200"
"tall" "2"
"autoResize" "0"
"pinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"fillcolor" "lowhealthred"
"PaintBackgroundType" "0"
}

Put this in your HudDamageAccount.res and edit xpos, ypos, wide and tall to your desired specifications. This way its easier cause the animation when doing damage is already done for the whole file. All you need is create your own element.

"HitIndicator"
{
"controlName" "ImagePanel"
"fieldName" "bar"
"xpos" "c-100"
"ypos" "r138"
"zpos" "1"
"wide" "200"
"tall" "2"
"autoResize" "0"
"pinCorner" "0"
"visible" "1"
"enabled" "1"
"tabPosition" "0"
"fillcolor" "lowhealthred"
"PaintBackgroundType" "0"
}
7
#7
0 Frags +

Thank you all, everything has helped. I'll try out that ImagePanel method, and otherwise I'll use a font I've found (just didn't know I had to put stuff in clientscheme.res).

edit: Rawr that method is really nice, but is there any way to make the flash a little less long-lasting and sudden? I really like the smooth flash from the other method

edit edit: actually I prefer the font method, and it works, but for some reason lots of other stuff in my hud is gone now. Help?

Thank you all, everything has helped. I'll try out that ImagePanel method, and otherwise I'll use a font I've found (just didn't know I had to put stuff in clientscheme.res).

edit: Rawr that method is really nice, but is there any way to make the flash a little less long-lasting and sudden? I really like the smooth flash from the other method

edit edit: actually I prefer the font method, and it works, but for some reason lots of other stuff in my hud is gone now. Help?
8
#8
0 Frags +
qoskThank you all, everything has helped. I'll try out that ImagePanel method, and otherwise I'll use a font I've found (just didn't know I had to put stuff in clientscheme.res).

edit: Rawr that method is really nice, but is there any way to make the flash a little less long-lasting and sudden? I really like the smooth flash from the other method

hmm the flash is connected to the duration of the damage down to opponents. They share the same file afterall. I tried animating the lines to do flash in a quick and short manner just once but doesnt seem to work. Ill get back to you.

[quote=qosk]Thank you all, everything has helped. I'll try out that ImagePanel method, and otherwise I'll use a font I've found (just didn't know I had to put stuff in clientscheme.res).

edit: Rawr that method is really nice, but is there any way to make the flash a little less long-lasting and sudden? I really like the smooth flash from the other method[/quote]

hmm the flash is connected to the duration of the damage down to opponents. They share the same file afterall. I tried animating the lines to do flash in a quick and short manner just once but doesnt seem to work. Ill get back to you.
9
#9
1 Frags +

use pt's crosshairless crosshair. reduce the opacity add the damage animation to it

http://i.imgur.com/0Qbub.jpg

use pt's crosshairless crosshair. reduce the opacity add the damage animation to it

[img]http://i.imgur.com/0Qbub.jpg[/img]
10
#10
0 Frags +
eulogy_use pt's crosshairless crosshair. reduce the opacity add the damage animation to it

http://i.imgur.com/0Qbub.jpg

thanks but i really don't like that kind of crosshair

[quote=eulogy_]use pt's crosshairless crosshair. reduce the opacity add the damage animation to it

[img]http://i.imgur.com/0Qbub.jpg[/img][/quote]

thanks but i really don't like that kind of crosshair
11
#11
1 Frags +

Okay so I've got it working, I'll post what I have here just in case anyone else wants it to mod/whatever (I think it's pretty neat, no more pesky hitsounds required).

It's a thin, horizontal line just below the crosshair, I toyed with a larger one between the hp and ammo but this looks nicer.

In hudlayout.res:

HitIndicator
{
"controlName" "CExLabel"
"fieldName" "HitIndicator"
"visible" "1"
"enabled" "1"
"zpos" "2"

"xpos" "c-150"
"ypos" "c-130"
"wide" "300"
"tall" "300"

"font" "HitIndicator"
"labelText" "________________"
"textAlignment" "center"

"fgcolor" "0 0 0 0"
}

Under FONTS in ClientScheme.res:

"HitIndicator"
{
"1"
{
"name" "hitline"
"tall" "12"
"weight" "0"
"antialias" "1"
}
}

Under CUSTOM FONTS in ClientScheme.res:

"8" //replace with number 1 higher than the otherwise final
//number e.g. if you have 12 custom fonts already in
//this will be 13
{
"font" "resource/Neou-Bold.ttf"
"name" "hitline"
}

And finally in HudAnimations_tf.txt:

event DamagedPlayer
{
Animate HitIndicator FgColor "255 0 0 255" Linear 0.0 0.1
Animate HitIndicator FgColor "0 0 0 0" Linear 0.2 0.200001
}

(if you have a custom hud installed ctrl+f DamagedPlayer and then put the contents of your brackets in there)

download http://www.dafont.com/neou.font and put it in your resource folder. Thanks everyone for all the help!

PS: It works for 1280x800 but idk about other resolutions

edited for better aesthetics, some other stuff

Okay so I've got it working, I'll post what I have here just in case anyone else wants it to mod/whatever (I think it's pretty neat, no more pesky hitsounds required).

It's a thin, horizontal line just below the crosshair, I toyed with a larger one between the hp and ammo but this looks nicer.

In hudlayout.res:
[quote] HitIndicator
{
"controlName" "CExLabel"
"fieldName" "HitIndicator"
"visible" "1"
"enabled" "1"
"zpos" "2"

"xpos" "c-150"
"ypos" "c-130"
"wide" "300"
"tall" "300"

"font" "HitIndicator"
"labelText" "________________"
"textAlignment" "center"

"fgcolor" "0 0 0 0"
}[/quote]

Under FONTS in ClientScheme.res:
[quote] "HitIndicator"
{
"1"
{
"name" "hitline"
"tall" "12"
"weight" "0"
"antialias" "1"
}
}[/quote]

Under CUSTOM FONTS in ClientScheme.res:
[quote] "8" //replace with number 1 higher than the otherwise final
//number e.g. if you have 12 custom fonts already in
//this will be 13
{
"font" "resource/Neou-Bold.ttf"
"name" "hitline"
}[/quote]

And finally in HudAnimations_tf.txt:
[quote]event DamagedPlayer
{
Animate HitIndicator FgColor "255 0 0 255" Linear 0.0 0.1
Animate HitIndicator FgColor "0 0 0 0" Linear 0.2 0.200001
}[/quote]
(if you have a custom hud installed ctrl+f DamagedPlayer and then put the contents of your brackets in there)

download http://www.dafont.com/neou.font and put it in your resource folder. Thanks everyone for all the help!

PS: It works for 1280x800 but idk about other resolutions

edited for better aesthetics, some other stuff
12
#12
0 Frags +
qoskeulogy_use pt's crosshairless crosshair. reduce the opacity add the damage animation to it

http://i.imgur.com/0Qbub.jpg

thanks but i really don't like that kind of crosshair

its not for the crosshair, its an alternative option to get the flashing screen u seem to want. You can still run whatever crosshair u want over it

[quote=qosk][quote=eulogy_]use pt's crosshairless crosshair. reduce the opacity add the damage animation to it

http://i.imgur.com/0Qbub.jpg[/quote]

thanks but i really don't like that kind of crosshair[/quote]

its not for the crosshair, its an alternative option to get the flashing screen u seem to want. You can still run whatever crosshair u want over it
13
#13
0 Frags +

Doing this with a font is significantly harder than with image panels because you have to deal with font type, height and weight. Image panels can be used to simply create a rectangle with defined dimensions.

Put something like

HitIndicator
{
"controlName" "ImagePanel"
"fieldName"	 "HitIndicator"
"visible"	 "1"
"enabled"	 "1"
"zpos"	 "2"
"xpos"	 "c-150"
"ypos"	 "c-130"
"wide"	 "300"
"tall"	 "4"
"fillcolor"	 "255 0 0"
"alpha" "0"
}

in hudlayout,
then just animate the alpha to 255 in hudanimations

I suggest reading through

Doing this with a font is significantly harder than with image panels because you have to deal with font type, height and weight. Image panels can be used to simply create a rectangle with defined dimensions.

Put something like

[code]HitIndicator
{
"controlName" "ImagePanel"
"fieldName" "HitIndicator"
"visible" "1"
"enabled" "1"
"zpos" "2"
"xpos" "c-150"
"ypos" "c-130"
"wide" "300"
"tall" "4"
"fillcolor" "255 0 0"
"alpha" "0"
}[/code]

in hudlayout,
then just animate the alpha to 255 in hudanimations

I suggest reading through
14
#14
0 Frags +
piklesDoing this with a font is significantly harder than with image panels because you have to deal with font type, height and weight. Image panels can be used to simply create a rectangle with defined dimensions.

Put something like
HitIndicator
{
"controlName" "ImagePanel"
"fieldName"	 "HitIndicator"
"visible"	 "1"
"enabled"	 "1"
"zpos"	 "2"
"xpos"	 "c-150"
"ypos"	 "c-130"
"wide"	 "300"
"tall"	 "4"
"fillcolor"	 "255 0 0"
"alpha" "0"
}

in hudlayout,
then just animate the alpha to 255 in hudanimations

I suggest reading through
[quote=pikles]Doing this with a font is significantly harder than with image panels because you have to deal with font type, height and weight. Image panels can be used to simply create a rectangle with defined dimensions.

Put something like

[code]HitIndicator
{
"controlName" "ImagePanel"
"fieldName" "HitIndicator"
"visible" "1"
"enabled" "1"
"zpos" "2"
"xpos" "c-150"
"ypos" "c-130"
"wide" "300"
"tall" "4"
"fillcolor" "255 0 0"
"alpha" "0"
}[/code]

in hudlayout,
then just animate the alpha to 255 in hudanimations

I suggest reading through
15
#15
0 Frags +

same way, just replace fgcolor with alpha

event DamagedPlayer
{
	RunEvent HitIndicatorHit 0.0
}

event HitIndicatorHit 
{
	Animate HitIndicator Alpha "128" Linear 0.0 0.0
	Animate HitIndicator Alpha "0" Linear 0.2 0.0
}
same way, just replace fgcolor with alpha

[code]event DamagedPlayer
{
RunEvent HitIndicatorHit 0.0
}

event HitIndicatorHit
{
Animate HitIndicator Alpha "128" Linear 0.0 0.0
Animate HitIndicator Alpha "0" Linear 0.2 0.0
}
[/code]
16
#16
0 Frags +

okay thanks a lot, ImagePanels are much nicer + easier to edit

okay thanks a lot, ImagePanels are much nicer + easier to edit
Please sign in through STEAM to post a comment.