Blockland Forums > Modification Help
Hitboxes + Gore Mod
Khain:
--- Code: ---package Hitboxes
{
function Armor::damage(%this, %obj, %sourceObject, %pos, %directDamage, %damageType
{
if(%obj.getDamageLevel() + %directDamage > %this.maxDamage)
}
};
activatePackage(Hitboxes);
--- End code ---
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.
Iban:
GameMode_CityRPG/scripts/functions.cs
--- Code: ---// 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;
}
--- End code ---
Khain:
Thanks. c:
Captain Crazy:
Head explosions sound intriguing. What's this for?
Iban:
--- Quote from: Khain on March 02, 2011, 04:06:05 PM ---Thanks. c:
--- End quote ---
Keep in mind it only works when the player is standing. You may want to code in an %obj.isCrouched() exception.