Jump to content

how to make an area in the middle of objects


Recommended Posts

Posted

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
Posted
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!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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