Thread: 718 check tile do something

Results 1 to 9 of 9
  1. #1 718 check tile do something 
    Registered Member
    Join Date
    Apr 2012
    Posts
    853
    Thanks given
    94
    Thanks received
    33
    Rep Power
    0
    how to make it so if your on a particular x and y tile + 3 tiles around the player then it does something for 5secs and then stop? or if the player runs away from the tile then also it would stop?
     

  2. #2  
    Success is the worst teacher

    Santa Hat's Avatar
    Join Date
    Oct 2012
    Age
    27
    Posts
    3,334
    Thanks given
    807
    Thanks received
    1,185
    Rep Power
    190
    if (player.getX() == x coords && player.getY() == Y coords && player.getPlane() == plane) {
    //do something
    }
     

  3. Thankful user:


  4. #3  
    Registered Member
    Join Date
    Apr 2012
    Posts
    853
    Thanks given
    94
    Thanks received
    33
    Rep Power
    0
    Quote Originally Posted by Santa Hat View Post
    if (player.getX() == x coords && player.getY() == Y coords && player.getPlane() == plane) {
    //do something
    }
    ty but hw to make it constantly do the same thing until the player is no longer in that coords? and also a time limit so for example after 5 secs being in those coords, it will stop doing something OR if a player leaves those coords then also it will stop doing something
     

  5. #4  
    Registered Member
    Mylyn's Avatar
    Join Date
    Dec 2012
    Posts
    1,536
    Thanks given
    602
    Thanks received
    278
    Rep Power
    119
    Find the tick processing method and add the check there.
     

  6. #5  
    Registered Member
    Join Date
    Apr 2012
    Posts
    853
    Thanks given
    94
    Thanks received
    33
    Rep Power
    0
    Quote Originally Posted by syopy son View Post
    Find the tick processing method and add the check there.
    did but its only doing it on a single tile and no checks if a player is at the area or not
     

  7. #6  
    Registered Member
    Mylyn's Avatar
    Join Date
    Dec 2012
    Posts
    1,536
    Thanks given
    602
    Thanks received
    278
    Rep Power
    119
    Quote Originally Posted by helpMe View Post
    did but its only doing it on a single tile and no checks if a player is at the area or not
    I might just be stupid but I didn't understand what you meant right there.
     

  8. #7  
    Registered Member
    Join Date
    Apr 2012
    Posts
    853
    Thanks given
    94
    Thanks received
    33
    Rep Power
    0
    Quote Originally Posted by syopy son View Post
    I might just be stupid but I didn't understand what you meant right there.
    hmm here i will try to explain

    I want to make it so where the player, to check if the player is at that tile and to +3 to x and y coords of the starting point of the player, and if the player is in that area coords then the server will do something, but if not then it will stop doing something and if a new player enters those coords then it will do that something. i too want it to last for a short time limit like 7secs?

    in short, i want to make it check if the player is in those x, y's , then

    //do something,

    if the player has left the x, y's coords then stop what the server is doing

    and if the player re-enters the same x'y's coords then again it will
    //do something

    But the x and y checks should be stopped after 7sec, so that after 7secs if a player goes to that coords,, it won't do anything
     

  9. #8  
    Registered Member
    Mylyn's Avatar
    Join Date
    Dec 2012
    Posts
    1,536
    Thanks given
    602
    Thanks received
    278
    Rep Power
    119
    Quote Originally Posted by helpMe View Post
    hmm here i will try to explain

    I want to make it so where the player, to check if the player is at that tile and to +3 to x and y coords of the starting point of the player, and if the player is in that area coords then the server will do something, but if not then it will stop doing something and if a new player enters those coords then it will do that something. i too want it to last for a short time limit like 7secs?

    in short, i want to make it check if the player is in those x, y's , then

    //do something,

    if the player has left the x, y's coords then stop what the server is doing

    and if the player re-enters the same x'y's coords then again it will
    //do something

    But the x and y checks should be stopped after 7sec, so that after 7secs if a player goes to that coords,, it won't do anything
    Well, you could create some kind of a variable like an int or something, lets say "public int number = 0;"

    Then, in the tick processing method, add the region check, and if number (the variable) has a value over 0, it will be decreased by 1 each tick, and if the value is over 0, the actions will be processed.
    However, if the player is in the area, but the value of the variable "number" is 0, it will be set to (for example) 10. This means the actions would be processed for 10 ticks. You could also add a check to make sure,
    that if the person is not standing in the area, the variable would be set to 0.
    You should also create some kind of a check to make sure if the variable was just decreased from 1 to 0, so it wont go straight up to 10 again and keep doing stuff all over again.
     

  10. #9  
    Registered Member
    Join Date
    Apr 2012
    Posts
    853
    Thanks given
    94
    Thanks received
    33
    Rep Power
    0
    nvm just noticed tht it requires me to make it final and i cant make my current variable final... ty for help tho
     


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. 718 stop doing something
    By helpMe in forum Help
    Replies: 8
    Last Post: 06-02-2013, 07:43 AM
  2. 718 stop doing something
    By helpMe in forum Help
    Replies: 19
    Last Post: 05-30-2013, 12:28 AM
  3. Doing something for $1 paypal.
    By Dawgg in forum Chat
    Replies: 0
    Last Post: 01-27-2008, 08:52 PM
  4. Replies: 8
    Last Post: 11-23-2007, 01:51 AM
  5. Make an object do something
    By delta11 in forum Tutorials
    Replies: 4
    Last Post: 10-21-2007, 05:56 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
  •