Remove player pushack

From Valve Developer Community
Revision as of 13:42, 24 June 2025 by DrN0 (talk | contribs) (This tutorial shows you how to remove the annoying pushback on take damage for player entity)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

In this tutorial i will show you how to remove the push back velocity when a player takes a hit.

Nopushback.gif

This tutorial was made using Source SDKbase 2013 Multiplayer - the legacy version >_> not the team fortress 2 update.

To start open your game solution - find and open the player.cpp file and find the CBasePlayer::OnTakeDamage_Alive function around line 1708

in the middle of the function youll find this block of code below

Caption text
Example

like so remove the call ApplyAbsVelocityImpulse( force ); from the end of the calculation

this removes the velocities resolution from the OnTakeDamage - but still Alive fuction

Then proceed towards line 5670 to find the void CBasePlayer::VelocityPunch( const Vector &vecForce ) function within this youll find the code

Caption text
Example

this is the initial velocity function to set the force applied at the time i believe so we remove that tihs too.

go ahead and compile the solution - there shouldnt be any errors but if you get any let me know. now when you get hit you dont get magically slide backwards 2 arm lengths away - you just stand there and eat it. this was implemented in A Nights Haunting: Source