Raised This Month: $ Target: $400
 0% 

Changing fall velocity limit that gives damage on the player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-01-2009 , 13:24   Re: Changing fall velocity limit that gives damage on the player
Reply With Quote #1

Try with this player offset : m_flFallVelocity ( 251 )
Arkshine is offline
Old 04-01-2009, 14:12
Dores
This message has been deleted by Dores. Reason: 1 sec...
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 04-01-2009 , 14:16   Re: Changing fall velocity limit that gives damage on the player
Reply With Quote #3

Create a global var that checks if the player fell. Check his fall velocity in PreThink, and if it's 300(or higher) - assign 1 to the var(or true, whatever).
When he is on the ground, if the var's value is 1/true, then he just fell. Reset the var, and damage the player according to the falling velocity(I don't know what calculation is needed).
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-01-2009 , 15:32   Re: Changing fall velocity limit that gives damage on the player
Reply With Quote #4

Guess all of those value are hardcoded.

For half-life :
Code:
#define PLAYER_FATAL_FALL_SPEED		1024// approx 60 feet
#define PLAYER_MAX_SAFE_FALL_SPEED	580// approx 20 feet
#define DAMAGE_FOR_FALL_SPEED		(float) 100 / ( PLAYER_FATAL_FALL_SPEED - PLAYER_MAX_SAFE_FALL_SPEED )// damage per unit per second.
#define PLAYER_MIN_BOUNCE_SPEED		200
#define PLAYER_FALL_PUNCH_THRESHHOLD (float)350 // won't punch player's screen/make scrape noise unless player falling at least this fast.
-> Player_PostThink :
Code:
	if ( (FBitSet(pev->flags, FL_ONGROUND)) && (pev->health > 0) && m_flFallVelocity >= PLAYER_FALL_PUNCH_THRESHHOLD )
	{
		// ALERT ( at_console, "%f\n", m_flFallVelocity );

		if (pev->watertype == CONTENT_WATER)
		{
			// Did he hit the world or a non-moving entity?
			// BUG - this happens all the time in water, especially when 
			// BUG - water has current force
			// if ( !pev->groundentity || VARS(pev->groundentity)->velocity.z == 0 )
				// EMIT_SOUND(ENT(pev), CHAN_BODY, "player/pl_wade1.wav", 1, ATTN_NORM);
		}
		else if ( m_flFallVelocity > PLAYER_MAX_SAFE_FALL_SPEED )
		{// after this point, we start doing damage
			
			float flFallDamage = g_pGameRules->FlPlayerFallDamage( this );

			if ( flFallDamage > pev->health )
			{//splat
				// note: play on item channel because we play footstep landing on body channel
				EMIT_SOUND(ENT(pev), CHAN_ITEM, "common/bodysplat.wav", 1, ATTN_NORM);
			}

			if ( flFallDamage > 0 )
			{
				TakeDamage(VARS(eoNullEntity), VARS(eoNullEntity), flFallDamage, DMG_FALL ); 
				pev->punchangle.x = 0;
			}
		}
-edit-
Forgot that, but i guess you have HLSDK.
Code:
float CHalfLifeMultiplay :: FlPlayerFallDamage( CBasePlayer *pPlayer )
{
	int iFallDamage = (int)falldamage.value;

	switch ( iFallDamage )
	{
	case 1://progressive
		pPlayer->m_flFallVelocity -= PLAYER_MAX_SAFE_FALL_SPEED;
		return pPlayer->m_flFallVelocity * DAMAGE_FOR_FALL_SPEED;
		break;
	default:
	case 0:// fixed
		return 10;
		break;
	}
}
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 04-01-2009 at 17:42.
ConnorMcLeod is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 04-02-2009 , 04:17   Re: Changing fall velocity limit that gives damage on the player
Reply With Quote #5

Quote:
Originally Posted by Dores View Post
Create a global var that checks if the player fell. Check his fall velocity in PreThink, and if it's 300(or higher) - assign 1 to the var(or true, whatever).
When he is on the ground, if the var's value is 1/true, then he just fell. Reset the var, and damage the player according to the falling velocity(I don't know what calculation is needed).
Thanks for the suggestion but thought of something else. I will add the velocity I need before a player will touch the ground ;).

Quote:
Originally Posted by ConnorMcLeod View Post
Guess all of those value are hardcoded.
Damn ... so that means that I have to manipulate the fall velocity of the player. Thanks .

Quote:
Originally Posted by arkshine View Post
Try with this player offset : m_flFallVelocity ( 251 )
It just says the fall velocity, it is good to add some values to make them fall better .
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.

Last edited by ot_207; 04-02-2009 at 04:19.
ot_207 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode