Jump to content

Instances with unique coordinate values


Rudolph123

Recommended Posts

Does anyone have any suggestions for pathing and interacting within an instance where (x,y) coordinates are dynamic and change every time you enter the instance? 

Currently, since the instances done change only the (x,y) values I was going to create the initial path and interactions, then calculate the correct coordinates based on the players starting position in the instance. However, does anyone have any suggestions for alternative solutions, perhaps a solution that is already solved :)

Link to comment
Share on other sites

1 hour ago, Rudolph123 said:

Does anyone have any suggestions for pathing and interacting within an instance where (x,y) coordinates are dynamic and change every time you enter the instance? 

Currently, since the instances done change only the (x,y) values I was going to create the initial path and interactions, then calculate the correct coordinates based on the players starting position in the instance. However, does anyone have any suggestions for alternative solutions, perhaps a solution that is already solved :)

Find an object that will always be there and get its position
Then do some math to set the values of the area you need.

myTipJarSpace = getObjects().closest("Tip jar space");
        if (myTipJarSpace != null) {
          int larderAreaX1 = myTipJarSpace.getX() + 3;
          int larderAreaY1 = myTipJarSpace.getY();
          int larderAreaX2 = myTipJarSpace.getX() + 4;
          int larderAreaY2 = myTipJarSpace.getY() - 1;
          Area buildLarderArea = new Area(larderAreaX1, larderAreaY1, larderAreaX2, larderAreaY2).setPlane(myPosition().getZ());

I do this in a construction script to set the area I want my larder to be when building the kitchen because I have to rotate the room to get the larder where I want it to be.

 

Link to comment
Share on other sites

Generally you shouldn't really care about the exact positions or areas of objects, or at least i don't. The only time I did was Areas of banks. 
I rely more on the locations of Rs2Objects or Entitles instead since those objects can be easily interacted with using the api, and that is likely what you're going to do anyway. Your dynamic instance is still going to have common Rs2Objects/Entities right, why not use those to navigate instead?

Edited by yfoo
  • Like 1
Link to comment
Share on other sites

9 hours ago, yfoo said:

Generally you shouldn't really care about the exact positions or areas of objects, or at least i don't. The only time I did was Areas of banks. 
I rely more on the locations of Rs2Objects or Entitles instead since those objects can be easily interacted with using the api, and that is likely what you're going to do anyway. Your dynamic instance is still going to have common Rs2Objects/Entities right, why not use those to navigate instead?

 

12 hours ago, Alakazizam said:

Find an object that will always be there and get its position
Then do some math to set the values of the area you need.

myTipJarSpace = getObjects().closest("Tip jar space");
        if (myTipJarSpace != null) {
          int larderAreaX1 = myTipJarSpace.getX() + 3;
          int larderAreaY1 = myTipJarSpace.getY();
          int larderAreaX2 = myTipJarSpace.getX() + 4;
          int larderAreaY2 = myTipJarSpace.getY() - 1;
          Area buildLarderArea = new Area(larderAreaX1, larderAreaY1, larderAreaX2, larderAreaY2).setPlane(myPosition().getZ());

I do this in a construction script to set the area I want my larder to be when building the kitchen because I have to rotate the room to get the larder where I want it to be.

 


In the case of some instances, there are no objects/entities within render distance. Specifically in my case, the entrance to the instance is the only Rs2Oject within 50+ tiles in any direction. I'm not sure how close I need to be to the Rs2Object in order to interact with it. I suppose I can walk in a general direction of the nearest object I want to interact with until its populated in the script. I will try this, thanks for the input.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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