Upvote Upvoted 0 Downvote Downvoted
How do i animate a custom crosshair?
posted in Customization
1
#1
0 Frags +

I want to animate my custom crosshair to change colors when i do damage. IDK how to do this can anyone help?

I want to animate my custom crosshair to change colors when i do damage. IDK how to do this can anyone help?
2
#2
8 Frags +

If you have a vtf crosshair (one that modifies the tf_weapon files like this vtf pack), there isn't really an easy way to my knowledge. You can easily script it to change color when you shoot, but not so much when you do damage.

But if you have a font crosshair in your hud, in scripts/hudanimations_tf.txt, edit the DamagedPlayer event too look more like:

event DamagedPlayer
{
    StopEvent AnimateHitmarker 0.0
    RunEvent AnimateHitmarker 0.0
}

event AnimateHitmarker
{
	// animate <elementName> fgcolor <color> linear <start time> <duration>
	Animate YourFontCrosshairHere FgColor "255 0 0 255" Linear 0.0 0.0
	Animate YourFontCrosshairHere FgColor "255 255 0 255" Linear 0.2 1.0
}

With the YourFontCrosshairHere being whatever it's called in hudlayout.res, the "255 0 0 255" being whatever color you want it to turn into (in this example, red) and the "255 255 0 255" being whatever it's normally colored (in this example, yellow), and the timings at the end there being whatever you want.

A similar concept applies for material crosshairs (as in a material in hudlayout), except you'd have to make another copy of the material (you can edit vtf files with one of these and make the vmt file like this) and have it be a recolored version. Then set up it up to be more like:

event DamagedPlayer
{
    StopEvent AnimateHitmarker 0.0
    RunEvent AnimateHitmarker 0.0
}

event AnimateHitmarker
{
	// animate <elementName> alpha <value> linear <start time> <duration>
	Animate YourCrosshairMaterial Alpha "0" Linear 0.0 0.0
	Animate RecoloredCrosshairMaterial Alpha "255" Linear 0.0 0.0

	Animate YourCrosshairMaterial Alpha "255" Linear 0.2 1.0
	Animate RecoloredCrosshairMaterial Alpha "0" Linear 0.2 1.0
}

If you've got any more hud-editing-related questions, you should try asking in:
https://www.teamfortress.tv/19073/hud-editing-short-questions-quick-answers

If you have a vtf crosshair (one that modifies the tf_weapon files like [url=https://www.teamfortress.tv/35367/vtf-crosshair-pack]this vtf pack[/url]), there isn't really an easy way to my knowledge. You can easily script it to change color when you shoot, but not so much when you do damage.

But if you have a font crosshair in your hud, in scripts/hudanimations_tf.txt, edit the DamagedPlayer event too look more like:
[code]event DamagedPlayer
{
StopEvent AnimateHitmarker 0.0
RunEvent AnimateHitmarker 0.0
}

event AnimateHitmarker
{
// animate <elementName> fgcolor <color> linear <start time> <duration>
Animate YourFontCrosshairHere FgColor "255 0 0 255" Linear 0.0 0.0
Animate YourFontCrosshairHere FgColor "255 255 0 255" Linear 0.2 1.0
}[/code]With the YourFontCrosshairHere being whatever it's called in hudlayout.res, the "255 0 0 255" being whatever color you want it to turn into (in this example, red) and the "255 255 0 255" being whatever it's normally colored (in this example, yellow), and the timings at the end there being whatever you want.

A similar concept applies for material crosshairs (as in a material in hudlayout), except you'd have to make another copy of the material (you can edit vtf files with [url=https://github.com/JarateKing/TF2-Hud-Reference/blob/master/0-TUTORIAL/0-Tools.md#image-editors]one of these[/url] and make the vmt file [url=https://github.com/JarateKing/TF2-Hud-Reference/blob/master/0-TUTORIAL/5-Materials.md]like this[/url]) and have it be a recolored version. Then set up it up to be more like:
[code]event DamagedPlayer
{
StopEvent AnimateHitmarker 0.0
RunEvent AnimateHitmarker 0.0
}

event AnimateHitmarker
{
// animate <elementName> alpha <value> linear <start time> <duration>
Animate YourCrosshairMaterial Alpha "0" Linear 0.0 0.0
Animate RecoloredCrosshairMaterial Alpha "255" Linear 0.0 0.0

Animate YourCrosshairMaterial Alpha "255" Linear 0.2 1.0
Animate RecoloredCrosshairMaterial Alpha "0" Linear 0.2 1.0
}[/code]

If you've got any more hud-editing-related questions, you should try asking in:
https://www.teamfortress.tv/19073/hud-editing-short-questions-quick-answers
3
#3
0 Frags +

ah alright thx

ah alright thx
Please sign in through STEAM to post a comment.