Friday, July 27, 2007

Fly Without Wings & Improved Jumping

Brought to you by: Felipe

Scenario: You and another tank are jumping and shooting at one another. Wouldn't it be nice to be able to slide in one more jump in mid air? Now you can! You can 1-up those annoying players who keep coming at you with Wings. What's cool is that you are not limited to any number of jumps, and this can be especially useful on servers with Wings flap limits ;) But, this tip doesn't stop there...

You can jump no matter what -- regardless of whether or not the server allows jumping (the good folks at Hepcat will love you for it, hehehe...), or if you have the Burrow flag, or even if you have the No Jumping flag! When Burrowed, the jump isn't instantaneous, so you will need to press and hold jump to get airborne. And, it doesn't matter if you are sealed in a building with Oscillation Overthruster. Now, you can jump from inside a building to pick off players who think that they are safe by staying top of your building . Muwahahahaha! >:)

Not only all of that, but you can also control your tank in the air while jumping. And, you can fly regardless of what flag you have! Imagine being able to fly high to target a Winged tank with your guided missile... or shockwave in air. Or, on a CTF server with no jumping allowed, you can place your team's flag on top of a pillar since the other team won't be able to jump up to get it >:) The possibilities are practically endless... See the comments to this post to see how this was updated.

We're going back to LocalPlayer.cxx for this. You can find it in /src/bzflag/ after you have extracted the source. Use your favorite text editor's search function to locate "can't jump while burrowed". You will come across this section:

FlagType* flag = getFlag();

// can't jump while burrowed
if (getPosition()[2] < 0.0f) {
return;
}

if (flag == Flags::Wings) {
if (wingsFlapCount <= 0) {
return;
}
wingsFlapCount--;
} else if ((location != OnGround) && (location != OnBuilding)) {
// can't jump unless on the ground or a building
if (flag != Flags::Wings)
return;
if (wingsFlapCount <= 0)
return;
wingsFlapCount--;
} else if ((flag != Flags::Bouncy) &&
((flag != Flags::Jumping && !World::getWorld()->allowJumping()) ||
(flag == Flags::NoJumping))) {
return;
}

// add jump velocity (actually, set the vertical component since you

Let's do away with most of this section so that it reads like this:

FlagType* flag = getFlag();

// add jump velocity (actually, set the vertical component since you

The above allows us to jump whenever we want. Now, let's add some ability steer in air. Search for "can't control motion in air unless have wings", and you will come to a section that looks like this:

// can't control motion in air unless have wings
if (getFlag() == Flags::Wings) {
float speed = desiredSpeed;

Specifically, let's look at the second line of the above:

if (getFlag() == Flags::Wings) {

Let's remove "== Flags::Wings" so that the line reads like this:

if (getFlag()) {

Save the file, compile your new client, and you're done. Many thanks to Felipe for sharing this one with us ;) You can view the original instructions in the comments of the Cheating BZFlag blog post, The Infamous BZFlag F5 Cheat. Please take a look at our previous posts if you haven't already done so. And, let's keep those tips rolling in >:) As always...

Have fun!

No comments: