Thread: Clipped following almost working

Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1. #1 Clipped following almost working 
    Registered Member
    Division's Avatar
    Join Date
    Dec 2009
    Age
    29
    Posts
    2,208
    Thanks given
    41
    Thanks received
    78
    Rep Power
    97
    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?
    Reply With Quote  
     

  2. #2  
    Registered Member
    Teemuzz's Avatar
    Join Date
    Oct 2009
    Posts
    2,755
    Thanks given
    1,212
    Thanks received
    422
    Rep Power
    934
    add an event wich starts to follow the player
    Reply With Quote  
     

  3. #3  
    Registered Member
    Division's Avatar
    Join Date
    Dec 2009
    Age
    29
    Posts
    2,208
    Thanks given
    41
    Thanks received
    78
    Rep Power
    97
    could you explain more how to do and where to add?
    Reply With Quote  
     

  4. #4  
    Registered Member
    Xynth's Avatar
    Join Date
    May 2009
    Posts
    2,222
    Thanks given
    226
    Thanks received
    259
    Rep Power
    1155
    Try processing it.
    Attached image
    Reply With Quote  
     

  5. #5  
    Registered Member
    Division's Avatar
    Join Date
    Dec 2009
    Age
    29
    Posts
    2,208
    Thanks given
    41
    Thanks received
    78
    Rep Power
    97
    And how would i do that? Yes im a noob...
    Reply With Quote  
     

  6. #6  
    Registered Member
    Arizona's Avatar
    Join Date
    May 2009
    Age
    29
    Posts
    275
    Thanks given
    11
    Thanks received
    12
    Rep Power
    113
    You'd be a noob to "process it", you should "event it"
    TRUETECH LOL:
    Spoiler for Rofl:
    Reply With Quote  
     

  7. #7  
    Registered Member
    Division's Avatar
    Join Date
    Dec 2009
    Age
    29
    Posts
    2,208
    Thanks given
    41
    Thanks received
    78
    Rep Power
    97
    Ok so i event it, how would i do that?
    Reply With Quote  
     

  8. #8  
    Registered Member
    Division's Avatar
    Join Date
    Dec 2009
    Age
    29
    Posts
    2,208
    Thanks given
    41
    Thanks received
    78
    Rep Power
    97
    anyone?
    Reply With Quote  
     

  9. #9  
    Registered Member

    Join Date
    Feb 2009
    Age
    27
    Posts
    2,861
    Thanks given
    127
    Thanks received
    226
    Rep Power
    700
    Use an event manager.
    Reply With Quote  
     

  10. #10  
    Registered Member
    Division's Avatar
    Join Date
    Dec 2009
    Age
    29
    Posts
    2,208
    Thanks given
    41
    Thanks received
    78
    Rep Power
    97
    But how i make this work? Isnt there just a code for or something?
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •