Jump to content

how to make an area in the middle of objects


alkku15

Recommended Posts

It's an instance, which gets loaded in a random "instance slot" in the instance space; hence the changing coordinates.

What you CAN do is create the area by looking at the 'Local coordinates' of the region that the instance is loaded in. Local coordinates are coordinates relative to the region base (the lower left corner of the currently loaded region). Even though the instance is loaded in different places, the local coordinates of objects, npcs and positions will be the same every time. At least until you wander far enough to trigger a new region load.

So upon entering the instance you could make the Area with something like:

Position southWestCorner = new Position(50, 50, 0).translate(getMap().getBaseX(), getMap().getBaseY());
Position northEastCorner = new Position(100, 100, 0).translate(getMap().getBaseX(), getMap().getBaseY());
Area fightArea = new Area(southWestCorner, northEastCorner);

assuming the Area spans from x:50, y:50 to x:100, y:100 in the local region

  • Like 2
Link to comment
Share on other sites

26 minutes ago, FrostBug said:

It's an instance, which gets loaded in a random "instance slot" in the instance space; hence the changing coordinates.

What you CAN do is create the area by looking at the 'Local coordinates' of the region that the instance is loaded in. Local coordinates are coordinates relative to the region base (the lower left corner of the currently loaded region). Even though the instance is loaded in different places, the local coordinates of objects, npcs and positions will be the same every time. At least until you wander far enough to trigger a new region load.

So upon entering the instance you could make the Area with something like:


Position southWestCorner = new Position(50, 50, 0).translate(getMap().getBaseX(), getMap().getBaseY());
Position northEastCorner = new Position(100, 100, 0).translate(getMap().getBaseX(), getMap().getBaseY());
Area fightArea = new Area(southWestCorner, northEastCorner);

assuming the Area spans from x:50, y:50 to x:100, y:100 in the local region

yes exactly what i was looking for thank you very much!

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