Friday, April 27, 2007

HOWTO: Classic God Mode

Ever consider tinkering with "god mode" but just didn't quite know how?

Well, you've come to the right place! First, I'm going to assume that you already know how to unpack compressed files (e.g., *tar.gz files). I'm also going to assume that you already know how to use your favorite text editor. Also, I'm focusing on the source itself. The README file in the BZFlag source gives instructions on compiling from the source.

Let's get started.

After you've unpacked the source tarball, navigate to the unpackaged directory. Once you're there, navigate on to the "/src/bzflag" directory. In that directory, you will find the file "playing.cxx". We'll work on some modifications to that file. Open your favorite text editor if you haven't already, open the file, and let's get going...

First, you may want to open a second editor and paste something like the following to it:

//MODIFIED: The following comment and line were added:
//skip this if alive
if (myTank->isAlive()) return;

We'll use it for quick pasting later on.

Also, I recommend backing up your original playing.cxx file for later use. Alternatively, you can extract a copy of the original file from your original tarball.

Now that you've go "playing.cxx" open it's time for a few changes. Use you editors "Find" feature (e.g., ctrl+f as with some graphic editors) to search for "see if" in the text of the file. The first entry you should come to should be:

/* see if controls are reversed */
if (myTank->getFlag() == Flags::ReverseControls) {
keyboardRotation = -keyboardRotation;
keyboardSpeed = -keyboardSpeed;


You can do away with the "-" symbol with "-keyboardRotation" and "-keyboardSpeed" so that they read "keyboardRotation" and "keyboardSpeed" if you don't want your respctive controls to be reversed when you have the Reverse Only flag. If you get that flag, you will still have to wait until you drop it (unless you have the drop bad flag modification, which we'll cover in a later topic) in order to pick up another flag.

Let's search for the next "see if" in the file. You should come to "// see if it's moved and autoswitch". Nothing of interest here. Next... the next "see if" search brings you to "see if controls are reversed". As before, you can remove the "-" with "-mx" and "-my" to do block the effects of the Reverse Only flag.

The next "see if" search brings us to "...check scores to see if my team and/or..". Nothing of interest here. Next... the next "see if" search brings us to:

// now see if shot was fired with a GenocideFlag
const ShotPath* shot = killerPlayer->getShot(int(shotId));


Muwahahaha! That sounds interesting! Let's add in our lines below the comment so that it reads like this:

// now see if shot was fired with a GenocideFlag
//MODIFIED: The following comment and line were added:
//skip this if alive
if (myTank->isAlive()) return;
const ShotPath* shot = killerPlayer->getShot(int(shotId));

Nothing like ignoring a teammate getting sacked with Genocide, huh? Keep in mind that some servers have rogues genocide. If you are playing on one of these servers as a rogue, then you will still get geno'd since the rogue genocide is handled by the server and sent to the client as a server kill message. Playing as a team color will eliminate that little problem. That, or use the modification to ignore server kill messages, which we will cover in another topic. Moving on...

Your next "see if" search will bring you to:

// see if i've been shot
const ShotPath* hit = NULL;


Hmmm... see if I've been shot? I'd rather not, if you don't mind >:) Let's do our paste action again so that the lines now read:

// see if i've been shot
//MODIFIED: The following comment and line were added:
//skip this if alive
if (myTank->isAlive()) return;
const ShotPath* hit = NULL;


Next...

// if not dead yet, see if i'm sitting on death
else if (myTank->getDeathPhysicsDriver() >= 0) {

If not dead yet, then let's keep it that way. Let's paste again:

// if not dead yet, see if i'm sitting on death
//MODIFIED: The following comment and line were added:
//skip this if alive
if (myTank->isAlive()) return;
else if (myTank->getDeathPhysicsDriver() >= 0) {

You're going to run across a few of these "if not dead yet, see if ..." lines. Simply modify the lines as we've done above, you should be good to go on those. After a few of the "If not yet" fixes, you will come to:

// see if it's inside lock-on angle (if we're trying to lock-on)

Interesting, yes, but not of interest to us for classic god mode. Let's keep going. We come to "// see if it's inside lock-on angle...". Again, not of interest for classic god mode. Moving on, we come to "// see if we should ...". Again, not of interest for classic god mode. Move on still.

Next, we come to some more "If not dead yet" lines. Modify those as you did before. After those fixes, you will come to:

// see if the world collision grid needs to be updated

Nothing here for god mode. Move on.

Ah, you should be at the end of the document. You can run through it if you want to make sure that you hit all of the right spots :)

To be double sure, you can also search for "genocide". If you search from the beginning, keep using your Find Next feature, and you will find the line:

// blow up if killer has genocide flag and i'm on same team as victim
// (and we're not rogues, unless in rabbit mode)
if (human && killerPlayer && victimPlayer && victimPlayer != myTank &&


Now that looks intriguing. Let's add our own little touch to that, shall we?

// blow up if killer has genocide flag and i'm on same team as victim
// (and we're not rogues, unless in rabbit mode)
//MODIFIED: The following comment and line were added:
//skip this if alive
if (myTank->isAlive()) return;
if (human && killerPlayer && victimPlayer && victimPlayer != myTank &&
victimPlayer->getTeam() == myTank->getTeam() &&


Magnifico!

After that, save the file, compile your new client, and ...

Have fun!

0 Comments:

Post a Comment

<< Home