Author Topic: Hitboxes + Gore Mod  (Read 1215 times)

Code: [Select]
package Hitboxes
{

   function Armor::damage(%this, %obj, %sourceObject, %pos, %directDamage, %damageType
   {
      if(%obj.getDamageLevel() + %directDamage > %this.maxDamage)
   }
};
activatePackage(Hitboxes);

This is what I got so far, what I want to make basically, is detect if you're headshotted to death or not.

If you were headshotted = Head Explosion
Else = Normal death

Thanks, Khain.

GameMode_CityRPG/scripts/functions.cs
Code: [Select]
// Determines if a raycast hit is a headshot.
// No use on its own, but most weapons use it in isRaycastCritical.
// @bool
function WeaponImage::isRaycastHeadshot(%this, %obj, %slot, %col, %pos, %normal)
{
if(fileName(%col.dataBlock.shapeFile) $= "m.dts")
{
%scaleZ = getWord(%col.getScale(), 2);

if(getWord(%pos, 2) > getWord(%col.getWorldBoxCenter(), 2) - (3.3 * %scaleZ))
{
return true;
}
}

return false;
}


Head explosions sound intriguing. What's this for?

Thanks. c:
Keep in mind it only works when the player is standing. You may want to code in an %obj.isCrouched() exception.

Head explosions sound intriguing. What's this for?
Well, It's for the mod i'm doing, I didn't get the headshot thing to work out yet. :p

But i'm moving on, this weekend.