Remove player pushack: Difference between revisions
No edit summary |
No edit summary |
||
Line 7: | Line 7: | ||
in the middle of the function youll find this block of code below | in the middle of the function youll find this block of code below | ||
if ( info.GetInflictor() && (GetMoveType() == MOVETYPE_WALK) && | |||
( !attacker->IsSolidFlagSet(FSOLID_TRIGGER)) ) | ( !attacker->IsSolidFlagSet(FSOLID_TRIGGER)) ) | ||
{ | { | ||
Line 21: | Line 18: | ||
} | } | ||
like so remove the call ApplyAbsVelocityImpulse( force ); from the end of the calculation | like so remove the call ApplyAbsVelocityImpulse( force ); from the end of the calculation | ||
Line 28: | Line 24: | ||
Then proceed towards line 5670 to find the void '''CBasePlayer::VelocityPunch( const Vector &vecForce )''' function | Then proceed towards line 5670 to find the void '''CBasePlayer::VelocityPunch( const Vector &vecForce )''' function | ||
within this youll find the code | within this youll find the code | ||
void CBasePlayer::VelocityPunch( const Vector &vecForce ) | |||
{ | { | ||
// Clear onground and add velocity. | // Clear onground and add velocity. | ||
Line 37: | Line 30: | ||
//ApplyAbsVelocityImpulse(vecForce ); drn0 removing pushback on hit | //ApplyAbsVelocityImpulse(vecForce ); drn0 removing pushback on hit | ||
} | } | ||
this is the initial velocity function to set the force applied at the time i believe so we remove that tihs too. | this is the initial velocity function to set the force applied at the time i believe so we remove that tihs too. |
Revision as of 13:44, 24 June 2025
In this tutorial i will show you how to remove the push back velocity when a player takes a hit.
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 if ( info.GetInflictor() && (GetMoveType() == MOVETYPE_WALK) && ( !attacker->IsSolidFlagSet(FSOLID_TRIGGER)) ) { Vector force = vecDir * -DamageForce( WorldAlignSize(), info.GetBaseDamage() ); if ( force.z > 250.0f ) { force.z = 250.0f; } //ApplyAbsVelocityImpulse( force ); drn0 disabled to remove pushback on hit }
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 void CBasePlayer::VelocityPunch( const Vector &vecForce ) { // Clear onground and add velocity. SetGroundEntity( NULL ); //ApplyAbsVelocityImpulse(vecForce ); drn0 removing pushback on hit }
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