zs4yswtf Posted August 6, 2014 Posted August 6, 2014 Is there a way to get an object that has the same ID as another? For example, in the lumbridge bank, there are two staircases. They have the same object ID, so what would be the way to get the one that was farther away?
Mysteryy Posted August 7, 2014 Posted August 7, 2014 Is there a way to get an object that has the same ID as another? For example, in the lumbridge bank, there are two staircases. They have the same object ID, so what would be the way to get the one that was farther away? You could use an area. Get the object that is inside of the correct area, and then use that object. Also, dont use object ids unless you are automatically grabbing the ids each time the script runs. Otherwise you will need to update your script each time the object ids change, which is sometimes weekly. ^_^
zs4yswtf Posted August 7, 2014 Author Posted August 7, 2014 Thank you for the response! And I don't use IDs too often, but I was giving it a try this time. Anyways, I am trying an area now, and it seems to be a better solution what I was going to try and conjure up ^_^.
Swizzbeat Posted August 7, 2014 Posted August 7, 2014 the one that was farther away? You literally answered your own question.
Anaesthetic Posted August 7, 2014 Posted August 7, 2014 Is there a way to get an object that has the same ID as another? For example, in the lumbridge bank, there are two staircases. They have the same object ID, so what would be the way to get the one that was farther away? I wouldn't reccomend using IDs in your scripts as you will need to update them everytime RS updates (bleh). You can save the objects and then filter them to find the one you want
Swizzbeat Posted August 7, 2014 Posted August 7, 2014 I wouldn't reccomend using IDs in your scripts as you will need to update them everytime RS updates (bleh). You can save the objects and then filter them to find the one you wantNot necessarily, item/npc ID's hardly (if ever) change. The only things that switch up a lot are ID's for randoms and things that allow passage like doors and gates.
Apaec Posted August 7, 2014 Posted August 7, 2014 Well for staircases remember that they have a different z value the bottom staircase is most likely z = 0 when u climb up it the z = 1 and on the top floor the z = 2 Entity ladder = this.objects.closest("Stairs"); if (ladder != null && ladder.getZ() == 1) { //climb } ^basic idea of what im trying to say Also you can use this system to check whether you've climbed up the stairs eg: boolean climbedUpFirstSetOfStairs; if (this.myPlayer().getZ() == 1) { climbedUpFirstSetOfStairs = true; } ^ for example. Even if flags are messy / unideal, they do the job. Hope I helped! -apaec
FrostBug Posted August 7, 2014 Posted August 7, 2014 public class PositionFilter<E extends Entity> implements Filter<E>{ private final Position pos; private final String name; public PositionFilter(Position pos, String name) { this.pos = pos; this.name = name; } @Override public boolean match(E e) { return e.getPosition().equals(pos) && e.getName().equalsIgnoreCase(name); } } 1