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.
|
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?
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);
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.
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
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.
Determining which door is left, and which is right should be easy enough. That's all the help I'll provide.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 }, } };
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
the id determines it's operation, you should group double doors as such:
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)Code:{ "left": { "closed": 1596, "opened": 1560 }, "right": { "closed": 1597, "opened": 1561 } }
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |