Monday, December 31, 2007

Guided Bullets

Ok this code is pretty nice, just lock onto your opponent and it shoots in the direction they're going or right at them pretty accurately. I didn't create this code, but I'm not sure who gave it to me but here it is:


You might have trouble if you have guided lasers.

In src/bzflag/playing.cxx find:

// see if it's inside lock-on angle (if we're trying to lock-on)
if (a <>getFlag() == Flags::GuidedMissile) // am i locking on?
tankHasShotType(myTank, Flags::GuidedMissile)) &&
player[i]->getFlag() != Flags::Stealth && // can't lock on stealth
!player[i]->isPaused() && // can't lock on paused
!player[i]->isNotResponding() && // can't lock on not responding
d < besttarget =" player[i];" bestdistance =" d;" lockedon =" true;">getFlag() == Flags::GuidedMissile) // am i locking on?

To:

(1 // am i locking on?

In src/bzflag/LocalPlayer.cxx find:

// Set _shotsKeepVerticalVelocity on the server if you want shots
// to have the same vertical velocity as the tank when fired.
// keeping shots moving horizontally makes the game more playable.
firingInfo.shot.vel[2] = 0.0f;

Add this after it:

if (getTarget()) {
const Player * targ = getTarget();
double myx = LocalPlayer::getMyTank()->getPosition()[0];
double myy = LocalPlayer::getMyTank()->getPosition()[1];
double myz = LocalPlayer::getMyTank()->getPosition()[2] +
LocalPlayer::getMyTank()->getMuzzleHeight();
double hisx = targ->getPosition()[0];
double hisy = targ->getPosition()[1];
double hisz = targ->getPosition()[2] + targ->getMuzzleHeight();
double hisvx = targ->getVelocity()[0];
double hisvy = targ->getVelocity()[1];
double hisvz = targ->getVelocity()[2];
double deltax = hisx - myx;
double deltay = hisy - myy;
double distance = hypotf(deltax,deltay)- BZDBCache::tankRadius;
// - BZDB.eval(StateDatabase::BZDB_MUZZLEFRONT);
if (distance <= 0) distance = 0; double shotspeed = BZDB.eval(StateDatabase::BZDB_SHOTSPEED)*( LocalPlayer::getMyTank()->getFlag() == Flags::Laser ?
BZDB.eval(StateDatabase::BZDB_LASERADVEL) :
LocalPlayer::getMyTank()->getFlag() == Flags::RapidFire ?
BZDB.eval(StateDatabase::BZDB_RFIREADVEL) :
LocalPlayer::getMyTank()->getFlag() == Flags::MachineGun ?
BZDB.eval(StateDatabase::BZDB_MGUNADVEL) : 1);
double errdistance = 1.0;
float tx, ty, tz;
for (int tries=0 ; errdistance > 0.05 && tries < t =" (float)distance" omega="fabs(targ-">getAngularVelocity());
double sx,sy;
if ((targ->getStatus() & PlayerState::Falling) fabs(omega)
< sx="t*hisvx;" sy="t*hisvy;" hisspeed =" hypotf(hisvx," alfa =" omega" r =" hisspeed" dx =" r" dy2 =" r" beta =" atan2(dy2,">getAngularVelocity() >
0 ? 1 : -1);
double gamma = atan2(hisvy, hisvx);
double rho = gamma+beta;
sx = hisspeed * t * cos(rho);
sy = hisspeed * t * sin(rho);
}
tx=(float)hisx+(float)sx;
ty=(float)hisy+(float)sy;
tz=(float)hisz+(float)hisvz*t;
if (targ->getStatus() & PlayerState::Falling)
tz += 0.5f * BZDBCache::gravity * t * t;
if (tz < 0) tz = 0;
double distance2 = hypotf(tx - myx, ty - myy);
errdistance = fabs(distance2-distance) / (distance + ZERO_TOLERANCE);
distance = distance2;
}
float projpos[3];
projpos[0] = tx; projpos[1] = ty; projpos[2] = tz;
float heading = atan2f(projpos[1] - myy, projpos[0] - myx);
firingInfo.shot.vel[0] = cosf(heading) *
BZDB.eval(StateDatabase::BZDB_SHOTSPEED);
firingInfo.shot.vel[1] = sinf(heading) *
BZDB.eval(StateDatabase::BZDB_SHOTSPEED);
firingInfo.shot.vel[2] = sinf(atan2f(projpos[2]-myz,
hypotf(projpos[1]-myy,
projpos[0]-myx)))*BZDB.eval(StateDatabase::BZDB_SHOTSPEED);
firingInfo.shot.pos[0] = myx;
firingInfo.shot.pos[1] = myy;
firingInfo.shot.pos[2] = myz;
}

There you go.

-NightMare

Choose your tank size

Ok this is posted in a comment by "person" but "someone" is the one who came up with this cheat I just think it should be posted so more people can see it and don't have to go looking through comments to find it so here it is.

At top of src/bzflag/CommandsImplementation.cxx:

extern float sizeCheat;
class SizeCommand : LocalCommand {
public:
SizeCommand();
bool operator() (const char *commandLine);
};
static SizeCommand sizeCommand;
SizeCommand::SizeCommand() : LocalCommand("/size") {}
bool SizeCommand::operator() (const char *commandLine)
{
sizeCheat = atof(commandLine+6);
return true;
}

At top of src/bzflag/Player.cxx:

#include "LocalPlayer.h"
float sizeCheat = 1.0f;
Find:
else if (effectFlag == Flags::Narrow) {
dimensionsTarget[1] = 0.001f;
}

Add this after:

if (id == LocalPlayer::getMyTank()->getId())
{
dimensionsTarget[0] *= sizeCheat;
dimensionsTarget[1] *= sizeCheat;
}

And that should be it. Now just type /size .1 to /size 1. You must either be killed or pick up or drop a flag for the size to change. Sizes range from 0.0 (Can't be shot by a bullot) to 1.0 (Normal tank size). Sometimes just a /size .7 is nice to give yourself an "edge" =].

-NightMare

Teleport in FRONT of your opponent.

This is just like the /behind code down below where you teleport behind them, only with this code you will teleport in front of them. Kind of a dumb code but fun to mess with people.
Open src/bzflag/composeDefaultKey.cxx:
Find your /behind cheat that you have. It should Look like this:

else if(message=="/behind") {
const Player *Other = LocalPlayer::getMyTank()->getRecipient();
if(Other)
{
LocalPlayer::getMyTank()->setStatus(LocalPlayer::getMyTank()->getStatus() int(PlayerState::Teleporting));
const float* pos = Other->getPosition();
const float* dir = Other->getForward();
const float* vel = Other->getVelocity();
float newpos[3];
float newvel[3];
newpos[0] = pos[0] - 10 * dir[0];
newpos[1] = pos[1] - 10 * dir[1];
newpos[2] = pos[2] + 0.01;
newvel[0] = vel[0];
newvel[1] = vel[1];
newvel[2] = vel[2];
LocalPlayer::getMyTank()->move(newpos, Other->getAngle());
LocalPlayer::getMyTank()->setStatus(LocalPlayer::getMyTank()->getStatus() & ~int(PlayerState::Teleporting));
}
}

Then directly below that add this:

else if(message=="/front") {
const Player *Other = LocalPlayer::getMyTank()->getRecipient();
if(Other)
{
LocalPlayer::getMyTank()->setStatus(LocalPlayer::getMyTank()->getStatus() int(PlayerState::Teleporting));
const float* pos = Other->getPosition();
const float* dir = Other->getForward();
const float* vel = Other->getVelocity();
float newpos[3];
float newvel[3];
newpos[0] = pos[0] + 10 * dir[0];
newpos[1] = pos[1] + 10 * dir[1];
newpos[2] = pos[2] + 0.01;
newvel[0] = vel[0];
newvel[1] = vel[1];
newvel[2] = vel[2];
LocalPlayer::getMyTank()->move(newpos, TargetingUtils::getTargetAzimuth(newpos , pos ));
}
LocalPlayer::getMyTank()->setStatus(LocalPlayer::getMyTank()->getStatus() & ~int(PlayerState::Teleporting));
}

And that is all. Like I said, it is stupid but fun to mess with people when you teleport behind then in front back in forth. Credit for this goes to Phaz =].

-NightMare

Shot prediction.

This will draw a line on your radar to predict where your shots will go. Its almost exactly perfect. It doesn't work on all servers for some reason, but it should work on most. It is very helpful for 3 shot no jump servers. This code was found through a chat between mrmolez and someone else. So here it is for everyone else to see lol.

Open RadarRenderer.cxx
Find:

//draw world weapon shots

Add this right before it:

FiringInfo myInfo(*myTank, 0);
if (myInfo.flagType != Flags::ShockWave) {
if (!BZDB.isTrue(StateDatabase::BZDB_SHOTSKEEPVERTICALV))
myInfo.shot.vel[2] = 0.0f;
myInfo.flagType = Flags::Laser;
myInfo.lifetime /= 100;
const float cs = colorScale(myInfo.shot.pos[2], muzzleHeight);
glColor3f(1.0f * cs, 1.0f * cs, 1.0f * cs);
LocalShotPath myPath(myInfo);
myPath.radarRender();
}

