Removing fall damage: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(This code block does not exist in HL2MP)
No edit summary
Line 1: Line 1:
Removing fall damage is a simple process in sp 2013, I have yet to try it in other versions, yet the principle should work across all versions.
{{lang}}Removing fall damage is a simple process in sp 2013, I have yet to try it in other versions, yet the principle should work across all versions.
{{bug|This code block does not exist in HL2MP}}
{{bug|This code block does not exist in HL2MP}}
= Editing The Code =
= Editing The Code =

Revision as of 17:44, 13 August 2023

English (en)Русский (ru)Translate (Translate)

Removing fall damage is a simple process in sp 2013, I have yet to try it in other versions, yet the principle should work across all versions.

Icon-Bug.pngBug:This code block does not exist in HL2MP  [todo tested in ?]

Editing The Code

SinglePlayer 2013

1. Find Hl2_player.cpp in the server project in the Server(game)/Source FIles\HL2 DLL\Hl2_player.cpp or in the local file path of src/game/server/hl2/Hl2_player.cpp
2. Find this if statement in the file (I found it at 2294-2303)

// ignore fall damage if instructed to do so by input  
if ( ( info.GetDamageType() & DMG_FALL ) && m_flTimeIgnoreFallDamage > gpGlobals->curtime )  
{  
	// usually, we will reset the input flag after the first impact.
        //However there is another input that  
	// prevents this behavior.  
	if ( m_bIgnoreFallDamageResetAfterImpact )  
	{  
		m_flTimeIgnoreFallDamage = 0;  
	}  
	return 0;  
}

3. Remove or comment the code to look like this.

// Always Ignore Fall Damage
if ( info.GetDamageType() & DMG_FALL )
{
	return 0;
}

Explaination
Before, it was only removing fall damage if the console variable was preventing it from doing it. Now, it will always deal no fall damage as it is always returning 0.