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
;)
Showing posts with label guided lasers. Show all posts
Showing posts with label guided lasers. Show all posts
Saturday, August 4, 2007
Subscribe to:
Posts (Atom)