HOWTO: Drop Bad Flags Instantly
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 forth 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!
Related post:
HOWTO: Drop Bad Flags Like Regular Flags