Post your giveLife() Method
|
I have just recently changed my teleport location of the resettzhaar public void. And I noticed that whenever someone dies they now spawn at the tzhaar caves. So what I'm thinking the problem is, is that when you die it resets the resettzhaar int and sends you to the place where I changed te resettzhaar area.
Here is my error when someone dies:
I checked them all. Here is where all the errors are[2/26/12 1:50 PM]: Launching Torvapkz in 3... 2... 1... Starting...Now!
[2/26/12 1:50 PM]: Server listening on port 168.144.32.116:43594
[2/26/12 1:50 PM]: [REGISTERED]: tony
[2/26/12 1:50 PM]: java.lang.NullPointerException
[2/26/12 1:50 PM]: at server.model.players.PlayerAssistant.applyDead(Pla yer
Assistant.java:1216)
[2/26/12 1:50 PM]: at server.model.players.Client.process(Client.java:18 81)
[2/26/12 1:50 PM]: at server.model.players.PlayerHandler.process(PlayerH and
ler.java:142)
[2/26/12 1:50 PM]: at server.Server.main(Server.java:176)
In PlayerAssistant (the whole void)
[SPOIL][/SPOIL]public void applyDead() {
c.respawnTimer = 15;
c.isDead = false;
Client o = (Client) Server.playerHandler.players[c.killerId];
if(c.duelStatus != 6) {
c.killerId = findKiller();
if(o != null) {
c.playerKilled = c.playerId;
if(o.duelStatus == 5) {
o.duelStatus++;
}
int random2 = Misc.random(20);
int randomz2 = Misc.random(5);
if(random2 == 10) {
if (randomz2 == 0)
{
Server.itemHandler.createGroundItem(o, 14876, c.getX(), c.getY(), 1, c.killerId);
o.sendMessage("<col=990>Congratulations! you recieved a PvP artifact drop! Talk to the Mandrith at home!");
}
if (randomz2 == 1)//demise
{
Server.itemHandler.createGroundItem(o, 14877, c.getX(), c.getY(), 1, c.killerId);
o.sendMessage("<col=990>Congratulations! you recieved a PvP artifact drop! Talk to the Mandrith at home!");
}
if (randomz2 == 2)
{
Server.itemHandler.createGroundItem(o, 14878, c.getX(), c.getY(), 1, c.killerId);
o.sendMessage("<col=990>Congratulations! you recieved a PvP artifact drop! Talk to the Mandrith at home!");
}
if (randomz2 == 3)
{
Server.itemHandler.createGroundItem(o, 14879, c.getX(), c.getY(), 1, c.killerId);
o.sendMessage("<col=990>Congratulations! you recieved a PvP artifact drop! Talk to the Mandrith at home!");
}
if (randomz2 == 4)
{
Server.itemHandler.createGroundItem(o, 14880, c.getX(), c.getY(), 1, c.killerId);
o.sendMessage("<col=990>Congratulations! you recieved a PvP artifact drop! Talk to the Mandrith at home!");
}
if (randomz2 == 5)
{
Server.itemHandler.createGroundItem(o, 14881, c.getX(), c.getY(), 1, c.killerId);
o.sendMessage("<col=990>Congratulations! you recieved a PvP artifact drop! Talk to the Mandrith at home!");
}
}
if (Server.playerHandler.players[c.playerId].connectedFrom != o.lastKilled && c.duelStatus == 0) {
o.pkPoints = (o.pkPoints + 10);
o.sendMessage("You recieved 10 DX Points,Double DX Points");
o.lastKilled = Server.playerHandler.players[c.playerId].connectedFrom;
} else {
o.sendMessage("You do not recieve pk points because you have killed " +c.playerName+ " twice in a row.");
}
}
}
c.faceUpdate(0);
c.npcIndex = 0;
c.playerIndex = 0;
c.stopMovement();
if (c.duelStatus <= 4) {
c.sendMessage("Oh dear you are dead!");
} else if(c.duelStatus != 6 || !c.inArena()) {
c.sendMessage("You have lost the duel!");
/*o.getPA().movePlayer(
Config.DUELING_RESPAWN_X
+ (Misc.random(Config.RANDOM_DUELING_RESPAWN)),
Config.DUELING_RESPAWN_Y
+ (Misc.random(Config.RANDOM_DUELING_RESPAWN)), 0);*/
}
resetDamageDone();
c.DC++;
o.KC++;
c.specAmount = 10;
c.getItems().addSpecialBar(c.playerEquipment[c.playerWeapon]);
c.lastVeng = 0;
c.vengOn = false;
resetFollowers();
c.attackTimer = 10;
if (Server.playerHandler.players[c.killerId].connectedFrom.equals(Server.playerHandler.players[c.playerKilled].connectedFrom)) {
o.sendMessage("You Don't Recieve PK Points for killing yourself!");
c.faceUpdate(0);
c.npcIndex = 0;
c.playerIndex = 0;
c.stopMovement();
if(c.duelStatus <= 4) {
c.sendMessage("Oh dear you are dead!");
} else if(c.duelStatus != 6) {
c.sendMessage("You have lost the duel!");
}
resetDamageDone();
c.lastVeng = 0;
c.vengOn = false;
resetFollowers();
c.attackTimer = 10;
removeAllWindows();
c.tradeResetNeeded = true;
return;
}
}
In Client.java (just the apply dead
[SPOIL][/SPOIL]if(isDead && respawnTimer == -6) {
getPA().applyDead();
}
And I also have the common errors in Server.java and Client.java when a server has an error. Please help?
Post your giveLife() Method
Okay here it is I'll highlight the resettzhaar
[SPOIL][/SPOIL]public void giveLife() {
c.isDead = false;
c.faceUpdate(-1);
c.freezeTimer = 0;
if(c.playerRights == 3) {
for (int i = 0; i < 20; i++) {
c.playerLevel[i] = getLevelForXP(c.playerXP[i]);
c.getPA().refreshSkill(i);
}
c.getCombat().resetPrayers();
c.teleportToX = 3237;
c.teleportToY = 3523;
PlayerSave.saveGame(c);
c.getPA().resetTzhaar();
requestUpdates();
return;
}
if(c.duelStatus <= 4 && !c.getPA().inPitsWait()) { // if we are not in a duel we must be in wildy so remove items
if (!c.inPits && !c.inDungeons() && !c.inFightCaves() && !c.inPcGame()) {
c.getItems().resetKeepItems();
if((c.playerRights == 2 && Config.ADMIN_DROP_ITEMS) || c.playerRights != 2) {
if(!c.isSkulled && !c.isInArd()) { // what items to keep
c.getItems().keepItem(0, true);
c.getItems().keepItem(1, true);
c.getItems().keepItem(2, true);
}
if(c.prayerActive[10] || c.isInArd() && System.currentTimeMillis() - c.lastProtItem > 700) {
c.getItems().keepItem(3, true);
}
c.getItems().dropAllItems(); // drop all items
c.getItems().deleteAllItems(); // delete all items
if(!c.isSkulled && !c.isInArd()) { // add the kept items once we finish deleting and dropping them
for (int i1 = 0; i1 < 3; i1++) {
if(c.itemKeptId[i1] > 0) {
c.getItems().addItem(c.itemKeptId[i1], 1);
}
}
}
if(c.prayerActive[10] || c.isInArd()) { // if we have protect items
if(c.itemKeptId[3] > 0) {
c.getItems().addItem(c.itemKeptId[3], 1);
}
}
}
c.getItems().resetKeepItems();
} else if (c.inPits) {
Server.fightPits.removePlayerFromPits(c.playerId);
c.pitsStatus = 1;
}
}
c.getCombat().resetPrayers();
for (int i = 0; i < 25; i++) {
c.playerLevel[i] = getLevelForXP(c.playerXP[i]);
c.getPA().refreshSkill(i);
}
if (c.pitsStatus == 1) {
movePlayer(2399, 5173, 0);
} else if(c.duelStatus <= 4) { // if we are not in a duel repawn to wildy
movePlayer(Config.RESPAWN_X, Config.RESPAWN_Y, 0);
c.isSkulled = false;
c.skullTimer = 0;
c.attackedPlayers.clear();
} else if (c.inDungeons()) {
movePlayer(Config.DUNG_RESPAWN_X, Config.DUNG_RESPAWN_Y, 0);
c.isSkulled = false;
c.skullTimer = 0;
c.attackedPlayers.clear();
} else if (c.inFightCaves()) {
c.getPA().resetTzhaar();
} else { // we are in a duel, respawn outside of arena
Client o = (Client) Server.playerHandler.players[c.duelingWith];
if(o != null) {
o.getPA().createPlayerHints(10, -1);
if(o.duelStatus == 6) {
o.getTradeAndDuel().duelVictory();
}
}
movePlayer(Config.DUELING_RESPAWN_X+(Misc.random(C onfig.RANDOM_DUELING_RESPAWN)), Config.DUELING_RESPAWN_Y+(Misc.random(Config.RANDO M_DUELING_RESPAWN)), 0);
if(c.duelStatus != 6) { // if we have won but have died, don't reset the duel status.
c.getTradeAndDuel().resetDuel();
}
}
//PlayerSaving.getSingleton().requestSave(c.playerId );
PlayerSave.saveGame(c);
c.getCombat().resetPlayerAttack();
resetAnimation();
c.startAnimation(-1);
frame1();
resetTb();
c.isSkulled = false;
c.attackedPlayers.clear();
c.headIconPk = -1;
c.skullTimer = -1;
c.damageTaken = new int[Config.MAX_PLAYERS];
c.getPA().requestUpdates();
removeAllWindows();
c.tradeResetNeeded = true;
}
Remove the resettzhaar from your givelife. It will teleport your player your x & y coords, which is generally home.
So your regular spawning is fixed. Then add that resettzhaar to the fightcaves instead of regular death(giveLife())
bump-hump
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |