Raised This Month: $ Target: $400
 0% 

[TF2] Detect if a player died from a crtical


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hardcor3
Member
Join Date: Mar 2009
Old 05-02-2009 , 13:00   [TF2] Detect if a player died from a crtical
Reply With Quote #1

Basically what the thread title says im after a way of detecting if a player died from a critical hit, anyone know how to do it?
Hardcor3 is offline
psychonic

BAFFLED
Join Date: May 2008
Old 05-02-2009 , 13:08   Re: [TF2] Detect if a player died from a crtical
Reply With Quote #2

On the player_death event, there's a field called damagebits.

if (bits & 1048576)
{
// kill was from a crit
}


Crit kills show as being acid damage.

PHP Code:
#define DMG_GENERIC            0            // generic damage was done
#define DMG_CRUSH            (1 << 0)    // crushed by falling or moving object. 
// NOTE: It's assumed crush damage is occurring as a result of physics collision, so no extra physics force is generated by crush damage.
// DON'T use DMG_CRUSH when damaging entities unless it's the result of a physics collision. You probably want DMG_CLUB instead.
#define DMG_BULLET            (1 << 1)    // shot
#define DMG_SLASH            (1 << 2)    // cut, clawed, stabbed
#define DMG_BURN            (1 << 3)    // heat burned
#define DMG_VEHICLE            (1 << 4)    // hit by a vehicle
#define DMG_FALL            (1 << 5)    // fell too far
#define DMG_BLAST            (1 << 6)    // explosive blast damage
#define DMG_CLUB            (1 << 7)    // crowbar, punch, headbutt
#define DMG_SHOCK            (1 << 8)    // electric shock
#define DMG_SONIC            (1 << 9)    // sound pulse shockwave
#define DMG_ENERGYBEAM        (1 << 10)    // laser or other high energy beam 
#define DMG_PREVENT_PHYSICS_FORCE        (1 << 11)    // Prevent a physics force 
#define DMG_NEVERGIB        (1 << 12)    // with this bit OR'd in, no damage type will be able to gib victims upon death
#define DMG_ALWAYSGIB        (1 << 13)    // with this bit OR'd in, any damage type can be made to gib victims upon death.
#define DMG_DROWN            (1 << 14)    // Drowning


#define DMG_PARALYZE        (1 << 15)    // slows affected creature down
#define DMG_NERVEGAS        (1 << 16)    // nerve toxins, very bad
#define DMG_POISON            (1 << 17)    // blood poisoning - heals over time like drowning damage
#define DMG_RADIATION        (1 << 18)    // radiation exposure
#define DMG_DROWNRECOVER    (1 << 19)    // drowning recovery
#define DMG_ACID            (1 << 20)    // toxic chemicals or acid burns
#define DMG_SLOWBURN        (1 << 21)    // in an oven

#define DMG_REMOVENORAGDOLL    (1<<22)        // with this bit OR'd in, no ragdoll will be created, and the target will be quietly removed.
// use this to kill an entity that you've already got a server-side ragdoll for

#define DMG_PHYSGUN            (1<<23)        // Hit by manipulator. Usually doesn't do any damage.
#define DMG_PLASMA            (1<<24)        // Shot by Cremator
#define DMG_AIRBOAT            (1<<25)        // Hit by the airboat's gun

#define DMG_DISSOLVE        (1<<26)        // Dissolving!
#define DMG_BLAST_SURFACE    (1<<27)        // A blast on the surface of water that cannot harm things underwater
#define DMG_DIRECT            (1<<28)
#define DMG_BUCKSHOT        (1<<29)        // not quite a bullet. Little, rounder, different. 

Last edited by psychonic; 05-02-2009 at 13:13.
psychonic is offline
Hardcor3
Member
Join Date: Mar 2009
Old 05-02-2009 , 15:09   Re: [TF2] Detect if a player died from a crtical
Reply With Quote #3

Thanks, i had a feeling it was to do with that field but i really wasnt sure. On another note where exactly did you get that list?
Hardcor3 is offline
psychonic

BAFFLED
Join Date: May 2008
Old 05-02-2009 , 15:17   Re: [TF2] Detect if a player died from a crtical
Reply With Quote #4

Quote:
Originally Posted by Hardcor3 View Post
On another note where exactly did you get that list?
Source SDK

http://hg.alliedmods.net/hl2sdk-ob/file/
psychonic is offline
Kevin_b_er
SourceMod Donor
Join Date: Feb 2009
Old 05-02-2009 , 15:18   Re: [TF2] Detect if a player died from a crtical
Reply With Quote #5

It's from the Source SDK. shareddefs.h However the tidbits like DMG_ACID being set upon a crit damage is gathered the hard way. Take note of an import piece of info, as well, that setting DMG_ACID does not make damage critical.
Kevin_b_er 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 11:37.


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