Monday, September 10, 2007

Teleport Behind Somebody

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();
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.
aka phaz


randomdude said...

First off, thanks for all the great cheats.

I was wondering if you could help me with an issue. You can forget all the ones i said before, i completely started from scratch and everything was pretty much ok, but when i start my client, i see the "all", "chat", "server", and "misc" tabs, but then the client just quits.

I think it may be something to do with radarrenderer.cxx, but i don't know.

Sound like an issue one of you can identify?

phasmophage said...

Does it quit with or without an error? Like, will it say "BZFlag needs to close"? I'm not sure if that kind of thing has happened to me before. Once, my client would crash when trying to join a server a second time. This happened because I didn't check to see if a pointer was NULL. This probably doesn't help. What was the last edit or cheat you were trying to install?

randomdude said...

Its hard to say which cheat was the last one i coded, because i did that entire client non-stop from scratch, because my other one had errors.

I did get some compile errors, however, which i resolved (can't remember completely how though XD)

It was in this cheat i remember, for viewing radar on maps without radar, i got errors about an unmatched '{' in the part that said:

{ 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

I ended up copy - pasting my radarrenderer.cxx from my old client, which i was fairly sure was a good cheat copy of it.

I'm not sure how the coding differs, but i am using 2.0.9, if that is any help

randomdude said...

it took awhile, but i fixed it.
the problem lay in playing.cxx

i think in 2.0.9 the coding is different, because it had to look for 2 lines (cant remember what they were) and change them to:

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

however, i had lines in the middle of them saying something along the lines of:

} else if ((int)(pauseCountdown + 0.99f) != oldPauseCountdown &&
!pausedByUnmap) {

that gave me errors. to resolve those i changed the lines i edited before to:

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

that seemed to work ok, then i got errors further down about an undeclared identifier ( i think that was it ), it was the same code as i found in the middle before, so i commented it out and tried again:

// } else if ((int)(pauseCountdown + 0.99f) != oldPauseCountdown &&
// !pausedByUnmap) {

and that resolved my issues, i am now able to compile and play.

the point of this post? i have another error. i think its something i did when resolving the previous issue. when i try to pause, instead of pausing instantly, it says "pausing in 5", and then dissapears when it should reach 4.

obviously it shouldn't have a countdown at all, but i was hoping that perhaps with all that information somebody might be able to help me?

thanks for all the great cheats, i just love the /behind one, and thanks to you i now understand how to toggle cheats, and have succesfully made wings toggleable :)

randomdude said...

aha! never mind, i fixed it.
the problem lay in the fact that i SEVERELY screwed up all the code XD

fixed now, and the client is awesome i can toggle wings, god mode, quick turn, oo, and high speed


Someone said...

*cough* Someone *cough*


I found that bzfs does not validate sendTranferFlag Msgs for if the other player has thief. You can send people flags by doing what you did in this cheat, but replacing it with:

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

randomdude said...

I have a very simple one-line cheat to submit, but it adds almight power to guided laser.

Makes the GM turn angle much higher, also affecting the laser angle.

The cheat is in GuidedMissleStrategy.cxx

Find " float gmissileAng = BZDB.eval(StateDatabase::BZDB_GMTURNANGLE);"

replace it with

" float gmissileAng = BZDB.eval(StateDatabase::BZDB_GMADLIFE)"

Thats it.

By the way, is it part of the gm multi-lock cheat that i am locking on to tanks that i didnt actually press lock on for?

person said...
This comment has been removed by the author.
phasmophage said...

Hmm. I've never heard of such a problem. It works fine for me. What version are you using?

person said...

Nevermind, i got it to work, =P. My bad.

person said...

Somtimes when you do /behind to somon you apper behind somone else. Is this just me?

phasmophage said...

Are you private messaging the person you would like to appear behind? Use the period key "." to PM. Maybe you're confusing the "." and "," keys.

Someone said...

randomdude: Funny, but I have that cheat. You are doing it wrong though. It will look like all GM's are more powerful, but in reality yours will be normal, and others' will be powerful. You have to do something like:

float gmissileAng = BZDB.eval(StateDatabase::BZDB_GMTURNANGLE);
if (!isRemote)
gmissileAng *= 1000;

Then, there is a section like this:

// only send an update when needed
if (!needUpdate) return;

Delete it.

This will make Only your GM's very powerful.

phasmophage said...

Yeah, that's a pretty good cheat. The higher you make gmissileAng, the faster it can turn. I've set mine to 999, but you can set it higher. It probably wont make a difference past 999, though.
Hey, someone, you seem to be pretty good with the guided missiles. Do you know if it's possible to have a regular bullet be guided like a missile? Apparently CRW said he saw somebody do it. Do you know how?

person said...

I realised the problem! Only the player on my "." key i can teleport behind! If i target them and send the message to them using ""," it wont work!

phasmophage said...

person: That's what I've been trying to tell you!
/me laughs.

person said...

lol, is there a wa to make it go to the person uve targeted?

phasmophage said...

Yeah, just put getTarget() instead of getRecipient().

defects said...

I have problem of "/behind not a recognized command" and nothing happens. What did I do wrong?