Jump to content

How do you get the player's co-ordinates?


Banjo

Recommended Posts

Simple question, related to my other thread but since nothing showed up in searches I thought it would be better to ask in a new one so others can find it for help if they want to do the same...

 

EDIT: SOLVED!

 

I figured it out, but for those who are wanting to know how, here's the code from Robomat's awesome Co-Ordinates Viewer mod...

 

        local absX = player:getX();
        local absY = player:getY();


        local cellX = absX / 300;
        local cellY = absY / 300;
        local locX = absX % 300;
        local locY = absY % 300;

 

absX and absY are "absolute" co-ordinates (where in the whole game world you are)

 

cellX, cellY, locX and locY are "relative" co-ordinates (current cell and location within it, as used in start spawns)

 

Edited by Banjo
Link to comment
Share on other sites

  • 4 weeks later...

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
×
×
  • Create New...