Jump to content

Getting a specific object (Lumby bank)


zs4yswtf

Recommended Posts

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. ^_^

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Not 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.
Link to comment
Share on other sites

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

 

Link to comment
Share on other sites


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);

}

}

  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...