Raised This Month: $ Target: $400
 0% 

Grenade damage from Ham_TakeDamage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 08-23-2012 , 11:37   Grenade damage from Ham_TakeDamage
Reply With Quote #1

Ok....as the title says, i'm trying to get grenade damage from Ham_TakeDamage (using the damage bits) Reading the HLSDK it says that it does DMG_BLAST damage, but my code isn't picking it up. Here it is....

Code:
public takeDamage_pre(victimID, inflictor, attackerID, Float:flDmg, dmgBits)
{
	if(dmgBits & (DMG_BLAST | DMG_BURN) )
		client_print(victimID, print_chat, "Grenade did %f damage.", flDmg)
	else
		client_print(victimID, print_chat, "dmgBits: %d blast: %d", dmgBits, DMG_BLAST)
	return HAM_HANDLED ; 
}
What am i missing? (i added DMG_BURN to try and bug fix, but to no avail)
the else prints this.... "dmgBits: 16777216 blast: 6"
Or is there a better way of determining if it was a grenade hit?
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
dark_style
Senior Member
Join Date: Jul 2009
Location: Bulgaria
Old 08-23-2012 , 11:51   Re: Grenade damage from Ham_TakeDamage
Reply With Quote #2

http://forums.alliedmods.net/showthread.php?t=88506

As far as I read DMG_BLAST must be the c4 damage, not the grenade one.

Last edited by dark_style; 08-23-2012 at 11:52.
dark_style is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 08-23-2012 , 12:01   Re: Grenade damage from Ham_TakeDamage
Reply With Quote #3

Ah, thank you. I didn't get that far in my searching.
That's weird, though, considering....

Code:
	// do damage
	if ( !( pev->spawnflags & SF_ENVEXPLOSION_NODAMAGE ) )
	{
		RadiusDamage ( pev, pev, m_iMagnitude, CLASS_NONE, DMG_BLAST );
	}
from the explode.cpp in HLSDK
But i suppose that is doing other types of explosion damage, not grenades.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
dark_style
Senior Member
Join Date: Jul 2009
Location: Bulgaria
Old 08-23-2012 , 12:23   Re: Grenade damage from Ham_TakeDamage
Reply With Quote #4

I am not sure at all but hegrenade works like the C4.. it does damage to specific radius so maybe that's why DMG_BLAST is used there... ?

I am sorry if I am talking bullshits! Tho I'd like to know why HE damage is ( 1 << 24 )... why 24 not 20 for example, where should I see those values?

Last edited by dark_style; 08-23-2012 at 12:26.
dark_style is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-23-2012 , 12:54   Re: Grenade damage from Ham_TakeDamage
Reply With Quote #5

Because 20 is already used/

#define DMG_ACID (1<<20) // Toxic chemicals or acid burns
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
dark_style
Senior Member
Join Date: Jul 2009
Location: Bulgaria
Old 08-23-2012 , 12:59   Re: Grenade damage from Ham_TakeDamage
Reply With Quote #6

Thanks, will try to understand it.

Edit: I think I got it, I've just seen them in hlsdk_const.inc, but I am still little confused, what will happen if I put different value than 24 and why 24 is HE grenade's damage not m4a1's for example ?

Last edited by dark_style; 08-23-2012 at 13:07.
dark_style is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 08-23-2012 , 13:20   Re: Grenade damage from Ham_TakeDamage
Reply With Quote #7

Its the way the DamageBits are sent. Each damage has a bitsum of damages that all equal up to what's going on with the damage delt. For example knife damage is (DMG_BULLET | DMG_NEVERGIB) and so on. Grenades do a different damage than a bullet. So it has a different bit quantity. etc etc. Not fully sure how the core handles it, but that's what's going on there.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
dark_style
Senior Member
Join Date: Jul 2009
Location: Bulgaria
Old 08-24-2012 , 01:46   Re: Grenade damage from Ham_TakeDamage
Reply With Quote #8

Quote:
Originally Posted by Liverwiz View Post
Its the way the DamageBits are sent. Each damage has a bitsum of damages that all equal up to what's going on with the damage delt. For example knife damage is (DMG_BULLET | DMG_NEVERGIB) and so on. Grenades do a different damage than a bullet. So it has a different bit quantity. etc etc. Not fully sure how the core handles it, but that's what's going on there.
Thanks.
dark_style is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 08-24-2012 , 03:44   Re: Grenade damage from Ham_TakeDamage
Reply With Quote #9

HEGrenades use their own damage type

Code:
#define DMG_HEGRENADE ( 1 << 24 );
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
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 05:47.


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