Instant death in a fixed gun

Server setup, history & future
Post Reply
MrPenguin
Posts: 63
Joined: Thu 18. Aug 2011, 15:13
Description: Here's the penguin

Instant death in a fixed gun

Post by MrPenguin »

OK, this happened a couple of times to me recently, and I wonder how it works.

So I'm in a gun emplacement, such as one of those fixed guns at either end of BitchSlap, spamming away, and then suddenly I'm dead. No damage before, no explosions or sounds, and from the viewpoint of my flailing corpse the gun is still fine and looks to have taken no damage!

What can do that? I was thinking a very good Sniper Rifle shot, but I'm not sure thats even possible.

Any ideas?
User avatar
lilalurl
Posts: 121
Joined: Mon 30. Nov 2009, 02:57

Re: Instant death in a fixed gun

Post by lilalurl »

There are some vehicles (turrets are considered vehicles in UT2004) in which you can indeed be killed by a headshot.

The Manta and the Scorpion.
And from what I can see from the code, the minigun turret too.
I am not sure about energy (laser) turrets.

What was the kind of turrets you were in when what you describe happened?
MrPenguin
Posts: 63
Joined: Thu 18. Aug 2011, 15:13
Description: Here's the penguin

Re: Instant death in a fixed gun

Post by MrPenguin »

It was the minigun type (there are ones in each corner of the BitchSlap map).

I wonder if it was a shot from the side - the player is more visible from the side than from the front, which looks pretty much impossible to hit.
User avatar
lilalurl
Posts: 121
Joined: Mon 30. Nov 2009, 02:57

Re: Instant death in a fixed gun

Post by lilalurl »

Here is the relevant function in ASTurret_Minigun.uc

Code: Select all

function Pawn CheckForHeadShot(Vector loc, Vector ray, float AdditionalScale)
{
    local vector	X, Y, Z, newray;
	local float		Angle, Side;

    GetAxes(Rotation, X, Y, Z);

    if ( Driver != None )
    {
        // Remove the Z component of the ray
        newray = ray;
        newray.Z = 0;

		Angle = abs(newray dot X);
		Side = NewRay dot Y;
        if (  Angle < 0.7 && Side < 0 && Driver.IsHeadShot(loc, ray, AdditionalScale) )			// left
            return Driver;
        else if (  Angle < 0.82 && Side > 0 && Driver.IsHeadShot(loc, ray, AdditionalScale) )	// right
            return Driver;
    }

    return None;
}
A bit too complex for me but still you might want to take a look.

Also, you should not take what you can see graphically as 100% valid in UT2004. For instance, from what I know, the hitbox for players/vehicles are indeed boxes.
So, for instance, when doing a headshot you can hit a bit above and on the side of the enemy's head and still get a headshot (although graphically it will be some air), if the enemy uses a small player model.
Post Reply