Remove player pushack: Difference between revisions
Le Glaconus (talk | contribs) (Formatting + removed pov) |
mNo edit summary |
||
Line 3: | Line 3: | ||
This tutorial was made using {{src13mp|4}} (''NOT'' the {{tf2branch|4}}) | This tutorial was made using {{src13mp|4}} (''NOT'' the {{tf2branch|4}}) | ||
# Open your game solution and navigate to {{path|player|cpp}}, then find {{code|preset=1|highlight=cpp|CBasePlayer::OnTakeDamage_Alive}} function (line 1708) | |||
# In the middle of this function lies this block of code: | |||
<source lang=cpp> | <source lang=cpp> | ||
if ( info.GetInflictor() && (GetMoveType() == MOVETYPE_WALK) && | if ( info.GetInflictor() && (GetMoveType() == MOVETYPE_WALK) && | ||
Line 20: | Line 19: | ||
3. Remove the call to {{code|preset=1|highlight=cpp|ApplyAbsVelocityImpulse( force );}} from the end of the calculation. This will remove the velocity resolution from {{code|preset=1|OnTakeDamage}} but still Alive function {{clarify}}<!-- Editor note (Le Glaconus) : Huh ??? What does that mean ? -->. | 3. Remove the call to {{code|preset=1|highlight=cpp|ApplyAbsVelocityImpulse( force );}} from the end of the calculation. This will remove the velocity resolution from {{code|preset=1|OnTakeDamage}} but still Alive function {{clarify}}<!-- Editor note (Le Glaconus) : Huh ??? What does that mean ? -->. | ||
4. Proceed towards line 5670 to find {{code|preset=1|highlight=cpp|void CBasePlayer::VelocityPunch( const Vector &vecForce )}} function. In this function is this block of code : | 4. Proceed towards line 5670 to find {{code|preset=1|highlight=cpp|void CBasePlayer::VelocityPunch( const Vector &vecForce )}} function. In this function is this block of code : | ||
<source lang=cpp> | <source lang=cpp> |
Revision as of 06:28, 25 June 2025
This tutorial demonstrates how to remove the "push back" velocity applied to players when they get hit.
This tutorial was made using Source 2013 Multiplayer (NOT the
Team Fortress 2 branch)
- Open your game solution and navigate to
player.cpp
, then findCBasePlayer::OnTakeDamage_Alive
function (line 1708) - In the middle of this function lies this block of code:
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
}
3. Remove the call to ApplyAbsVelocityImpulse( force );
from the end of the calculation. This will remove the velocity resolution from OnTakeDamage but still Alive function [Clarify].
4. Proceed towards line 5670 to find void CBasePlayer::VelocityPunch( const Vector &vecForce )
function. In this function is this block of 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 [confirm], remove this as well.
5. Compile the solutions - (there shouldn't be any errors but if you get any let me know.) Now when the player gets hit, he won't slide backwards 2 arm lengths away, he'll just stand there and eat it. This was implemented in A Nights Haunting: Source