Skip to content

[TF2] MvM: Fix tankboss visual health bar not updating on health change via inputs - #2201

Open
HyperionCoding wants to merge 1 commit into
ValveSoftware:masterfrom
HyperionCoding:tankboss-health-bar-fix
Open

HyperionCoding wants to merge 1 commit into
ValveSoftware:masterfrom
HyperionCoding:tankboss-health-bar-fix

Conversation

@HyperionCoding

Copy link
Copy Markdown
Contributor

Description

Fix tankboss visual health bar not updating when the tank health or max health is changed via inputs, only when damaged normally via OnTakeDamage. The cause is that the health bar is tracked in m_lastHealthPercentage but the value is updated only when taking damage, not on any (max/) health change.

The fix is to override SetHealth and SetMaxHealth functions to also change m_lastHealthPercentage. I chose to ignore firing the m_outputOnHealthBelowXXPercent outputs because if the health is changed via inputs the outputs can be fired manually too.

Current:
https://github.com/user-attachments/assets/c17282b4-1e46-4dc2-a12c-f04c7e04d60e

Fixed:
https://github.com/user-attachments/assets/822434fd-c0db-4cd6-8087-241c03f25452

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant