You can now teleport players or spawn them elsewhere without needing to "kill" them. (Useful for not flooding the chat console.) The only real drawback which is currently held, is simply the flag dropped and flag grabbed messages. (Which if no flags are being held, zero messages will appear... in essence true teleportation.)
As for what uses this can have, it will be covered right after the initial guide on how to do it:
For the additional headers needed to make this work are: bzfs.h and GameKeeper.h
The way I compile stuff causes it to look like this:
Code: Select all
#include "bzfsAPI.h"
#include "../src/bzfs/bzfs.h"
#include "../src/bzfs/GameKeeper.h"
Here is what I use to do it:
Code: Select all
int SetPlayerDead(int playerID) {
int status = 0;
GameKeeper::Player *p = GameKeeper::Player::getPlayerByIndex(playerID);
if (p == NULL) {
status= -1;
} else {
if (p->player.isObserver()) {
status= -2;
} else {
if (p->player.isAlive()) {
status=1;
p->player.setDead();
p->player.setRestartOnBase(false);
} else {
status=2;
}
}
}
return status;
}
Note: A spawn event is always triggered upon this version of "teleportation". If you wish to customize the spawns, the bz_eGetPlayerSpawnPosEventfollowing event must be registered in the Init section of your plug-in:
Code: Select all
void Sample::Init( const char* /*commandLine*/ )
{
Register(bz_eGetPlayerSpawnPosEvent);
}
For the teleport itself, this is done via the following:
Code: Select all
SetPlayerDead(playerID);
playerAlive(playerID);
---
Since this doesn't quite explain what is possible, we now have the options of creating previously impossible game modes. Objects which can be accessed per-team, horizontal teleporters, instant teleportation, flags with kickback..etc
We can expect to see some very interesting game modes and concepts rolled out in 2024. (And new maps to go with them.)
-Zehra