This would be in your C_HL2MP_Player::TraceAttack
The hitgroup numbers correspond with there numbers in model viewer /qc and currently only support 0 - 10
They are defined in shareddefs.h so you can easily add more if you need for shooting extra parts off.
- Code: Select all
// get the damage type,
float flDamage = info.GetDamage();
//restrict checking hitgroups based on dmg type
if( info.GetDamageType() & DMG_CLUB )
{
//if we are dmg_club dont check our hitgroups, (crowbar melee ect)
// keep damage the same and dont gib
flDamage *= 1.0;
}
else
{
// swtich to the hitgroup our trace hit.
switch ( ptr->hitgroup )
{
case HITGROUP_HEAD:
{
Msg( "ive been shot in the head" );
//headshots can be more powerful and thus deal more damage
flDamage *= 3;
// add call to gib here.
}
break;
case HITGROUP_CHEST:
// add call to gib here.
break;
case HITGROUP_STOMACH:
// add call to gib here.
break;
case HITGROUP_LEFTARM:
// add call to gib here.
break;
case HITGROUP_RIGHTARM:
// add call to gib here.
break;
case HITGROUP_LEFTLEG:
// add call to gib here.
break;
case HITGROUP_RIGHTLEG:
// add call to gib here.
break;
case HITGROUP_GENERIC:
// add call to gib here.
break;
default:
break;
}
}