Sunday, August 5, 2007

Immunity from Team Kill and Self Kill Shots

Brought to you by: Someone

Have you ever been chasing down an enemy only to be killed by a teammate shooting at the same enemy? Have you ever been killed by your own shots? Here's a tip that prevent shots from teammates and yourself from killing you.

For this edit, we're going to playing.cxx in /src/bzflag/ of the extracted source. Search for " myTank->checkHit(myTank, hit, minTime);", and you will find this section:

float minTime = Infinity;

myTank->checkHit(myTank, hit, minTime);
int i;
for (i = 0; i < curMaxPlayers; i++)
if (player[i])
myTank->checkHit(player[i], hit, minTime);

Let's remove the line "myTank->checkHit(myTank, hit, minTime);" so that the section now reads like this:

float minTime = Infinity;

int i;
for (i = 0; i < curMaxPlayers; i++)
if (player[i])
myTank->checkHit(player[i], hit, minTime);

Next, we are going to add a new line immediately below "if (player[i])":

if (player[i]->getTeam() != myTank->getTeam() || myTank->getTeam() == RogueTeam)

The section should now read like this:

float minTime = Infinity;

int i;
for (i = 0; i < curMaxPlayers; i++)
if (player[i])
if (player[i]->getTeam() != myTank->getTeam() || myTank->getTeam() == RogueTeam)
myTank->checkHit(player[i], hit, minTime);

Save the file, compile your new client, and you're done. To see Someone's original instructions, read his comment "Stealth Tanks Blink on Radar". As always...

Have fun!

1 comment:

phasmophage said...

I'm not sure (I didn't test this out) but it looks like you can still shoot yourself if you're a Rogue.
You might want to add

&& player[i] != myTank

Or something.
-Phaz