Game Development Community

Head shot variable in T2 ?

by Michael Cozzolino · in Technical Issues · 05/15/2001 (11:12 am) · 2 replies

I made a gun for a T2 mod I just started. It is working the way I like except I would like to make it so head shots are more powerful, similar to the laser rifle already in the game. I tried duplicating that function in projectiles.cs but it didn't work. I might have done it wrong. My weapon then began not to shoot the projectile anymore.(shot blanks) I'm using the plasma gun as a base and the gun uses ammo, NOT energy from the energy pack. Thanks for the help. I'm hoping someone else has done this because I know the GG guys are real busy right now.

About the author

Indie Developer in the Albany NY area. iOS, PC, Mac OSX development. http://itunes.apple.com/us/artist/michael-cozzolino/id367780489


#1
05/18/2001 (11:48 am)
check out the code for the laser rifle, it does exactly what you want to do, see what they do for it. if i remember correctly from T1, it's something as simple as:

//pseudocode
if (%shot.location == head)
{
%dmgfromshot * 1.5
dealdmg();
}

just a really simple if/else check to see if the collision detection found the head or the body. there was even a Tribes1 mod that expanded upon this, and went for arms, legs, torso, and head.
#2
05/30/2001 (8:38 am)
/* Here is what I figured out. Almost the exact code is in the projectile.cs for SniperProjectileData. Instead of SniperProjectileData put your projectile name and multiply %data.directDamage by 1. Put this in the.cs file for you weapon. *NOTE* yourprojectile is the projectile you are using for your weapon. */


function yourprojectile::onCollision(%data, %projectile, %targetObject, %modifier, %position, %normal)
{
%damageAmount = %data.directDamage * 1;

if(%targetObject.getDataBlock().getClassName() $= "PlayerData")
{
%damLoc = firstWord(%targetObject.getDamageLocation(%position));
if(%damLoc $= "head")
{
%targetObject.getOwnerClient().headShot = 1;
%modifier = %data.rifleHeadMultiplier;
}
else
{
%modifier = 1;
%targetObject.getOwnerClient().headShot = 0;
}
}
%targetObject.damage(%projectile.sourceObject, %position, %modifier * %damageAmount, %data.directDamageType);
}