AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Grenade damage from Ham_TakeDamage (https://forums.alliedmods.net/showthread.php?t=193864)

Liverwiz 08-23-2012 11:37

Grenade damage from Ham_TakeDamage
 
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?

dark_style 08-23-2012 11:51

Re: Grenade damage from Ham_TakeDamage
 
http://forums.alliedmods.net/showthread.php?t=88506

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

Liverwiz 08-23-2012 12:01

Re: Grenade damage from Ham_TakeDamage
 
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.

dark_style 08-23-2012 12:23

Re: Grenade damage from Ham_TakeDamage
 
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?

ConnorMcLeod 08-23-2012 12:54

Re: Grenade damage from Ham_TakeDamage
 
Because 20 is already used/

#define DMG_ACID (1<<20) // Toxic chemicals or acid burns

dark_style 08-23-2012 12:59

Re: Grenade damage from Ham_TakeDamage
 
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 ?

Liverwiz 08-23-2012 13:20

Re: Grenade damage from Ham_TakeDamage
 
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.

dark_style 08-24-2012 01:46

Re: Grenade damage from Ham_TakeDamage
 
Quote:

Originally Posted by Liverwiz (Post 1780391)
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.

NiHiLaNTh 08-24-2012 03:44

Re: Grenade damage from Ham_TakeDamage
 
HEGrenades use their own damage type

Code:

#define DMG_HEGRENADE ( 1 << 24 );


All times are GMT -4. The time now is 05:47.

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