Let me know how this works for you guys. If you don't like it just take it out lol.

-NightMare

Sunday, December 30, 2007

Choose Who Kills You

Ok this is a very very powerful cheat. With this cheat you send a PM to the player saying "/kill" and you will instantly be killed by that person. It is very useful and funny when you do it to teammates and they get booted for TKing or their score drops immedietly.
In src/bzflag/playing.cxx:
Add to top:

int killMe;

Find:

// used later
float waterLevel = World::getWorld()->getWaterLevel();

Add this after:

if (killMe)
{
gotBlowedUp(myTank,GotShot,killMe);
killMe = 0;
}

In src/bzflag/composeDefaultKey.cxx:
Add to top:

extern int killMe;

Find:

else if (message.length() > 0) {

Add this before that:

else if(message=="/kill") {
const Player *Other = LocalPlayer::getMyTank()->getRecipient();
if(Other)
{ killMe = Other->getId();
}
}

And that is it. Now type /kill in a messege to someone and you will be killed by them. Make sure you do NOT have god mode on when you try to do this otherwise it won't work. Also there is usually 1 random player everytime you log into a server that the code doesn't work against. But other than that one player it should work against everyone else. Let me know if this code works for you guys.

-NightMare

Monday, September 24, 2007

Clientquery spoofing

Here's something somebody showed me a long time ago, but I haven't put it up until now. Do people keep recognizing your client as a cheat client because of the "clientquery" command? This will make your client appear to be the same as others, or you can make it say whatever you want.

In buildDate.cxx find these lines of code:

#ifdef HAVE_SDL
appVersionStream << "-SDL";
#endif
appVersion = appVersionStream.str();

and put this line of code right after it:

appVersion = "2.0.8.20060513-MAINT-W32VC71";

This makes your client look like the regular, Windows 2.0.8 version. Of course, you could even change appVersion to be anything you want, like "A BZFLAG CHEAT CLIENT, PUNK!" and if I remember correctly, it may not filter out swear words.
So that's the cheat. So stop bugging me Nightmare.
-phasmophage

Monday, September 17, 2007

No Gravity

By: Phasmophage
Okay, this is a very useless cheat, but because randomdude wants it, I thought I'd post it. =]

We definitely want this cheat to be toggleable. So in playing.cxx, add a line near the beginning (it doesn't matter where, as long as it's not in a function or anything) that says this:

bool bCheatGravity = false;

Now, open LocalPlayer.cxx and put this line of code near the top.

extern bool bCheatGravity;

This will let us use the variable we declared in playing.cxx.

Now, also in LocalPlayer.cxx find these lines:


newVelocity[2] += BZDB.eval(StateDatabase::BZDB_WINGSGRAVITY) * dt;
lastSpeed = speed;
} else {
newVelocity[2] += BZDBCache::gravity * dt;

And replace them with this:

if(bCheatGravity && oldVelocity[2] <= 0.0)newVelocity[2] = 0;
else newVelocity[2] += BZDB.eval(StateDatabase::BZDB_WINGSGRAVITY) * dt;
lastSpeed = speed;
} else {
//newVelocity[2] += BZDBCache::gravity * dt;
if(bCheatGravity && oldVelocity[2] <= 0.0 )newVelocity[2] = 0;
else newVelocity[2] += BZDBCache::gravity * dt;

Now, to add the toggle function, open up ComposeDefaultKey.cxx and add this line near the top:

extern bool bCheatGravity;

And add these lines where your other commands are:

if(message=="/gravity")
{
bCheatGravity = !bCheatGravity;
LocalPlayer *myTank = LocalPlayer::getMyTank();
const float * oldVel = myTank->getVelocity();
float newVelocity[3];
newVelocity[0] = oldVel[0];
newVelocity[1] = oldVel[0];
newVelocity[2] = 0;
myTank->setVelocity(newVelocity);
}

If you don't know where to put this, look for these lines and put it above it:

if (message.length() > 0) {
const char* cmd = message.c_str();
if (LocalCommand::execute(cmd)) {
;
} else if (serverLink) {


and put an "else" in front of " if (message.length() > 0) {"

That's all there is to it. It's pretty useless, I know. But it is funny to see a tank in midair not moving. Which reminds me, you'll need your wings cheat working if you want to drive around in the air.
Hope this is what you were looking for randomdude. ;)
-phaz

Sunday, September 16, 2007

Super Jump

By: Phasmophage
In winged fights, it's hard to catch up with people that are above you, and are continuously jumping. So here's a cheat that will amplify your jump speed by a factor of 8 (or whatever you want it to be, just change it) if you type "/jump".
Add these lines of code in composeDefaultKey.cxx before other commands (See "Quick Guide to Toggling Cheats and Wallwalking"):

if (message=="/jump"){
LocalPlayer *myTank = LocalPlayer::getMyTank();
const float* oldVelocity = myTank->getVelocity();
float newVelocity[3];
newVelocity[0] = oldVelocity[0];
newVelocity[1] = oldVelocity[1];
newVelocity[2] = BZDB.eval(StateDatabase::BZDB_WINGSJUMPVELOCITY);
newVelocity[2] *= 8;
myTank->setVelocity(newVelocity);
}

You will probably want to have your wings cheat turned on when you use this, as you may continue to soar until you are kicked. If you're going too fast, make sure you have you're wings cheat turned on and jump. This will slow you down to regular jump speed.
Questions? Is this working for you? Leave a comment.
-Phasmophage

Protect against "/send"

By: Phasmophage
"/send" is fun, but it can be horrible if it is used against you. So here's a cheat that will send the flag right back to the person who sent it to you.
In playing.cxx, find these lines of code:

static void handleFlagTransferred( Player *fromTank, Player *toTank, int flagIndex)
{
Flag f = world->getFlag(flagIndex);

fromTank->setFlag(Flags::Null);
toTank->setFlag(f.type);

if ((fromTank == myTank) || (toTank == myTank))
updateFlag(myTank->getFlag());

and put this line of code right under it to send the flag back:

if(toTank == myTank)
serverLink->sendTransferFlag(myTank->getId(), fromTank->getId());

Or you can add this line instead to immediately drop it:
if(toTank == myTank)
serverLink->sendDropFlag(myTank->getPosition());

You'll probably want to make this cheat toggleable (see "Quick Guide to Toggling Cheats and Wallwalking").
-Phaz

Send a flag

By: Someone (but I had this one too, before ^_^)
What this cheat will do is simulate your flag being stolen by someone and thus sent to them, causing them to drop their flag, and pick up yours. You can send people bad flags, or OO and force them inside buildings with this cheat.
To do this, edit composeDefaultKey.cxx and add these lines of code:

if(message=="/send") {
const Player *Other = LocalPlayer::getMyTank()->getRecipient();
if(Other)
{
serverLink->sendTransferFlag(LocalPlayer::getMyTank()->getId(),Other->getId());
}
}

In front of your other slash commands. (See previous tutorials)
And that's it. PM "/send" to anybody to send them the flag.

Monday, September 10, 2007

Teleport Behind Somebody

By:Phasmophage
Okay then, this is my first original post in quite a while. Most of the new cheats have been posted by Someone.

Are you tired of having to catch up with others to get a good shot at them? Do you wish that you could just appear behind someone (not the contributor Someone), and automatically aim at them? Well now you can! What this cheat will allow you to do is teleport behind somebody (Kind of like what I heard Agent Smith used to be able to do) by sending them a special private message (Using the period key) like "/behind" or "/b".
To do this, we will need to edit the "composeDefaultKey.cxx" in the directory "/src/bzflag/". Now what you'll need to do is find this line of code:

if (message.length() > 0) {

and change it to this:

else if (message.length() > 0) {

and put this above it:

if(message=="/behind") {
const Player *Other = LocalPlayer::getMyTank()->getRecipient();
if(Other)
{
LocalPlayer::getMyTank()->setStatus(LocalPlayer::getMyTank()->getStatus() | int(PlayerState::Teleporting));
const float* pos = Other->getPosition();
const float* dir = Other->getForward();
const float* vel = Other->getVelocity();
float newpos[3];
float newvel[3];
newpos[0] = pos[0] - 10 * dir[0];
newpos[1] = pos[1] - 10 * dir[1];
newpos[2] = pos[2] + 0.01;
newvel[0] = vel[0];
newvel[1] = vel[1];
newvel[2] = vel[2];
LocalPlayer::getMyTank()->move(newpos, Other->getAngle());
LocalPlayer::getMyTank()->setStatus(LocalPlayer::getMyTank()->getStatus() & ~int(PlayerState::Teleporting));
}
}

You can change the command "/behind" to anything you want. You may want to make it shorter. I also don't think that the "setStatus" functions really do anything important, so you may want to get rid of those, but they don't do any harm anyway.

If you're really into coding, what you can do, like I've done, is instead of having the "Other" player be the recipient of a message, you can make it the closest enemy through using the "findBestTarget()" function in TargetingUtils. You may also want to bind this action to a key, making it quicker to use. I won't go into the details on this, but for one method of binding keys, see Someone's comment on "Quick Guide to Toggling Cheats and Wallwalking". This method doesn't work for me, so I replace some commands I don't use, like "w" for "toggle console".

Questions? Comments? If I missed anything, or if you have any ideas on improvement *cough* Someone *cough*, post a comment.
Have fun with this one.
-phasmophage
aka phaz

Sunday, September 9, 2007

GM Multi-Lock

By: Someone
"Someone" has an improvement on the previously posted "GMWontUnlock" what this cheat will do is allow individual Guided Missiles to track individual targets, instead of all Guided Missiles following one target.
To do this, open GuidedMissileStrategy.cxx and find these lines of code:

LocalPlayer* myTank = LocalPlayer::getMyTank();
if (myTank)
target = myTank->getTarget();

And replace them with:
if (lastTarget == NoPlayer) {
setTarget();
LocalPlayer* myTank = LocalPlayer::getMyTank();
if (myTank)
target = myTank->getTarget();
} else {
target = lookupPlayer(lastTarget);
}

You can thank "Someone" for this post, see his comment for the post "GMWontUnlock."

Saturday, September 8, 2007

"GuidedMissileWontUnlock"

Here's an old one that I believe Mr_Molez had on a private site, but I haven't seen it anywhere else so I'll post it here.

Normally, when one dies after shooting a guided missile, the missile no longer tracks the target. This cheat is listed as one of the "Subtle Cheats" of BZFlag, and what it does is it continues to track the target, even after dying. Here's how to do it.

In LocalPlayer.cxx, find this line:
target = NULL; // lose lock when dead

And delete it.

Monday, August 20, 2007

Reduce laser reload

By: Someone
(Copied straight off his comment from "Wings Gravity Fix for Bloodbath.")
Laser fast-reload

In src/bzflag/SegmentedShotStrategy.cxx, find:
---
setReloadTime(_path->getReloadTime()
/ BZDB.eval(StateDatabase::BZDB_LASERADRATE));
---
Replace with:
---
setReloadTime(_path->getReloadTime()
* BZDB.eval(StateDatabase::BZDB_LASERADLIFE))

Enable Autopilot all the time

By: Someone
(Copied straight off his comment from "Wings Gravity Fix for Bloodbath.")
Want to use autopilot on maps that disable it?

In src/bzflag/clientCommands.cxx, find:
---
if (BZDB.isTrue(StateDatabase::BZDB_DISABLEBOTS)) {
hud->setAlert(0, "autopilot not allowed on this server", 1.0f, true);
return std::string();
}
---
Remove it.

Auto Apologizer

By: Someone
(Copied straight off his comment from "Wings Gravity Fix for Bloodbath.")
Do you ever tire of saying 'sry' to people you tk?

In src/bzflag/playing.cxx find:
---
if (myTank->isAutoPilot()) {
char meaculpa[MessageLen];
memset(meaculpa, 0, MessageLen);
strncpy(meaculpa,
"sorry, i'm just a silly machine",
MessageLen);
---
Replace it with:
---
if (myTank->isAutoPilot() || 1) {
char meaculpa[MessageLen];
memset(meaculpa, 0, MessageLen);
strncpy(meaculpa,
"sry",
MessageLen);

Find geno flag

By: Someone
This is how to find a geno flag with the top of your mousebox. Only works if phantom zone spoof is off.


Geno/other team flag finder: You know that there is a marker for your own team flag, and antidotes above the targeting square, so why not have one for geno, and other team flags?

In src/bzflag/playing.cxx, find:
---
static void prepareTheHUD()
{
// prep the HUD
if (myTank) {
const float* myPos = myTank->getPosition();
hud->setHeading(myTank->getAngle());
hud->setAltitude(myPos[2]);
if (world->allowTeamFlags()) {
const float* myTeamColor = Team::getTankColor(myTank->getTeam());
// markers for my team flag
for (int i = 0; i < numFlags; i++) {
Flag& flag = world->getFlag(i);
if ((flag.type->flagTeam == myTank->getTeam())
&& ((flag.status != FlagOnTank) ||
(flag.owner != myTank->getId()))) {
const float* flagPos = flag.position;
float heading = atan2f(flagPos[1] - myPos[1],flagPos[0] - myPos[0]);
hud->addMarker(heading, myTeamColor);
}
}
}
if (myTank->getAntidoteLocation()) {
// marker for my antidote flag
const GLfloat* antidotePos = myTank->getAntidoteLocation();
float heading = atan2f(antidotePos[1] - myPos[1],
antidotePos[0] - myPos[0]);
const float antidoteColor[] = {1.0f, 1.0f, 0.0f};
hud->addMarker(heading, antidoteColor);
}
}
return;
}
---
Replace it with:
---
static void prepareTheHUD()
{
// prep the HUD
if (myTank) {
const float* myPos = myTank->getPosition();
hud->setHeading(myTank->getAngle());
hud->setAltitude(myPos[2]);
if (world->allowTeamFlags()) {
// markers for my team flag
for (int i = 0; i < numFlags; i++) {
Flag& flag = world->getFlag(i);
if (flag.type->flagTeam != NoTeam) {
const float* flagPos = flag.position;
float heading = atan2f(flagPos[1] - myPos[1],flagPos[0] - myPos[0]);
hud->addMarker(heading, Team::getTankColor(flag.type->flagTeam));
}
}
}
if (myTank->getAntidoteLocation()) {
// marker for my antidote flag
const GLfloat* antidotePos = myTank->getAntidoteLocation();
float heading = atan2f(antidotePos[1] - myPos[1],
antidotePos[0] - myPos[0]);
const float antidoteColor[] = {1.0f, 1.0f, 0.0f};
hud->addMarker(heading, antidoteColor);
}
for (int i = 0; i < numFlags; i++) {
Flag& flag = world->getFlag(i);
if (flag.type == Flags::Genocide) {
const float* flagPos = flag.position;
float heading = atan2f(flagPos[1] - myPos[1],flagPos[0] - myPos[0]);
hud->addMarker(heading, flag.type->getColor());
}
}
}
return;
}
---

See his post on "Wings gravity fix for bloodbath"

Shoot Normal Bullets in PZ

By: Someone
(Sorry to take so long posting these, usually Lord Jesus posts other peoples' cheats. This is basically just copied exactly from someone's comment.)

In src/bzflag/ShotPath.cxx find:

if (tank.getFlag() == Flags::PhantomZone && !tank.isFlagActive()){

Replace it with:

if (tank.getFlag() == Flags::PhantomZone){

Sunday, August 12, 2007

Wings Gravity Fix for BloodBath

You may have noticed that if you tried to use the wings cheat in BloodBath, you'll start to fly away until you get autokicked. The problem lies in the fact that there are two separate gravity values: one for normal jumps and the other for wings. Normally, the value of gravity is negative (usually around -9.8) causing you to go downwards. However, when this value is set to a positive value, you start to shoot upwards. BloodBath set the wings gravity to 100, so you will shoot upwards. So here's a quick, one-liner fix so you can you the wings cheat on their server again.
For this cheat, you will need to edit LocalPlayer.cxx and find this line:

newVelocity[2] += BZDB.eval(StateDatabase::BZDB_WINGSGRAVITY) * dt;

And add this line of code right before it:
if(BZDB.eval(StateDatabase::BZDB_WINGSGRAVITY) >= 0)BZDB.setFloat(StateDatabase::BZDB_WINGSGRAVITY, BZDB.eval(StateDatabase::BZDB_GRAVITY));

So your code should look like this, in the end:
if(BZDB.eval(StateDatabase::BZDB_WINGSGRAVITY) >=0 )BZDB.setFloat(StateDatabase::BZDB_WINGSGRAVITY, BZDB.eval(StateDatabase::BZDB_GRAVITY));
newVelocity[2] += BZDB.eval(StateDatabase::BZDB_WINGSGRAVITY) * dt;

What this will do is check to see if wings gravity is set to a positive number, and if so, change it to the value of normal gravity.
Did I miss something? Was this helpful? Leave a comment.

Have fun. ;)
-Phaz

Wednesday, August 8, 2007

Quick Guide to Toggling Cheats and Wallwalking

By: Phasmophage

Many of you have asked how to toggle cheats. It is one of the most important things cheaters should know how to do. Having a phase cheat is pretty frustrating without being able to turn it off to land on buildings. It's also nice to turn off the wings cheat on servers like Bloodbath, where they reversed wings gravity to make cheaters with wings shoot up into the air until they are autokicked. So here's a non-specific guide on cheat toggling.
Now, the method I use for toggling toggles cheats when you say certain commands by pressing "z", "n", "m", "," or "." So, for example, to toggle god mode I would say "/god" to my teammates, or whoever. The program then recognizes "/god" as a keyword, toggles the cheat, and prevents "/god" from actually being sent. The file that controls sending messages to others is "ComposeDefaultKey.cxx". My personal ComposeDefaultKey.cxx is probably two times bigger than the original.

So let's get started, shall we? Open up "ComposeDefaultKey.cxx" and find these lines of code:
if (sendIt) {
std::string message = hud->getComposeString();
if (message.length() > 0) {
const char* cmd = message.c_str();
if (LocalCommand::execute(cmd)) {
;
} else if (serverLink) {

Let's focus on this line, for a second:
std::string message = hud->getComposeString();

"message" is our message (duh) that we're about to send out, so the "message" string is going to be very important to us later. But first, let me explain boolean variables. Boolean variables, or the "bool" type in C++ (the language used to create BZFlag) can only be true or false. This is the data type we will use to turn our cheats off and on. Now to access these variables from other files, (For example, we need to switch the variable in ComposeDefaultKey.cxx but perhaps the actual cheat is in playing.cxx) we need to declare a variable "extern" in some files.
Argh, I'm bad at explaining, so here's an example:
Open up playing.cxx and find these lines of code:

#ifdef ROBOT
static void handleMyTankKilled(int reason);
static ServerLink* robotServer[MAX_ROBOTS];
#endif


Right after those lines, put this:

bool bCheatOO = false;

That variable is our on and off switch that will let us walk through walls. The b is for "boolean" and the OO is for Oscillation Overthruster, and the "cheat" because we're cheating. You can name it whatever you want.

Now to access it in another file, like ComposeDefaultKey.cxx, find these lines of code:

#define MAX_MESSAGE_HISTORY (20)

MessageQueue messageHistory;
unsigned int messageHistoryIndex = 0;

and put this right after:
extern bool bCheatOO;

"Extern" tells us that this variable is defined elsewhere, but allows us to use it.
Now let's go back to these lines of code:

if (sendIt) {
std::string message = hud->getComposeString();
if (message.length() > 0) {
const char* cmd = message.c_str();
if (LocalCommand::execute(cmd)) {
;
} else if (serverLink) {

And change it to this:

if (sendIt) {
std::string message = hud->getComposeString();
if (message.length() > 0) {
const char* cmd = message.c_str();
if(message=="/oo")bCheatOO = !bCheatOO; //We added this line, which toggles bCheatOO
else if (LocalCommand::execute(cmd)) { //And put an "else" before "if"
;
} else if (serverLink) {

So if you enter "/oo" you'll switch the cheat to its opposite state.

Now, since the actual Oscillation Overthruster stuff is in LocalPlayer.cxx, let's open that up and find these lines of code:

/* local implementation headers */
#include "World.h"
#include "sound.h"
#include "ForceFeedback.h"
#include "effectsRenderer.h"

and put this right after:
extern bool bCheatOO;

Now for the real cheats. Find these lines of code:
// phased means we can pass through buildings
const bool phased = ((location == Dead) || (location == Exploding) ||
(getFlag() == Flags::OscillationOverthruster) ||
isPhantomZoned());

and change it to this:
const bool phased = ((location == Dead) || (location == Exploding) ||
(getFlag() == Flags::OscillationOverthruster) ||
isPhantomZoned() || bCheatOO);

See how we added "|| bCheatOO" to the end? This means if we have Oscillation Overthruster, Phantom Zone, OR if bCheatOO is turned on, then we can pass through buildings.

Find this line of code:
if (location == InBuilding && getFlag() == Flags::OscillationOverthruster) {

And change it to this:
if (location == InBuilding && (getFlag() == Flags::OscillationOverthruster || bCheatOO)) {

Actually, that line isn't too important, it just shows the the weird effects when you're crossing a wall.

Now find this:
if (expelled && phased)
expelled = (obstacle->getType() == WallObstacle::getClassName() ||
obstacle->getType() == Teleporter::getClassName() ||
(getFlag() == Flags::OscillationOverthruster && desiredSpeed < 0.0f &&
p[2] == 0.0f));

and change it to this:
if (expelled && phased)
expelled = (obstacle->getType() == WallObstacle::getClassName() ||
obstacle->getType() == Teleporter::getClassName() ||
(getFlag() == Flags::OscillationOverthruster && !bCheatOO && desiredSpeed < 0.0f &&
p[2] == 0.0f));

This time, we added "&& !bCheatOO" meaning "And bCheatOO is NOT turned on" because what these lines of code do is make sure that we can't back up in buildings. And we do want to.
Find these lines of code:

expelled = (obstacle != NULL);
if (expelled && phased)
expelled = (obstacle->getType() == WallObstacle::getClassName() ||
obstacle->getType() == Teleporter::getClassName() ||
(hasOOflag && desiredSpeed < 0.0f && p[2] == 0.0f));

And change it to this:
expelled = (obstacle != NULL);
if (expelled && phased)
expelled = (obstacle->getType() == WallObstacle::getClassName() ||
(!bCheatOO && obstacle->getType() == Teleporter::getClassName()) ||
(hasOOflag && desiredSpeed < 0.0f && !bCheatOO && p[2] == 0.0f));

Find these lines of code:
// oscillation overthruster tank in building can't back up
if (fracOfMaxSpeed < 0.0f && getLocation() == InBuilding &&
flag == Flags::OscillationOverthruster) {
fracOfMaxSpeed = 0.0f;
}


And change it to this:
// oscillation overthruster tank in building can't back up
if (fracOfMaxSpeed < 0.0f && getLocation() == InBuilding &&
flag == Flags::OscillationOverthruster && !bCheatOO) {
fracOfMaxSpeed = 0.0f;
}

Find this line of code:
if (! (firingStatus == Ready || firingStatus == Zoned))
return false;


Which doesn't let us fire if we we're sealed, and change it to this:
if (! (firingStatus == Ready || bCheatOO || firingStatus == Zoned))
return false;


Also find this:
// make sure we're allowed to shoot
if (!isAlive() || isPaused() ||
((location == InBuilding) && !isPhantomZoned())) {
return false;
}

And change it to this:
// make sure we're allowed to shoot
if (!isAlive() || isPaused() ||
((location == InBuilding) && !isPhantomZoned() && !bCheatOO)) {
return false;
}


And that's all of it. I think. If this doesn't work, let me know. Hopefully, this will teach you how to toggle your cheats. Again, every cheater needs to know how to do this. Seriously. Have fun with this! And if you have any ideas, critiques, or if you enjoyed this not-so-quick cheat guide: Please, leave a comment. ;)
And I am out!
-Phaz

No Blindness

Another, really easy cheat. So you can see out the window.

Open playing.cxx and find this line of code:

if (bestTarget->isHunted() && myTank->getFlag() != Flags::Blindness &&

And change it to this


if (bestTarget->isHunted() &&

Then find these lines of code:
sceneRenderer->setBlank(myTank && (myTank->isPaused() ||
myTank->getFlag() == Flags::Blindness));
And change it to this:

sceneRenderer->setBlank(myTank && (myTank->isPaused()));

Or just delete it altogether.

And that's pretty much it. If I forgot anything, leave a comment.
-Phaz

No Jamming

Jamming is one annoying flag. Actually, I wouldn't know because whenever I had the jamming flag, I had this cheat preventing the effects. This is a really simple and subtle cheat that every cheater needs. I can't believe this wasn't posted yet.

For this cheat, open playing.cxx and find this line of code:
radar->setJammed(flag == Flags::Jamming);

and change it to this:
radar->setJammed(false);

And that's pretty much it. Hope I didn't forget anything.
-Phaz

Sunday, August 5, 2007

Avoid Picking Up Bad Flags

Brought to you by: Someone

You may recall that we have posted some techniques for minimizing the impact of bad flags:

1. Drop Bad Flags Instantly.
2. Drop Bad Flags Like Regular Flags.

We now bring you yet another technique: avoid picking them up altogether. With this edit, if a flag is bad, you will simply drive over it without picking it up.

For this, we're going to playing.cxx in /src/bzflag/ of the extracted source. Search for "if (world->getFlag(i).type == Flags::Null ||", and you will find this section:

if (world->getFlag(i).type == Flags::Null || world->getFlag(i).status != FlagOnGround)
continue;

Notice the second line. After the "!= FlagOnGround", we are going to add this:

|| world->getFlag(i).type->flagQuality == FlagBad

The section should now read like this:

if (world->getFlag(i).type == Flags::Null || world->getFlag(i).status != FlagOnGround ||
world->getFlag(i).type->flagQuality == FlagBad)
continue;

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

Have fun!

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!

Saturday, August 4, 2007

Guided Lasers

By: Phasmophage
Okay, I was originally planning to keep this in reserve due to its immense power. But, due to popular demand (namely randomdude), I have decided to post it.

Guided lasers allow you to lock on to an opponent's position and have perfect accuracy when shooting at them. To do this, we will need to edit two source files: playing.cxx and LocalPlayer.cxx.

The reason we will be editing playing.cxx is to allow us to lock on with lasers. So, find these lines of code:

// see if it's inside lock-on angle (if we're trying to lock-on)
if (a < BZDB.eval(StateDatabase::BZDB_LOCKONANGLE) && // about 8.5 degrees
((myTank->getFlag() == Flags::GuidedMissile) || // am i locking on?
tankHasShotType(myTank, Flags::GuidedMissile)) &&
player[i]->getFlag() != Flags::Stealth && // can't lock on stealth
!player[i]->isPaused() && // can't lock on paused
!player[i]->isNotResponding() && // can't lock on not responding
d < bestDistance) {
bestTarget = player[i];
bestDistance = d;
lockedOn = true;
}

and change this line:
((myTank->getFlag() == Flags::GuidedMissile) || // am i locking on?

to this:
((myTank->getFlag() == Flags::GuidedMissile) || (myTank->getFlag() == Flags::Laser) || // am i locking on?


You will also find these lines, very similar to the lines before:
if (a < BZDB.eval(StateDatabase::BZDB_LOCKONANGLE) && // about 8.5 degrees
myTank->getFlag() == Flags::GuidedMissile && // am i locking on?
player[i]->getFlag() != Flags::Stealth && // can't lock on stealth
!player[i]->isPaused() && // can't lock on paused
!player[i]->isNotResponding() && // can't lock on not responding
d < bestDistance) { // is it better?
bestTarget = player[i];
bestDistance = d;
lockedOn = true;
}

Now change this line:
myTank->getFlag() == Flags::GuidedMissile && // am i locking on?

To this:
(myTank->getFlag() == Flags::GuidedMissile || myTank->getFlag() == Flags::Laser) && // am i locking on?

That's all the edits for playing.cxx

We will now edit LocalPlayer.cxx and find these lines of code:
else {
// apply any handicap advantage to shot speed
if (handicap > 0.0f) {
const float speedAd = 1.0f + (handicap * (BZDB.eval(StateDatabase::BZDB_HANDICAPSHOTAD) - 1.0f));
const float* dir = getForward();
const float* tankVel = getVelocity();
const float shotSpeed = speedAd * BZDB.eval(StateDatabase::BZDB_SHOTSPEED);
firingInfo.shot.vel[0] = tankVel[0] + shotSpeed * dir[0];
firingInfo.shot.vel[1] = tankVel[1] + shotSpeed * dir[1];
firingInfo.shot.vel[2] = tankVel[2] + shotSpeed * dir[2];
}

Now add these lines of code after it: (Wrote it myself, so it's pretty cruddy looking)
bool LockedOn = false;
const Player * target = getTarget();
if(target){
//const float* tankVel = getVelocity();
const float shotSpeed = BZDB.eval(StateDatabase::BZDB_SHOTSPEED);
float newAz = TargetingUtils::getTargetAzimuth( getPosition(), target->getPosition() );
float newPos[3];
const float * tarPos = target->getPosition();
float enemyPos[3];
const float *tv = target->getVelocity();
enemyPos[0] = tarPos[0] + (0.3f * tv[0]); //Lag adjustment
enemyPos[1] = tarPos[1] + (0.3f * tv[1]);
enemyPos[2] = tarPos[2] + (0.3f * tv[2]);
const float * myPos = getPosition();
const float * myDir = getForward();
newPos[0] = enemyPos[0] - ( myPos[0] + (myDir[0] * 0.1)); //Muzzlefront?
newPos[1] = enemyPos[1] - ( myPos[1] + (myDir[1] * 0.1)); //Muzzlefront?
newPos[2] = enemyPos[2] - myPos[2];
//newPos[2] += target->getMuzzleHeight(); // right between the eyes
float newElevation = atan2f(newPos[2], hypotf(newPos[1], newPos[0]));
float newDir[3] = {cosf(newAz), sinf(newAz), sinf(newElevation)};
firingInfo.shot.vel[0] = /*tankVel[0] +*/ shotSpeed * newDir[0];
firingInfo.shot.vel[1] = /*tankVel[1] +*/ shotSpeed * newDir[1];
firingInfo.shot.vel[2] = /*tankVel[2] +*/ shotSpeed * newDir[2];
LockedOn = true;
}

// Set _shotsKeepVerticalVelocity on the server if you want shots
// to have the same vertical velocity as the tank when fired.
// keeping shots moving horizontally makes the game more playable.
if (!LockedOn && !BZDB.isTrue(StateDatabase::BZDB_SHOTSKEEPVERTICALV)) firingInfo.shot.vel[2] = 0.0f;

Oh yeah, forgot, the last four lines should replace these lines:

// Set _shotsKeepVerticalVelocity on the server if you want shots
// to have the same vertical velocity as the tank when fired.
// keeping shots moving horizontally makes the game more playable.
if (!BZDB.isTrue(StateDatabase::BZDB_SHOTSKEEPVERTICALV)) firingInfo.shot.vel[2] = 0.0f;

This will allow your lasers to shoot down or up at people, so this cheat sticks out like a sore thumb.

Oh yeah, forgot again. You'll need to put
#include "TargetingUtils.h"
after this line:
#include "effectsRenderer.h"


And that's basically it. This powerful cheat written by phasmophage (aka "Phaz" or me) and brought to you exclusively by bzfcheat.blogspot.com.
If there is anything I might have forgotten, bad math, bad implementation, or if you actually really like it, comments are greatly appreciated.

Have fun!
-Phaz
;)

Friday, August 3, 2007

Stealth Tanks Blink on Radar

By: Phasmophage
This post assumes that you have already taken out the code that blocks you from seeing stealth tanks on your radar. If you haven't already done so, follow the directions in the post titled "See STEALTH Tanks on Radar."

Here is a great way for you not to blow your cover as a cheater. If you have Super Bullet, you don't want to hit a stealthed tank behind a wall. To make sure you know which tanks are stealthed so you can approach them with caution and not blow your cover, we will make them blink.

This quick and easy edit requires that you open RadarRenderer.cxx and find these lines of code:

if (flashTank.isOn()) {
if (!toggleTank) {
float flashcolor[3];
flashcolor[0] = 0.0f;
flashcolor[1] = 0.8f;
flashcolor[2] = 0.9f;
glColor3fv(flashcolor);
}
} else {
toggleTank = !toggleTank;
flashTank.setClock(0.2f);
}
}

Now, just put this right after it:
//Start stealth flash
if ((player->getFlag() == Flags::Stealth)) {
static TimeKeeper lastTime = TimeKeeper::getCurrent();
static bool flash = false;
const float elapsed = float(TimeKeeper::getCurrent() - lastTime);
if(elapsed < 0.3f){
if(!flash)
{
float flashcolor[3];
flashcolor[0] = 0.5f; //This controls the color of the flash.
flashcolor[1] = 0.5f;
flashcolor[2] = 0.5f;
glColor3fv(flashcolor);
}
}
else
{
flash = !flash;
lastTime = TimeKeeper::getCurrent();
}
}
//End stealth flash

This will make stealthed tanks blink a gray color on your radar. If you want it to blink faster, change 0.3 to a smaller number, or a bigger number to blink more slowly. You can edit the 0.5f's to fit your tastes in color.

Don't blow your cover,
-Phaz ;)

Saturday, July 28, 2007

Flag Coloring and Identify

By: Phasmophage (me)
I first read up about Flag Coloring on BZWiki and thought it was a great idea. It is a simple cheat that allows you to mark special flags (Like Laser, GM, SW, etc) with a special color. The coloring allows you to spot a special flag from a distance, and it is even colored on the radar. Imagine always being able to get a guided missile, laser, shock wave, geno, or any flag you want.
Are you drooling yet? I know I would be.
So, this edit lies in the file Flag.cxx where we will find these lines of code:

const float* FlagType::getColor() const
{
if (flagTeam == NoTeam)
return superColor;
else
return Team::getTankColor(flagTeam);
}

We will basically replace the above lines of code with the following:

const float* FlagType::getColor() const
{
static const float superColor[3] = { 1.0, 1.0, 1.0 };
static const float LaserColor[3] = { 0.8, 0.2, 0.0 };
static const float ShockColor[3] = { 0.0, 0.5, 0.5 };
static const float GuideColor[3] = { 0.5, 0.5, 0.0 };
static const float GenoCColor[3] = { 0.2, 0.8, 0.2 };
static const float BadFlColor[3] = { 0.0, 0.0, 0.0 };
if(this==Flags::Laser)return LaserColor;
else if(this==Flags::ShockWave)return ShockColor;
else if(this==Flags::GuidedMissile)return GuideColor;
else if(this==Flags::Genocide)return GenoCColor;
else if(endurance==FlagSticky)return BadFlColor;
else if (flagTeam == NoTeam)
return superColor;
else
return Team::getTankColor(flagTeam);
}

This colors laser flags red, SW blue, GM yellow, Geno green, and bad flags black. You can also change the colors, or add more flags if you like.

To identify flags we haven't colored, we will switch identify to be permanently on. To do this, open the file playing.cxx and find these lines of code:

else if (flagd == Flags::Identify) {
// identify closest flag

and oh-so-simply replace it with this:

if (1 || flagd == Flags::Identify) {
// identify closest flag

Note: Many servers have caught on to this cheat, and have disguised all flags as Phantom Zone. But then again, some haven't, and these cheats are insanely handy. Not to mention, they are pretty subtle.
If you like this cheat, want to critique it, or if these cheats have saved your marriage, leave a comment!

Have fun with this one.
-Phaz

Instant Self Destruct

By: Phasmophage
So, you're in a corner and a guy is about to shoot you. Or maybe he's locked on to you with Guided Missile. Maybe your in range of a Shock Wave. Either way, this guy's about to kill you, and you know it. So here's a great way to kill yourself instantly and not give that little punk the point, (and totally piss him off while your at it): Instant Self Destruct!

This is a really simple edit, so open up playing.cxx and find these lines:

if (destructCountdown > 0.0f) {
const int oldDestructCountdown = (int)(destructCountdown + 0.99f);
destructCountdown -= dt;
if (destructCountdown <= 0.0f) {
// now actually destruct

Edit it so it looks like this:

if (destructCountdown > 0.0f) {
const int oldDestructCountdown = (int)(destructCountdown + 0.99f);
destructCountdown -= dt;
if (1 || destructCountdown <= 0.0f) { destructCountdown = 0.0f; // now actually destruct

And now you can die with dignity!
Alright, so this is one of my more stupid "cheats" but it still has its advantage.
Enjoy it!
-Phaz


Ultimate Pausing

By: Phasmophage

Alright now, this is my first real post as a contributor.

Anyhoo, most of you know that it takes five seconds to pause, and you have to be on the ground or on a building, or else your pause will cancel. Also, after you pause your radar and your HUD (Heads Up Display) go completely blank, not to mention you have no sound. This leaves you vulnerable to being shot by some dude that has been waiting right behind you. Well, no more! With this cheat, you will be able to pause anywhere instantly, and be able to see what's around you. (And it's also really funny to pause in the air right in front of somebody, they'll be thinking "Why is that dude frozen in the air with a bubble around him?")

First, you'll need to open clientCommands.cxx and find these lines:


} else if (myTank->getLocation() == LocalPlayer::InBuilding) {
// custom message when trying to pause while in a building
// (could get stuck on un-pause if flag is taken)
hud->setAlert(1, "Can't pause while inside a building", 1.0f, false);

} else if (myTank->getLocation() == LocalPlayer::InAir) {
// custom message when trying to pause when jumping/falling
hud->setAlert(1, "Can't pause when you are in the air", 1.0f, false);

} else if (myTank->getLocation() != LocalPlayer::OnGround &&
myTank->getLocation() != LocalPlayer::OnBuilding) {
// catch-all message when trying to pause when you should not
hud->setAlert(1, "Unable to pause right now", 1.0f, false);

What these lines do is make sure you're in a valid spot to begin the pause countdown. We don't want that, so what you should do is put a "0 &&" to skip checking, so your code looks like this:

} else if (0 && myTank->getLocation() == LocalPlayer::InBuilding) {
// custom message when trying to pause while in a building
// (could get stuck on un-pause if flag is taken)
hud->setAlert(1, "Can't pause while inside a building", 1.0f, false);

} else if (0 && myTank->getLocation() == LocalPlayer::InAir) {
// custom message when trying to pause when jumping/falling
hud->setAlert(1, "Can't pause when you are in the air", 1.0f, false);

} else if (0 &&amp; myTank->getLocation() != LocalPlayer::OnGround &&
myTank->getLocation() != LocalPlayer::OnBuilding) {
// catch-all message when trying to pause when you should not
hud->setAlert(1, "Unable to pause right now", 1.0f, false);

Now we will make edits to LocalPlayer.cxx

Find these lines:
// if paused then boost the reload times by dt (so that, effectively,
// reloading isn't performed)
int i;
if (isPaused()) {
for (i = 0; i <>
if (shots[i]) {
shots[i]->boostReloadTime(dt);
}
}

and add a "0 &&" before the isPaused() so the line looks like this:

if (0 && isPaused()) {

This allows you to reload while paused.

Now we need to make edits in playing.cxx

Find these lines in the updatePauseCountdown function:

if (pauseCountdown <= 0.0f) {
pauseCountdown = 0.0f;

We will change this to:

if (1 || pauseCountdown <= 0.0f) {
pauseCountdown = 0.0f;

Below these lines you will find some code similar to the ones we edited in clientCommands.cxx:

if (myTank->getLocation() == LocalPlayer::InBuilding) {
// custom message when trying to pause while in a building
// (could get stuck on un-pause if flag is taken/lost)
hud->setAlert(1, "Can't pause while inside a building", 1.0f, false);

} else if (myTank->getLocation() == LocalPlayer::InAir) {
// custom message when trying to pause when jumping/falling
hud->setAlert(1, "Can't pause when you are in the air", 1.0f, false);

} else if (myTank->getLocation() != LocalPlayer::OnGround &&
myTank->getLocation() != LocalPlayer::OnBuilding) {
// catch-all message when trying to pause when you should not
hud->setAlert(1, "Unable to pause right now", 1.0f, false);

} else if (myTank->isPhantomZoned() ) {
// custom message when trying to pause while zoned
hud->setAlert(1, "Can't pause when you are in the phantom zone", 1.0f, false);

after all the "if(" parts we will add "0 && " to skip the checks. (WARNING: Make sure you don't pause in a building with OO or PZ because you will lose the flag, and you may be stuck. Make sure you have the proper cheats to get out of it.) The edited code should look like this:


if (0 && myTank->getLocation() == LocalPlayer::InBuilding) {
// custom message when trying to pause while in a building
// (could get stuck on un-pause if flag is taken/lost)
hud->setAlert(1, "Can't pause while inside a building", 1.0f, false);

} else if (0 && myTank->getLocation() == LocalPlayer::InAir) {
// custom message when trying to pause when jumping/falling
hud->setAlert(1, "Can't pause when you are in the air", 1.0f, false);

} else if (0 &&amp; myTank->getLocation() != LocalPlayer::OnGround &&
myTank->getLocation() != LocalPlayer::OnBuilding) {
// catch-all message when trying to pause when you should not
hud->setAlert(1, "Unable to pause right now", 1.0f, false);

} else if (0 && myTank->isPhantomZoned() ) {
// custom message when trying to pause while zoned
hud->setAlert(1, "Can't pause when you are in the phantom zone", 1.0f, false);

You'll also find these lines, which turn off the sound:

// turn off the sound
if (savedVolume == -1) {
savedVolume = getSoundVolume();
setSoundVolume(0);
}

You can basically delete it or comment it out so it looks like this:
// turn off the sound
/*if (savedVolume == -1) {
savedVolume = getSoundVolume();
setSoundVolume(0);
}*/

Now, to see the radar while paused, find these lines:

if (radar) {
const bool showBlankRadar = !myTank || (myTank && myTank->isPaused());
const bool observer = myTank && (myTank->getTeam() == ObserverTeam);
radar->render(*sceneRenderer, showBlankRadar, observer);
}

And edit the second line so it looks like this:
const bool showBlankRadar = !myTank;

Finally, to see out the HUD while paused, find these lines:
// turn blanking and inversion on/off as appropriate
sceneRenderer->setBlank(myTank && (myTank->isPaused() ||
myTank->getFlag() == Flags::Blindness));

And you can delete it or comment it out, so it looks like this:
// turn blanking and inversion on/off as appropriate
// sceneRenderer->setBlank(myTank && (myTank->isPaused() ||
// myTank->getFlag() == Flags::Blindness));

And this should let you pause anywhere instantly and see out the radar, the HUD, hear sounds while paused.

Tell me what you think,
-Phaz
Have fun!

Friday, July 27, 2007

View Radar on Maps without Radar

By: Phasmophage (aka "Phaz")

Here's a sweet little number that you won't want to pass up... How would you like radar on those maps without radar? Now you can have an advantage over with tanks by having access to your radar on maps that don't allow it! As Phaz tells us:

"On maps with no radar, the radar limit is set to 0 or a negative number. This will fix it to the correct number, the size of the world. So now no more hide and seek!"

For this, we visit RadarRenderer.cxx in /src/bzflag/ of the extracted source. Start by searching for "void RadarRenderer::render(SceneRenderer&" and you will come to this section:

void RadarRenderer::render(SceneRenderer& renderer, bool blank, bool observer)
{
RenderNode::resetTriangleCount();

const float radarLimit = BZDBCache::radarLimit;
if (!BZDB.isTrue("displayRadar") || (radarLimit <= 0.0f)) {
triangleCount = 0;
return;

First, look at this line from above:

const float radarLimit = BZDBCache::radarLimit;

Change that line to this:

float test = BZDBCache::radarLimit;

Below that, you will see this line:

if (!BZDB.isTrue("displayRadar") || (radarLimit <= 0.0f)) {

Change that line to this:

if(test<=0.0) {

Next, you will see this line:

triangleCount = 0;

Change that line to this:

test = BZDB.eval(StateDatabase::BZDB_WORLDSIZE);

The next line you see is this:

return;

Change it to this (all one, single line):

BZDB.setFloat(StateDatabase::BZDB_RADARLIMIT, BZDB.eval(StateDatabase::BZDB_WORLDSIZE));

On the next line, you will see this:

}

Directly below the "}" (vertically aligned), add this line:

const float radarLimit = test;

So that the two lines together look like this:

}
const float radarLimit = test;

The entire edit should like this:

void RadarRenderer::render(SceneRenderer& renderer, bool blank, bool observer)
{
RenderNode::resetTriangleCount();

float test = BZDBCache::radarLimit;
if(test<=0.0) {
test = BZDB.eval(StateDatabase::BZDB_WORLDSIZE);
BZDB.setFloat(StateDatabase::BZDB_RADARLIMIT, BZDB.eval(StateDatabase::BZDB_WORLDSIZE));
}
const float radarLimit = test;
// render the frame

Save the file, compile your client, and you're done. To view Phasmophage's original instructions, read his comment to "HOWTO: See Invisible Bullets and Actual Colors on Radar" at the blog Cheating BZFlag.

As always...

Have fun!

See Invisible Bullets and Actual Colors on Radar

By: Phasmophage

You may recall our previous post about being able to see Stealth tanks on radar. That's useful, we can do more to make ouur radar even more powerful. With this tip from Phasmophage, we can add the ability to see Invisible Bullets and see the actual tank colors of tanks when we have the Colorblindness flag.

For this, we're revisiting RadarRenderer.cxx in /src/bzflag/ of the extracted source. Search for "if (shot && (shot->getFlag() !=" and you will find this line:

if (shot && (shot->getFlag() != Flags::InvisibleBullet || iSeeAll)) {

Remove "&& (shot->getFlag() != Flags::InvisibleBullet || iSeeAll)" so that the edited line looks like this:

if (shot) {

Look at this entire section now (includes edited line from above):

if (shot) {
const float *shotcolor;
if (coloredShot) {
if (myTank->getFlag() == Flags::Colorblindness)
shotcolor = Team::getRadarColor(RogueTeam,rabbitMode);
else
shotcolor = Team::getRadarColor(player->getTeam(),rabbitMode);
const float cs = colorScale(shot->getPosition()[2], muzzleHeight);

Notice the fourth line in particular:

if (myTank->getFlag() == Flags::Colorblindness)

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

if (myTank->getFlag())

Next, remove this line:

shotcolor = Team::getRadarColor(RogueTeam,rabbitMode);

... and this:

else

... so that the modified section should now read like this:

if (shot) {
const float *shotcolor;
if (coloredShot) {
if (myTank->getFlag())
shotcolor = Team::getRadarColor(player->getTeam(),rabbitMode);
const float cs = colorScale(shot->getPosition()[2], muzzleHeight);

Save the file, compile your client, and you're done! To view Phasmophage's original instructions, take a look at his comment to "HOWTO: Reverse While Sealed with Oscillation Overthruster" at the blog Cheating BZFlag as well as the update comment to the post, "HOWTO: See Invisible Bullets and Actual Colors on Radar".

As always...

Have fun!

Always See Actual Tank Colors

By: Phasmophage

Here's an edit that will allow you to see the actual tank color of players even if they have Masquerade and/or if you have Colorblindness. For this, we will go to playing.cxx in /src/bzflag/ of the extracted source. Search for "const bool colorblind = (myTank->getFlag()", and you will come to this section:

const bool colorblind = (myTank->getFlag() == Flags::Colorblindness);
player[i]->addShots(scene, colorblind);

TeamColor effectiveTeam = RogueTeam;
if (!colorblind){
if ((player[i]->getFlag() == Flags::Masquerade)
&& (myTank->getFlag() != Flags::Seer)
&& (myTank->getTeam() != ObserverTeam)) {
effectiveTeam = myTank->getTeam();
}
else {
effectiveTeam = player[i]->getTeam();
}
}

const bool inCockpt = ROAM.isRoaming() && !devDriving &&

Look at the first line. Replace "(myTank->getFlag() == Flags::Colorblindness);
player[i]->addShots(scene, colorblind)" with "false" so that the edited line looks like this:

const bool colorblind = false;

Next, look at the line "TeamColor effectiveTeam = RogueTeam;". Replace "RogueTeam" with "player[i]->getTeam()" so that the edited line looks like this:

TeamColor effectiveTeam = player[i]->getTeam();

Remove the lines between the line above and "const bool inCockpt = ROAM.isRoaming() && !devDriving &&" so that the section will look like this:

TeamColor effectiveTeam = player[i]->getTeam();

const bool inCockpt = ROAM.isRoaming() && !devDriving &&

The entire edited section should now look like this:

const bool colorblind = false;
player[i]->addShots(scene, colorblind);

TeamColor effectiveTeam = player[i]->getTeam();

const bool inCockpt = ROAM.isRoaming() && !devDriving &&

As Phasmophage said it, "This should color masqueraded tanks correctly, and take out some of the effects of colorblindness."

Save the file, compile your new client, and you're done. To view Phasmophage's original instructions, read his comment to "HOWTO: Reverse While Sealed with Oscillation Overthruster" from the blog Cheating BZFlag.

And,...

Have fun!

Reverse While Sealed with Oscillation Overthruster

By: Phaz

Tired of not being able to reverse into a building with your Oscillation Overthruster (OO) flag? If you poke out of a building to take a shot, can only back into the building by jumping backward which leaves you vulnerable. Or, let's say that you are sealed in a thin wall. If you want to backtrack, you will have to leave the safety of the building to turn around.

No longer!

Thanks to this tip from Phaz, you can back up while sealed with OO! Now you can pull out, snipe your shot, and simply back up into the safety of the building (or other obstacle where you can be sealed). That is, you are no longer limited to driving only in the forward direction.

For this edit, we are going to open LocalPlayer.cxx in /src/bzflag/ of the extracted source. First let's edit the sections that prevent us from being able to back up while sealed. Search for "if (expelled && phased)", and you will this section:

if (expelled && phased)
expelled = (obstacle->getType() == WallObstacle::getClassName() ||
obstacle->getType() == Teleporter::getClassName() ||
(getFlag() == Flags::OscillationOverthruster && desiredSpeed < 0.0f &&
p[2] == 0.0f));
return obstacle;

Remove The following from above:
                                                                
||
(getFlag() == Flags::OscillationOverthruster && desiredSpeed < 0.0f &&
p[2] == 0.0f));

The section should now read like this:

if (expelled && phased)
expelled = (obstacle->getType() == WallObstacle::getClassName() ||
obstacle->getType() == Teleporter::getClassName());
return obstacle;

Next, search for "if (expelled && phased)" again, and you will find this section:

if (expelled && phased)
expelled = (obstacle->getType() == WallObstacle::getClassName() ||
obstacle->getType() == Teleporter::getClassName() ||
(hasOOflag && desiredSpeed < 0.0f && p[2] == 0.0f));

if (obstacle != NULL) {

Remove the following from above:

||
(hasOOflag && desiredSpeed < 0.0f && p[2] == 0.0f));

The section should now read like this:

if (expelled && phased)
expelled = (obstacle->getType() == WallObstacle::getClassName() ||
obstacle->getType() == Teleporter::getClassName());

if (obstacle != NULL) {

Lastly, search for "oscillation overthruster tank in building can't" and you will find this section:

else if (fracOfMaxSpeed < -0.5f) fracOfMaxSpeed = -0.5f;

// oscillation overthruster tank in building can't back up
if (fracOfMaxSpeed < 0.0f && getLocation() == InBuilding &&
flag == Flags::OscillationOverthruster) {
fracOfMaxSpeed = 0.0f;
}

// boost speed for certain flags

Let's remove the portion about not being able to back up in a building so that the edited section now reads like this:

else if (fracOfMaxSpeed < -0.5f) fracOfMaxSpeed = -0.5f;

// boost speed for certain flags

Save the file, compile your new client, and you're done! For Phaz's original instructions, see his comment to "HOWTO: Drop Bad Flags Instantly"at Cheating BZFlag.

Keep these tips rolling in! And as always...

Have fun!

Respawn Instantly

Brought to you by blogger, Someone

Someone actually brought this to us a while back, and I apologize for taking so long to post it. Anyway, here's a tip that will allow you to respawn instantly after exploding. In LocalPlayer.cxx (in /src/bzflag/ of the extracted source), search for "else if (location == Exploding)" and you will find this section:

} else if (location == Exploding) {
// see if explosing time has expired
if (lastTime - getExplodeTime() >= BZDB.eval(StateDatabase::BZDB_EXPLODETIME)) {
dt -= float((lastTime - getExplodeTime()) - BZDB.eval(StateDatabase::BZDB_EXPLODETIME));
if (dt < 0.0f) {
dt = 0.0f;
}
setStatus(PlayerState::DeadStatus);
location = Dead;
if (isAutoPilot()) {
CMDMGR.run("restart");
}
}

// can't control explosion motion
newVelocity[2] += BZDBCache::gravity * dt;
newAngVel = 0.0f; // or oldAngVel to spin while exploding
} else if ((location == OnGround) || (location == OnBuilding) ||

First, let's look at the first through tenth lines from above:

} else if (location == Exploding) {
// see if explosing time has expired
if (lastTime - getExplodeTime() >= BZDB.eval(StateDatabase::BZDB_EXPLODETIME)) {
dt -= float((lastTime - getExplodeTime()) - BZDB.eval(StateDatabase::BZDB_EXPLODETIME));
if (dt < 0.0f) {
dt = 0.0f;
}
setStatus(PlayerState::DeadStatus);

Let's remove the second through seventh lines so that it now reads like this:

} else if (location == Exploding) {
setStatus(PlayerState::DeadStatus);

Next, notice this section:

setStatus(PlayerState::DeadStatus);
location = Dead;
if (isAutoPilot()) {
CMDMGR.run("restart");

Let's remove "location = Dead;" and "if (isAutoPilot()) {". Below the line "location = Dead;", add the following:

LocalPlayer *myTank = LocalPlayer::getMyTank();

Below that line, add this line:

myTank->setJumpPressed(false);

The above edits should now read like this:

setStatus(PlayerState::DeadStatus);
LocalPlayer *myTank = LocalPlayer::getMyTank();
myTank->setJumpPressed(false);
CMDMGR.run("restart");

Next, notice this section:

CMDMGR.run("restart");
}
}

// can't control explosion motion
newVelocity[2] += BZDBCache::gravity * dt;
newAngVel = 0.0f; // or oldAngVel to spin while exploding
} else if ((location == OnGround) || (location == OnBuilding) ||

Let's remove the lines between "CMDMGR.run("restart");" and " } else if ((location == OnGround) || (location == OnBuilding) ||" so that the section now reads like this:

CMDMGR.run("restart");
} else if ((location == OnGround) || (location == OnBuilding) ||

All of the above edits should now look like this:

} else if (location == Exploding) {
setStatus(PlayerState::DeadStatus);
LocalPlayer *myTank = LocalPlayer::getMyTank();
myTank->setJumpPressed(false);
CMDMGR.run("restart");
} else if ((location == OnGround) || (location == OnBuilding) ||

When you are finished, compile your client and you're done. To view Someone's original instructions, read his comment to "HOWTO: Drop Bad Flags Instantly" at the original blog, Cheating BZFlag.

As always...

Have fun!

Drop Bad Flags Like Regular Flags

By: Phaz

You may recall our earlier post about how to how to drop bad flags instantly. With that edit, you drop a bad flag as soon as you pick it up. You may not always want to do that especially on servers that do not allow players to drop bad flags since you may bring suspicion to yourself.

TIP: If you are not interested in cheating... On servers where dropping bad flags is not allowed, you can usually take advantage of the drop flag after pausing feature of BZFlag to drop your bad flag. Simply pause, and your flag will drop after a few seconds.

As an alternative to dropping bad flags instantly, Phaz has a simple edit for us that will allow a player to drop a bad flag like a regular flag. For this, we are going to edit clientCommands.cxx in /src/bzflag of the extracted source. Search for "flag->endurance != FlagSticky" and you will find this section:

if ((flag != Flags::Null) && !myTank->isPaused() &&
(flag->endurance != FlagSticky) && !myTank->isPhantomZoned() &&
!(flag == Flags::OscillationOverthruster &&
myTank->getLocation() == LocalPlayer::InBuilding)) {
serverLink->sendDropFlag(myTank->getPosition());

In particular, notice the second line:

(flag->endurance != FlagSticky) && !myTank->isPhantomZoned() &&

Remove "(flag->endurance != FlagSticky) &&" so that the line now reads like this:

!myTank->isPhantomZoned() &&

Save the file, compile the client, and you're done! To see Phaz's original instructions, read his comment to HOWTO: Drop Bad Flags Instantly at Cheating BZFlag. As always...

Have fun!

Drop Bad Flags Instantly

By: Lord Jesus

Bad flags are annoying, are they not? This is especially true in situations such as grabbing Jamming when your opponent has Cloaking. And those time limits! On servers with bad flag drop such as 15 seconds or more, waiting can be ever so dull. Wide Angle isn't so awfully bad if you get used being able to utilize it; but, let's face it; there are certainly other more desirable flags.

Here's an edit that will allow you to drop bad flags instantly even on servers that do not allow dropping of bad flags (an added bonus). Most players probably won't notice; however, there is a chance that the more experienced players might very well notice -- even if after a while -- as well as administrators especially if they're already monitoring you out of suspicion.

Open LocalPlayer.cxx in the /src/bzflag/ directory of the extracted source, and find the following lines:

// drop bad flag if timeout has expired
if (!isPaused() && dt > 0.0f && World::getWorld()->allowShakeTimeout() &&
getFlag() != Flags::Null && getFlag()->endurance == FlagSticky &&
flagShakingTime > 0.0f) {
flagShakingTime -= dt;
if (flagShakingTime <= 0.0f) {
flagShakingTime = 0.0f;
server->sendDropFlag(getPosition());

First, look at the second line:

if (!isPaused() && dt > 0.0f && World::getWorld()->allowShakeTimeout() &&

Let's remove "World::getWorld()->allowShakeTimeout() &&" so that it reads like this:

if (!isPaused() && dt > 0.0f &&

Next, let's look at the fifth line:

flagShakingTime -= dt;

Let's change "-= dt" to "= 0.0f" so that the line reads like this:

flagShakingTime = 0.0f;

The above will allow you to drop bad flags instantly on servers that allow for dropping of bad flags. To be able to drop flags on servers that don't allow dropping, we need to edit elsewhere. Take note, however, that experienced players will most likely notice your dropping bad flags if you are playing on a server that doesn't allow it. To add the ability, find the following lines:

// if it's bad then reset countdowns and set antidote flag
if (getFlag() != Flags::Null && getFlag()->endurance == FlagSticky) {
if (World::getWorld()->allowShakeTimeout())
flagShakingTime = World::getWorld()->getFlagShakeTimeout();

Look at the third line:

if (World::getWorld()->allowShakeTimeout())

Remove "->allowShakeTimeout()" so that it reads like this:

if (World::getWorld())

Next, let's look at the fourth line:

flagShakingTime = World::getWorld()->getFlagShakeTimeout();

Replace "= World::getWorld()->getFlagShakeTimeout();" with "= 0.05f;" so that it reads like this:

flagShakingTime = 0.05f;

I originally tried the number to "0.0f". When I tested it on my server not allowing bad flag dropping, and no win limit, it didn't work; I picked up a bad flag and it didn't drop. So, 0.05f "works". All of this tip works even if there are easier and/or more efficient ways of accomplishing the same ends :)

When you're finished, save your file, compile your new client, and...

Have fun!

Speed Hacking

Brought to you by: Felipe

Here are some tips that will allow you to get the most of your tank's speed without having to depend on the high speed flag. You can optionally add quick turn to your tank, as well. Even without extreme speed, and handful of servers may kick you. Most won't at the time of this post. A few more servers may kick you for extreme speed. Nevertheless, you will enjoy always being able to chase down other tanks...

Open LocalPlayer.cxx in /src/bzflag/ of the extracted source. With your favorite text editor, find the following lines:

// boost speed for certain flags
if (flag == Flags::Velocity) {
fracOfMaxSpeed *= BZDB.eval(StateDatabase::BZDB_VELOCITYAD);

Look at the first line. Remove the "== Flags::Velocity" so that this section reads like this:

// boost speed for certain flags
if (flag) {
fracOfMaxSpeed *= BZDB.eval(StateDatabase::BZDB_VELOCITYAD);

This will give you high speed regardless of flag save Thief and Burrow. Additionally, you will see further down these lines:

} else if ((flag == Flags::Burrow) && (getPosition()[2] < 0.0f)) {
fracOfMaxSpeed *= BZDB.eval(StateDatabase::BZDB_BURROWSPEEDAD);

You can change "BZDB_BURROWSPEEDAD" to "BZDB_VELOCITYAD" so that the lines read like this:

} else if ((flag == Flags::Burrow) && (getPosition()[2] < 0.0f)) {
fracOfMaxSpeed *= BZDB.eval(StateDatabase::BZDB_VELOCITYAD);

This will give you high speed with Burrow. You can also play around some of these variables. For example, I substituted "BZDB_BURROWSPEEDAD" and "BZDB_VELOCITYAD" with "BZDB_THIEFVELAD" so that I could drive at the speed of Thief on my own server. Some servers will undoubtedly kick you for driving too fast when you drive at Thief speed without Thief... but then, some won't :)

For EXTREME speed, find the following lines:

// can't go faster forward than at top speed, and backward at half speed
if (fracOfMaxSpeed > 1.0f) fracOfMaxSpeed = 1.0f;
else if (fracOfMaxSpeed < -0.5f) fracOfMaxSpeed = -0.5f;

Change the numbers so that the section now reads like this:

// can't go faster forward than at top speed, and backward at half speed
if (fracOfMaxSpeed > 0.0f) fracOfMaxSpeed = 9.0f;
else if (fracOfMaxSpeed < 0.0f) fracOfMaxSpeed = -9.0f;

Again, play around with the numbers to find a speed that you like. Naturally, you will stick out like a sore thumb when you drive so unbelievably faster than everyone else. Hehehe...

For the original instructions, see Felipe's comments to Flying Without Wings & Extended Jumping at the original Cheating BZFlag blog. When you're finished, save the file, compile your new client, and ...

Have fun!