Upvote Upvoted 9 Downvote Downvoted
New fix for HUD animations freezing on respawn
posted in Customization
1
#1
0 Frags +

I believe I've found a fix for the bug where animations like the health overheal/low hp effects are frozen when the player dies or respawns. It's slightly harder to implement and is a bit resource-demanding, but from my own testing it's completely eliminated the issue.

Instead of the animation calling for the loop event after it ended, as soon as the player enters a state of low hp/overheal, it runs two events that will continually loop. Everytime one of these events are run, it then runs a separate "main" event that plays the animation and, when finished, will call to reset just before the next loop starts it over, thus making it seamless. Coupled with mastercoms' fix, the issue shows up much less often.

// this should be used with the hudsnapshotreminder trick for maximum effect

event HudHealthReset
{
		// put the animation that resets the health to how it should look by default here
}

// ====================
// 		OVERHEAL
// ====================

event HudHealthBonusPulse			// main event, don't rename it
{
	RunEvent HudHealthBonusPulseCycle1 0.0
}

event HudHealthBonusPulseCycle1
{
	RunEvent HudHealthBonusPulseMain 	0.0
	RunEvent HudHealthBonusPulseCycle2 	0.25 	// duration of the animation
}

event HudHealthBonusPulseCycle2
{
	RunEvent HudHealthBonusPulseMain 	0.0
	RunEvent HudHealthBonusPulseCycle1 	0.25	// duration of the animation
}

event HudHealthBonusPulseMain
{
		// put the animation for the overheal state here

	RunEvent HudHealthReset 0.2498 		// duration of the animation - 0.0001s
										// (this can be increased to 0.0002s just to be sure)
}

event HudHealthBonusPulseStop
{
	StopEvent HudHealthBonusPulseCycle1		0.0
	StopEvent HudHealthBonusPulseCycle2		0.0

	RunEvent HudHealthReset 0.0 		// acts as a safe net just in case animations still break
}

// ====================
// 		LOW HP
// ====================

event HudHealthDyingPulse
{	
	RunEvent HudHealthDyingPulseCycle1 0.01	
}

event HudHealthDyingPulseCycle1
{
	RunEvent HudHealthDyingPulseMain 	0.0
	RunEvent HudHealthDyingPulseCycle2 	0.25	// duration of the animation
}

event HudHealthDyingPulseCycle2
{
	RunEvent HudHealthDyingPulseMain 	0.0
	RunEvent HudHealthDyingPulseCycle1 	0.25	// duration of the animation
}

event HudHealthDyingPulseMain
{
		// put the animation for the low hp state here

	RunEvent HudHealthReset 0.2498 		// duration of the animation - 0.0001s
										// (this can be increased to 0.0002s just to be sure)
}

event HudHealthDyingPulseStop
{
	StopEvent HudHealthDyingPulseCycle1 		0.0
	StopEvent HudHealthDyingPulseCycle2 		0.0

	RunEvent HudHealthReset 0.0 		// acts as a safe net just in case animations still break
}

I've only made it for low HP and overheal, but the concept is similar for medic's uber and low ammo.
If you implement it in your own HUD, let me know if this fix works!

EDIT : Extra comments in the code.

I believe I've found a fix for the bug where animations like the health overheal/low hp effects are frozen when the player dies or respawns. It's slightly harder to implement and is a bit resource-demanding, but from my own testing it's completely eliminated the issue.

Instead of the animation calling for the loop event after it ended, as soon as the player enters a state of low hp/overheal, it runs two events that will continually loop. Everytime one of these events are run, it then runs a separate "main" event that plays the animation and, when finished, will call to reset just before the next loop starts it over, thus making it seamless. Coupled with [url=https://www.teamfortress.tv/43786/fix-for-lingering-hud-animations-on-death]mastercoms' fix[/url], the issue shows up much less often.


[code]// this should be used with the hudsnapshotreminder trick for maximum effect

event HudHealthReset
{
// put the animation that resets the health to how it should look by default here
}

// ====================
// OVERHEAL
// ====================

event HudHealthBonusPulse // main event, don't rename it
{
RunEvent HudHealthBonusPulseCycle1 0.0
}


event HudHealthBonusPulseCycle1
{
RunEvent HudHealthBonusPulseMain 0.0
RunEvent HudHealthBonusPulseCycle2 0.25 // duration of the animation
}

event HudHealthBonusPulseCycle2
{
RunEvent HudHealthBonusPulseMain 0.0
RunEvent HudHealthBonusPulseCycle1 0.25 // duration of the animation
}


event HudHealthBonusPulseMain
{
// put the animation for the overheal state here

RunEvent HudHealthReset 0.2498 // duration of the animation - 0.0001s
// (this can be increased to 0.0002s just to be sure)
}

event HudHealthBonusPulseStop
{
StopEvent HudHealthBonusPulseCycle1 0.0
StopEvent HudHealthBonusPulseCycle2 0.0

RunEvent HudHealthReset 0.0 // acts as a safe net just in case animations still break
}

// ====================
// LOW HP
// ====================

event HudHealthDyingPulse
{
RunEvent HudHealthDyingPulseCycle1 0.01
}

event HudHealthDyingPulseCycle1
{
RunEvent HudHealthDyingPulseMain 0.0
RunEvent HudHealthDyingPulseCycle2 0.25 // duration of the animation
}

event HudHealthDyingPulseCycle2
{
RunEvent HudHealthDyingPulseMain 0.0
RunEvent HudHealthDyingPulseCycle1 0.25 // duration of the animation
}

event HudHealthDyingPulseMain
{
// put the animation for the low hp state here

RunEvent HudHealthReset 0.2498 // duration of the animation - 0.0001s
// (this can be increased to 0.0002s just to be sure)
}

event HudHealthDyingPulseStop
{
StopEvent HudHealthDyingPulseCycle1 0.0
StopEvent HudHealthDyingPulseCycle2 0.0

RunEvent HudHealthReset 0.0 // acts as a safe net just in case animations still break
}
[/code]

I've only made it for low HP and overheal, but the concept is similar for medic's uber and low ammo.
If you implement it in your own HUD, let me know if this fix works!

[i]EDIT : Extra comments in the code.[/i]
Please sign in through STEAM to post a comment.