Page 2 of 2

Re: Dismemberment System

PostPosted: Sun Jan 26, 2014 8:06 pm
by [Steve]
This is how you would check which hitbox has been hit.
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;
      }
   }

Re: Dismemberment System

PostPosted: Sun Jan 26, 2014 8:53 pm
by TechieUK
Awesome, I'll work on getting that in. Obviously I'll have to change it since I'm working with SP.

Re: Dismemberment System

PostPosted: Mon Jan 27, 2014 4:57 pm
by Guessmyname
Hehe, this is the trick we used for decapitating the hospital zombies in Nightmare House 2. As a bonus, with a bit of extra work, you can randomise which 'intact' bodygroup object appears; for each zombie 'type' (doctor, janitor, surgeon and so on) we only had one 'body' mesh and had a bodygroup full of random heads to pick from, which would go to the bloody neck stump when shot.

The one downside is that, like skins, the engine has to load every submesh and texture involved even if there is only one of them present. Texture atlasing to reduce the number of textures / draw calls can get you around most of these problems.

Physics on ragdoll tend to be another image; you can shoot off the head/arm etc visually but the collision system will still think its there. Fortunately people don't tend to notice the ghost limb problem :'D

Re: Dismemberment System

PostPosted: Tue Jan 28, 2014 5:09 pm
by TechieUK
Neat. I might try model some half arms/half legs to allow some variation.

Edit:
Also, Nightmare House 2! A mod I have yet to play due to my dislike of scares.

Re: Dismemberment System

PostPosted: Thu Jan 30, 2014 4:25 pm
by TechieUK
I carefully re-did the bone weights.

Image

Image

Well worth it.

Enjoy the double post.

Re: Dismemberment System

PostPosted: Wed Apr 23, 2014 10:20 pm
by Stormy
Haha I laughed. So many problems with importing skinned models and ragdolls into source. Impressed with this progress. Any chance of making blood spurty particle trails a la Wolfires Overgrowth?

Re: Dismemberment System

PostPosted: Wed Apr 23, 2014 10:42 pm
by Gambini
Looking forward to see this working and portable for all our mods :D