I just did this tutorial:
http://www.rune-server.org/showthrea...ghlight=follow
But this is what happens:
Im using delta base. And dont say me, dont use delta, but i wanna have this finished
This is the code:
Code:
public class FollowHandler {
// TODO: Lowercase the current package(util/misc)(Java conventions).
private final client client;
private final int[] followX = new int[1000], followY = new int[1000];
private int followLastX = 1, followLastY = 1, followingStepsWalked = 1,
followIndex = 1;
/**
* Constructs new instance with a provided client(player).
*
* @param client
* The <code>client</code> instance.
*/
public FollowHandler(final client client) {
this.client = client;
}
/**
* Reset the following.
*/
public void resetFollowing() {
followingStepsWalked = 1;
client.followID = -1;
followIndex = 1;
followLastX = 1;
followLastY = 1;
}
/**
* Follows the provided player.
*
* @param follow
* The player to follow.
*/
public void follow(final int follow) {
int absX = client.absX;
int absY = client.absY;
client.followID = follow;
Player Players[] = server.playerHandler.players;
if (absX == followX[followingStepsWalked] && followY[followingStepsWalked ] == absY && followX[followingStepsWalked + 1] != 0) {
followingStepsWalked++;
}
if (client.followID != -1 && followIndex > 0
&& followIndex > 999999) {
resetFollowing();
}
if (client.WithinDistance(Players[client.followID].absX,
Players[client.followID].absY, absX, absY, 61)) {
followX[followIndex] = Players[client.followID].absX;
followY[followIndex] = Players[client.followID].absY;
}
if (client.WithinDistance(followLastX, followLastY,
followX[followIndex], followY[followIndex], 1)
&& followIndex > 0) {
followIndex--;
}
if (client.WithinDistance(absX, absY,
Players[client.followID].absX,
Players[client.followID].absY, 1)) {
followX[1] = Players[client.followID].absX;
followY[1] = Players[client.followID].absY;
followIndex = 1;
followingStepsWalked = 1;
}
if (followX[followIndex] != 0
&& followY[followIndex] != 0
&& !client.WithinDistance(absX, absY, followX[followIndex],
followY[followIndex], 1)
&& followX[followingStepsWalked] != 0
&& followY[followingStepsWalked] != 0) {
client.walkTo(client.getMove(absX,
followX[followingStepsWalked ]), client.getMove(absY,
followY[followingStepsWalked ]));
client.faceNPC = 32768 + client.followID;
followLastX = followX[followIndex];
followLastY = followY[followIndex];
followIndex++;
} else {
resetFollowing();
}
}
}
So my problem is: It stops following if it reached to other player.
Normally this is in my process():
if(followID > 0) {
followDirection();
}
But because i use the followhandler, i had to remove followdirection.
So what do i have to put in process now to execute the following in the followhandler?