Thread: [PI] Stop Movement Timer

Results 1 to 3 of 3
  1. #1 [PI] Stop Movement Timer 
    Registered Member
    Join Date
    Aug 2013
    Posts
    134
    Thanks given
    25
    Thanks received
    2
    Rep Power
    19
    Hello, how would I add a timer that stops movement once you teleport to absX and absY.

    I currently have this:

    Code:
    public void stopMovement() {
            if(teleportToX <= 0 && teleportToY <= 0) {
                teleportToX = absX;
                teleportToY = absY;
            }
    		newWalkCmdSteps = 0;
            getNewWalkCmdX()[0] = getNewWalkCmdY()[0] = travelBackX[0] = travelBackY[0] = 0;
            getNextPlayerMovement();
        }
    But I want it to be where they can't move for just like 4-5 seconds in that area, then they can move.
    Reply With Quote  
     

  2. #2  
    Registered Member risgaard's Avatar
    Join Date
    Jul 2013
    Posts
    648
    Thanks given
    12
    Thanks received
    16
    Rep Power
    13
    try use walking.java.... and etc add something to playerfile like canwalk
    my grammar. aint pefect. but atleast you understand me

    did i help you ?
    i am not asking for rep but you can atleast say thanks
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Feb 2015
    Posts
    17
    Thanks given
    0
    Thanks received
    0
    Rep Power
    11
    or if you look in player.java where the stopmovement() void is.

    theres another void which you could use, along side with stopmovement()
    Code:
    clearUpdateFlags();
    This will stop movement until the current action has been completed.
    try it and it should work

    but if you want a timer above this
    Code:
    	public void stopMovement() {
    Add this:
    Code:
    	public long MovementTimer = 0;
    Below your public void stopmovement() {

    add this new Void which is the timer version of your original stopmovement()
    Code:
    	public void stopMovement(int Timer) {
    
    		if (teleportToX <= 0 && teleportToY <= 0) {
    			teleportToX = absX;
    			teleportToY = absY;
    		}
    	if (System.currentTimeMillis() - MovementTimer > Timer) {
    		newWalkCmdSteps = 0;
    		getNewWalkCmdX()[0] = getNewWalkCmdY()[0] = travelBackX[0] = travelBackY[0] = 0;
    		getNextPlayerMovement();
    		MovementTimer = System.currentTimeMillis();
    	}
    	}
    Then thats your timer Sorted

    Use it like: stopMovement(TIMER IN MILLISECONDS);
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. [PI] Stopping movement
    By Jordan Capozzi in forum Help
    Replies: 4
    Last Post: 03-16-2013, 07:13 PM
  2. [PI]Stop teleporting in combat
    By Richie in forum Snippets
    Replies: 18
    Last Post: 10-24-2012, 05:35 PM
  3. Replies: 2
    Last Post: 11-18-2010, 11:00 PM
  4. [PI] Stopping walking/following in a area?
    By Alexander in forum Help
    Replies: 3
    Last Post: 09-03-2010, 11:26 PM
  5. [PI] NPC Death Timer[PI]
    By PI Snippets in forum Snippets
    Replies: 5
    Last Post: 08-29-2010, 11:07 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •