Locational hitdamage help?

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Euphoric Beaver

impeccably groomed
Apr 19, 2001
3,158
0
0
Great Britain
www.euphoric-beaver.me.uk
I've coded a machine gun that takes clips. (Hey that's good for me! :D )

And took a peek at Chimeric and the locational hit code got me wondering.

Does anybody know the best and complete code for locational hit damage and could they possibly post it here. :D
Come on were all friends here. ;)
 

Smoke39

whatever
Jun 2, 2001
1,793
0
0
Here's what I got. You can ignore all the sparks it spawns, that was just for this gun.

function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
{
local UT_Shellcase s;
local UT_HeavyWallHitEffect u;
local vector realLoc;
local int HitHeight, HitAngle;

realLoc = Owner.Location + CalcDrawOffset();
s = Spawn(class'UT_ShellCase',, '', realLoc + 20 * X + FireOffset.Y * Y + Z);
if ( s != None )
s.Eject(((FRand()*0.3+0.4)*X + (FRand()*0.2+0.2)*Y + (FRand()*0.3+1.0) * Z)*160);

if (Other == Level)
{
u = Spawn(class'UT_HeavyWallHitEffect',,, HitLocation+HitNormal, Rotator(HitNormal));
u.DrawScale = 0.2;
u.Fatness = 115;
Spawn(class'SmallSpark2',,, HitLocation+HitNormal, Rotator(HitNormal));
Spawn(class'SmallSpark',,, HitLocation+HitNormal, Rotator(HitNormal));
Spawn(class'Spark32',,, HitLocation+HitNormal, Rotator(HitNormal));
spawn(class'UT_SpriteSmokePuff',,,HitLocation+HitNormal*9);
}
else if (Other.IsA('Pawn'))
{
HitHeight = HitLocation.Z - Other.Location.Z;
HitAngle = (Other.Rotation.Yaw - rotator(HitLocation - Other.Location).Yaw) & 65535;

if (HitHeight > 0.72 * Other.CollisionHeight)
{
BroadcastMessage("Head hit");
Other.TakeDamage(200, Pawn(Owner), HitLocation, 35000.0*X, AltDamageType);
}
else if (HitHeight <= 0.72 * Other.CollisionHeight && HitHeight > 0.36 * Other.CollisionHeight)
{
BroadcastMessage("Chest hit");
Other.TakeDamage(60, Pawn(Owner), HitLocation, 32500.0*X, MyDamageType);
}
else if (HitHeight < 0.10 * Other.CollisionHeight)
{
BroadcastMessage("Leg hit");
Other.TakeDamage(5, Pawn(Owner), HitLocation, 27500.0*X, MyDamageType);
}
else
{
BroadcastMessage("Stomach hit");
Other.TakeDamage(35, Pawn(Owner), HitLocation, 30000.0*X, MyDamageType);
}
}
else
Other.TakeDamage(35, Pawn(Owner), HitLocation, 30000.0*X, MyDamageType);
}
 

Smoke39

whatever
Jun 2, 2001
1,793
0
0
That just checks to see if the tracer hit the level, so it knows if it should create sparks or not.
 

Smoke39

whatever
Jun 2, 2001
1,793
0
0
I think It includes any kind of brush. Pawns, decorations, inventory and such are not part of the level.