clipped following and clipped diagonal. rep+
Does anyone know how to fix the clipped playerfolowing and the npc noclipping in diagonal lines?
Npc following fixed player following left:d
EDIT:
Playerfollow:
Code:
public void followPlayer() {
if(Server.playerHandler.players[c.followId] == null || Server.playerHandler.players[c.followId].isDead) {
c.followId = 0;
return;
}
if(c.freezeTimer > 0) {
return;
}
int otherX = Server.playerHandler.players[c.followId].getX();
int otherY = Server.playerHandler.players[c.followId].getY();
boolean canwalk = true;
boolean withinDistance = c.goodDistance(otherX, otherY, c.getX(), c.getY(), 2);
boolean hallyDistance = c.goodDistance(otherX, otherY, c.getX(), c.getY(), 2);
boolean bowDistance = c.goodDistance(otherX, otherY, c.getX(), c.getY(), 4);
boolean rangeWeaponDistance = c.goodDistance(otherX, otherY, c.getX(), c.getY(), 2);
if(!c.goodDistance(otherX, otherY, c.getX(), c.getY(), 25)) {
c.followId = 0;
return;
}
c.faceUpdate(c.followId+32768);
if (otherY == c.getY() && otherX == c.getX()) {
switch(Misc.random(3)) {
case 0:
walkTo(0, getMove(c.getX(), otherX - 1));
break;
case 1:
walkTo(0, getMove(c.getX(), otherX + 1));
break;
case 2:
walkTo(0, getMove(c.getY(), otherY + 1));
break;
case 3:
walkTo(0, getMove(c.getY(), otherY - 1));
break;
}
}
if(c.usingBow && bowDistance) {
return;
}
if(c.getCombat().usingHally() && hallyDistance) {
return;
}
if(c.usingRangeWeapon && rangeWeaponDistance) {
return;
}
if(c.isRunning2 && !withinDistance) {
if(otherY > c.getY() && otherX == c.getX()) {
walkTo(0, getMove(c.getY(), otherY - 1) + getMove(c.getY(), otherY - 1));
} else if(otherY < c.getY() && otherX == c.getX()) {
walkTo(0, getMove(c.getY(), otherY + 1) + getMove(c.getY(), otherY + 1));
} else if(otherX > c.getX() && otherY == c.getY()) {
walkTo(getMove(c.getX(), otherX - 1) + getMove(c.getX(), otherX - 1), 0);
} else if(otherX < c.getX() && otherY == c.getY()) {
walkTo(getMove(c.getX(), otherX + 1) + getMove(c.getX(), otherX + 1), 0);
} else if(otherX < c.getX() && otherY < c.getY()) {
walkTo(getMove(c.getX(), otherX + 1) + getMove(c.getX(), otherX + 1), getMove(c.getY(), otherY + 1) + getMove(c.getY(), otherY + 1));
} else if(otherX > c.getX() && otherY > c.getY()) {
walkTo(getMove(c.getX(), otherX - 1) + getMove(c.getX(), otherX - 1), getMove(c.getY(), otherY - 1) + getMove(c.getY(), otherY - 1));
} else if(otherX < c.getX() && otherY > c.getY()) {
walkTo(getMove(c.getX(), otherX + 1) + getMove(c.getX(), otherX + 1), getMove(c.getY(), otherY - 1) + getMove(c.getY(), otherY - 1));
} else if(otherX > c.getX() && otherY < c.getY()) {
walkTo(getMove(c.getX(), otherX + 1) + getMove(c.getX(), otherX + 1), getMove(c.getY(), otherY - 1) + getMove(c.getY(), otherY - 1));
}
} else {
if(otherY > c.getY() && otherX == c.getX()) {
walkTo(0, getMove(c.getY(), otherY - 1));
} else if(otherY < c.getY() && otherX == c.getX()) {
walkTo(0, getMove(c.getY(), otherY + 1));
} else if(otherX > c.getX() && otherY == c.getY()) {
walkTo(getMove(c.getX(), otherX - 1), 0);
} else if(otherX < c.getX() && otherY == c.getY()) {
walkTo(getMove(c.getX(), otherX + 1), 0);
} else if(otherX < c.getX() && otherY < c.getY()) {
walkTo(getMove(c.getX(), otherX + 1), getMove(c.getY(), otherY + 1));
} else if(otherX > c.getX() && otherY > c.getY()) {
walkTo(getMove(c.getX(), otherX - 1), getMove(c.getY(), otherY - 1));
} else if(otherX < c.getX() && otherY > c.getY()) {
walkTo(getMove(c.getX(), otherX + 1), getMove(c.getY(), otherY - 1));
} else if(otherX > c.getX() && otherY < c.getY()) {
walkTo(getMove(c.getX(), otherX - 1), getMove(c.getY(), otherY + 1));
}
}
}
If u help I will rep+
Thanks,
Arvid