x
ETF2L is looking for new Staff to recruit! Are you interested in supporting the league? Then click here for more details on what we can offer and how to apply! 

Forum

Animating a crosshair image?

Created 12th February 2014 @ 16:22

Add A Reply Pages: 1

Catface100

tbd

Hi folks,

Essentially what I’m trying to do is make a a crosshair that I’m using from a .vtf file flash on the screen when I hit something. To avoid confusion, it’s not an actual crosshair, just a small image, but when referring to it in the hud, I’ve added it as a crosshair.

The image itself will appear on my hud anyway, no matter what I do to “fgcolor”. As such, the animation does not change anything on hit. The only way I seem to be able to not have it on the hud constantly is to have “visible” “0”, but then I cannot animate this.

Here is the part in hudlayout.res:
"controlName" "CTFImagePanel"
"fieldName" "fwdslash"
"visible" "1"
"enabled" "1"
"zpos" "3"

"xpos" "c-210"
"ypos" "250"
"wide" "10"
"tall" "10"

//"font" "xHairCircleOutline"
//"font" "xHairCircle"
//"textAlignment" "center"
"image" "replay/thumbnails/fwdslash"
"scaleImage" "1"

And here is relevant information in the hudanimations.txt:
event DamagedPlayer
{
Animate DamageAccountValue Alpha "255" linear 0.0 0.0
Animate DamageAccountValue Alpha "0" linear 10.0 0.2
Animate DamageAccountValueBG Alpha "255" linear 0.0 0.0
Animate DamageAccountValueBG Alpha "0" linear 10.0 0.2

Animate Crosshair11 FgColor "255 255 255 255" Linear 0.0 0.00001
Animate Crosshair11 FgColor "0 255 0 255" Linear 0.15 0.15001
Animate fwdslash FgColor "255 0 0 255" Linear 0.0 0.00001
Animate fwdslash FgColor "255 0 0 0" Linear 0.15 0.15001

I also have a fwdslash.vtf and fwdslash.vmt in the directory:
custom-broeselhud 3.0-materials-vgui-replay-thumbnails

Loads of info, I know, but I didn’t want people to have to ask for it before trying to figure it out.

Thanks for your time and help!!


Last edited by Catface100,

Catface100

tbd

After going through the furthest reaches of the internet, I found that you can’t change opacity of an image, as it acts as an overlay, so any “hitmarkers” have to be text-based.

TNT

I know I’m a year late, but this works

Animate Hitscan Alpha “255” Linear 0.0 0.00001
Animate Hitscan Alpha “0” Linear 0.15 0.15001

Just make sure the original crosshair section also has Alpha 0 on it


Last edited by TNT,

Add A Reply Pages: 1