[317] Fully Working Following
POST IF YOU USE OR I WILL REMOVE!!
ADD CREDITS IN YOUR SERVER!
Description: Adding Player Following
Difficulty: 1.10
Assumed Knowledge: Knowledge
Tested Server: Scratch Source work on all.
Files/Classes Modified: client.java and player.java
Result:
http://i28.tinypic.com/2exbxo4.jpg
Procedure
Step 1: Open up player.java and added this.
Code:
public int FocusPointX = -1, FocusPointY = -1;
public Player followPlayer = null;
public boolean followPlayerIdle;
public boolean withinDistance(int distance, Player otherPlr) {
if(otherPlr == null) return false;
if(heightLevel != otherPlr.heightLevel) return false;
int deltaX = otherPlr.absX-absX, deltaY = otherPlr.absY-absY;
return deltaX <= distance && deltaX >= ((distance + 0) * -1) && deltaY <= distance && deltaY >= ((distance + 0) * -1);
}
public void getNextPlayerMovement() {
mapRegionDidChange = false;
didTeleport = false;
dir1 = dir2 = -1;
if(teleportToX != -1 && teleportToY != -1) {
followPlayer = null;
mapRegionDidChange = true;
if(mapRegionX != -1 && mapRegionY != -1) {
int relX = teleportToX-mapRegionX*8, relY = teleportToY-mapRegionY*8;
if(relX >= 2*8 && relX < 11*8 && relY >= 2*8 && relY < 11*8)
mapRegionDidChange = false;
}
if(mapRegionDidChange) {
mapRegionX = (teleportToX>>3)-6;
mapRegionY = (teleportToY>>3)-6;
playerListSize = 0;
}
currentX = teleportToX - 8*mapRegionX;
currentY = teleportToY - 8*mapRegionY;
absX = teleportToX;
absY = teleportToY;
resetWalkingQueue();
teleportToX = teleportToY = -1;
didTeleport = true;
} else {
if(followPlayer != null) {
if(followPlayerIdle) {
followPlayerIdle = false;
return;
}
dir1 = getNextFollowingDirection(followPlayer);
if(dir1 == -1) followPlayerIdle = true;
} else
dir1 = getNextWalkingDirection();
if(dir1 == -1) return;
if(isRunning && followPlayer != null)
dir1 = getNextFollowingDirection(followPlayer);
else if(isRunning)
dir2 = getNextWalkingDirection();
int deltaX = 0, deltaY = 0;
if(currentX < 2*8) {
deltaX = 4*8;
mapRegionX -= 4;
mapRegionDidChange = true;
} else if(currentX >= 11*8) {
deltaX = -4*8;
mapRegionX += 4;
mapRegionDidChange = true;
}
if(currentY < 2*8) {
deltaY = 4*8;
mapRegionY -= 4;
mapRegionDidChange = true;
} else if(currentY >= 11*8) {
deltaY = -4*8;
mapRegionY += 4;
mapRegionDidChange = true;
}
if(mapRegionDidChange) {
currentX += deltaX;
currentY += deltaY;
for(int i = 0; i < walkingQueueSize; i++) {
walkingQueueX[i] += deltaX;
walkingQueueY[i] += deltaY;
}
}
}
}
public int getNextFollowingDirection(Player player) { // Phates: My awsome follow
int dir = -1;
boolean goNorth = false, goSouth = false, goEast = false, goWestWhereTheCowboysRoam = false;
if(absX < player.absX)
goEast = true;
else if(absX > player.absX)
goWestWhereTheCowboysRoam = true;
if(absY < player.absY)
goNorth = true;
else if(absY > player.absY)
goSouth = true;
if(!goSouth && !goNorth && !goEast && !goWestWhereTheCowboysRoam) // Phate: if on the player
return -1;
if(withinDistance(1, player)) // Phate: If within 1 spot of the player
return -1;
if(goNorth && goEast)
dir = 2;
else if(goNorth && goWestWhereTheCowboysRoam)
dir = 14;
else if(goSouth && goEast)
dir = 6;
else if(goSouth && goWestWhereTheCowboysRoam)
dir = 10;
else if(goNorth)
dir = 0;
else if(goEast)
dir = 4;
else if(goWestWhereTheCowboysRoam)
dir = 12;
else if(goSouth)
dir = 8;
dir >>= 1;
currentX += misc.directionDeltaX[dir];
currentY += misc.directionDeltaY[dir];
absX += misc.directionDeltaX[dir];
absY += misc.directionDeltaY[dir];
return dir;
}
public int getNextWalkingDirection()
{
if(wQueueReadPtr == wQueueWritePtr) return -1; // walking queue empty
int dir;
do {
dir = misc.direction(currentX, currentY, walkingQueueX[wQueueReadPtr], walkingQueueY[wQueueReadPtr]);
if(dir == -1) wQueueReadPtr = (wQueueReadPtr+1) % walkingQueueSize;
else if((dir&1) != 0) {
println_debug("Invalid waypoint in walking queue!");
resetWalkingQueue();
return -1;
}
} while(dir == -1 && wQueueReadPtr != wQueueWritePtr);
if(dir == -1) return -1;
dir >>= 1;
currentX += misc.directionDeltaX[dir];
currentY += misc.directionDeltaY[dir];
absX += misc.directionDeltaX[dir];
absY += misc.directionDeltaY[dir];
return dir;
}
Then save.
NOTICE if you get a error about 2 of the same voids delete old ones.
Step 2: Open up client.java and find
public void initialize() {
and add
Code:
outStream.createFrameVarSize(104);
outStream.writeByteC(5);
outStream.writeByteA(0);
outStream.writeString("Follow");
outStream.endFrameVarSize();
Step 3: then find
Code:
public void parseIncomingPackets()
and add
Code:
case 39: //following
int pIndex2 = inStream.readUnsignedWordBigEndian();
server.FollowHandler.follow(pIndex2, playerId);
break;
Step 4: add this in case 98:
Code:
Code:
if(followPlayer != null) {
sendMessage("You stop following "+followPlayer.playerName);
followPlayer = null;
}
Step 5: make a file call FollowHandler.java and add this
Code:
Code:
public class FollowHandler {
public void follow(int them,int you) {
Player followplayer = server.playerHandler.players[them];
client c = (client) server.playerHandler.players[you];
if(c.withinDistance(followplayer)) {
c.faceNPC = 32768+them;//face them
c.faceNPCupdate = true;//face them
c.sendMessage("You are now following " + followplayer.playerName);
c.followPlayer = followplayer;
}
}
}
Step 5: Then in server.java add theses
Code:
Code:
FollowHandler = new FollowHandler();
Code:
Code:
public static FollowHandler FollowHandler = null;
ADDON ATTACKING FOLLOWING
Description: Makes you follow while attacking in the wild.
Difficulty: -1
Assumed Knowledge: How to press ctrl+f.
Tested Server: Any. You just have to use the linux's following tutorial
Files/Classes Modified: Client.java
Procedure
Step 1: Search for boolean attack
Step 2: Now add this in it:
Code:
Code:
server.FollowHandler.follow(AttackingOn, playerId);
That's it. If it doesn't work for you, to bad.
Re: [Fully Working Following
Awsome! Been looking for this actually. Thanks a lot!
Re: [Fully Working Following
Quote:
Originally Posted by
I Rule MU
Awsome! Been looking for this actually. Thanks a lot!
lol
i will post ALOT more professional tutorials not just cheesy commands and stuff
Re: [Fully Working Following
make sure they will be your own, cuz this is not yours, leeched from rune-server
Re: [Fully Working Following
Code:
Player.java:1236: <identifier> expected
public boolean withinDistance(int distance, Player, otherPlr) {
^
Player.java:1236: <identifier> expected
public boolean withinDistance(int distance, Player, otherPlr) {
^
2 errors
Fixed the other errors I got but can't seem to get rid of these, any help plz?
Re: [Fully Working Following
Quote:
Originally Posted by
Speci
Code:
Player.java:1236: <identifier> expected
public boolean withinDistance(int distance, Player, otherPlr) {
^
Player.java:1236: <identifier> expected
public boolean withinDistance(int distance, Player, otherPlr) {
^
2 errors
Fixed the other errors I got but can't seem to get rid of these, any help plz?
try with a different server source
Re: [Fully Working Following
Quote:
Originally Posted by
killerjak7
try with a different server source
I ain't doubting you, but i find it hard to believe that you are the creator of this here code, and yet you cannot fix the users problem.
Re: [Fully Working Following
Dear Moderators,
Please lock this thread.
It has been leeched from rune-server, and gave NO CREDITS at all.
Plus, this just screws up the servers,
- DJ WhizzKid
Rate: -999999999999999999999999999999999 out of 0.
Re: [Fully Working Following
Error:
Code:
server.java:178: <identifier> expected
FollowHandler = new FollowHandler();
^
Re: [Fully Working Following
Quote:
server.java:178: <identifier> expected
FollowHandler = new FollowHandler();
^
That's because you don't have anything to name that new instance of it. do this.
[code]server.java:178: <identifier> expected
FollowHandler follower = new FollowHandler();
^[/quote]
Re: [Fully Working Following
Quote:
server.java:178: <identifier> expected
FollowHandler = new FollowHandler();
^
That's because you don't have anything to name that new instance of it. do this.
Code:
FollowHandler FollowHandler = new FollowHandler();
you're creating a new instance of the object, so you gotta name that instance for reference....I think... I'm self taught, so I don't know the lingo... I program better than I "know" it
Re: [Tut - A] [317] Fully Working Following
Does this no-clip following or it's clipped?
Re: [Tut - A] [317] Fully Working Following
how do i get the player.java and client.java?
Re: [Tut - A] [317] Fully Working Following
LEACHED motherfucker...
Quote:
Originally Posted by
007ruben
how do i get the player.java and client.java?
Open your server folder and type it in the search bar :thumbup1: