Thread: Gate closing

Results 1 to 8 of 8
  1. #1 Gate closing 
    Registered Member

    Join Date
    Mar 2011
    Age
    27
    Posts
    555
    Thanks given
    168
    Thanks received
    190
    Rep Power
    0
    Tryna figure out how i gonna be able to close gates & bigger doors after opening, but i need a way to check orginalX & Y on the object so it goes back to the correct location

    Im able to make it so you can close the gate/door from 1 position but if the door was opening to the right etc, i have no idea how to check if its right or left from the orginal position if that make sense

    any1 able to do it?

    Attached image

    Basically

    if (object.getX() < originalObject.getX())
    object.moveLocation(1,0,0);
    else if (object.getX() > originalObject.getX())
    object.moveLocation(-1,0,0);
    else if (object.getY() < originalObject.getY())
    object.moveLocation(0,1,0);
    else if (object.getY() > originalObject.getY())
    object.moveLocation(0,-1,0);
    Avalon Developer
    Reply With Quote  
     

  2. #2  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    The direction the doors open is solely dependent on object rotation. Find four unique "gates" in OSRS - you'll see they all follow this rule. Both the doors on your gif will have the same object rotation value.
    Attached image
    Reply With Quote  
     

  3. #3  
    Registered Member

    Join Date
    Mar 2011
    Age
    27
    Posts
    555
    Thanks given
    168
    Thanks received
    190
    Rep Power
    0
    Quote Originally Posted by Kris View Post
    The direction the doors open is solely dependent on object rotation. Find four unique "gates" in OSRS - you'll see they all follow this rule. Both the doors on your gif will have the same object rotation value.
    Can't make any of the doors to other rotation & x because then wall dissapears next to it
    so it is the correct location & rotation, but when i need to check if the gate went to the right or the left to see what way the door should be closing i cant do that
    Avalon Developer
    Reply With Quote  
     

  4. #4  
    Registered Member Fer's Avatar
    Join Date
    Nov 2015
    Posts
    33
    Thanks given
    53
    Thanks received
    11
    Rep Power
    27
    Quote Originally Posted by -Andreas View Post
    Can't make any of the doors to other rotation & x because then wall dissapears next to it
    so it is the correct location & rotation, but when i need to check if the gate went to the right or the left to see what way the door should be closing i cant do that
    If you programmed the doors separately, wouldn't it be possible to check if for example player.getX() is smaller/larger than object.getX()?
    This wouldn't work if you made all doors work dynamically with 1 piece of code. Because you may want to use Y for some doors.
    There are ways though but I'm not sure if I understand your issue correctly
    Attached image Attached image
    Reply With Quote  
     

  5. #5  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    Quote Originally Posted by -Andreas View Post
    Can't make any of the doors to other rotation & x because then wall dissapears next to it
    so it is the correct location & rotation, but when i need to check if the gate went to the right or the left to see what way the door should be closing i cant do that
    You're not meant to only change the direction, but also the location.
    Don't forget to keep track of the original locations, and rotations. The offsets for the doors are as follows.. Make of it as you will.
    Code:
    	/**
    	 * An array based on the original object rotation.
    	 * First index = original object rotation,
    	 * Second index array contains two arrays for left and right door respectively.
    	 * In the arrays, you have x offset, y offset and new rotation for the door.
    	 */
    	public static final byte[][][] OFFSETS = new byte[][][] {
    		new byte[][] {//rotation 0 doors.
    			new byte[] { -1/** x offset */, 0/** y offset */, 1/** new rotation of the door */ },//left door
    			new byte[] { -1, 0, 3 }
    		}, 
    		new byte[][] {
    			new byte[] { 0, 1, 2 },
    			new byte[] { 0, 1, 0 }
    		}, 
    		new byte[][] {
    			new byte[] { 1, 0, 3 },
    			new byte[] { 1, 0, 1 }
    		},
    		new byte[][] {
    			new byte[] { 0, -1, 0},
    			new byte[] { 0, -1, 2 },
    		}
    	};
    Determining which door is left, and which is right should be easy enough. That's all the help I'll provide.
    Attached image
    Reply With Quote  
     

  6. #6  
    Gate closing



    Scu11's Avatar
    Join Date
    Aug 2007
    Age
    30
    Posts
    16,307
    Thanks given
    7,215
    Thanks received
    12,308
    Rep Power
    5000
    Quote Originally Posted by Kris View Post
    Don't forget to keep track of the original locations, and rotations.
    you don't need to, you know the transformation for a closed door is the opposite of the transformation for an open one

    Attached image
    Reply With Quote  
     

  7. #7  
    Registered Member

    Join Date
    Mar 2011
    Age
    27
    Posts
    555
    Thanks given
    168
    Thanks received
    190
    Rep Power
    0
    Quote Originally Posted by Scu11 View Post
    you don't need to, you know the transformation for a closed door is the opposite of the transformation for an open one
    I don't think anyone really knows what i mean

    If i open the western door in falador castle it turns, southern part of the door rotation 3 && x -= 1, 2nd part turns rotation 1 && x -=1;
    If i open the eastern door in falador castle it turns, southern part of the door rotation 3 && x += 1, 2nd part turns rotation 1 && x -=1;

    now.. when i want to close it, i click close on eastern part i know the first part should go back to rotation 0 && x -= 1, but what i wanna close the western door? how do i check if that door is x-= 1 from the original location
    Avalon Developer
    Reply With Quote  
     

  8. #8  
    Gate closing



    Scu11's Avatar
    Join Date
    Aug 2007
    Age
    30
    Posts
    16,307
    Thanks given
    7,215
    Thanks received
    12,308
    Rep Power
    5000
    Quote Originally Posted by -Andreas View Post
    now.. when i want to close it, i click close on eastern part i know the first part should go back to rotation 0 && x -= 1, but what i wanna close the western door? how do i check if that door is x-= 1 from the original location
    the id determines it's operation, you should group double doors as such:

    Code:
      {
        "left": {
          "closed": 1596,
          "opened": 1560
        },
        "right": {
          "closed": 1597,
          "opened": 1561
        }
      }
    from this i know if you click 1596 then there must be an accompanying 1597 (i can figure out where it should be based on the position & orientation of the 1596 you clicked)

    Attached image
    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. Door/Gate Dump open:closed
    By arrowzftw in forum Configuration
    Replies: 9
    Last Post: 10-26-2012, 06:51 PM
  2. Massive Closing
    By Guthan in forum RS2 Server
    Replies: 6
    Last Post: 11-11-2007, 04:38 AM
  3. Closed.
    By Called Enzo in forum Downloads
    Replies: 19
    Last Post: 10-21-2007, 01:49 PM
  4. Replies: 8
    Last Post: 09-23-2007, 04:50 PM
  5. Packet 130 - Close Window
    By Runite in forum Tutorials
    Replies: 15
    Last Post: 08-23-2007, 04:23 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
  •