furyan Posted January 27, 2017 Share Posted January 27, 2017 I was gazing at the documentation in search of a way to get the player's current sector, but was unable to find one. Is there already method available in the API? Something like Player():getCurrentSector()? Link to comment Share on other sites More sharing options...
Kane Hart Posted January 27, 2017 Share Posted January 27, 2017 Not sure if this works: http://stonelegion.com/Avorion/Documentation/Player%20Callbacks.html callback onSectorEntered(playerIndex, x, y) Link to comment Share on other sites More sharing options...
furyan Posted January 27, 2017 Author Share Posted January 27, 2017 Sorry I meant to say that this would be in the context of a server command. onSectorEntered doesn't apply there I don't think. Link to comment Share on other sites More sharing options...
Boxelware Team koonschi Posted January 27, 2017 Boxelware Team Share Posted January 27, 2017 Sector() is what you want. Link to comment Share on other sites More sharing options...
furyan Posted January 27, 2017 Author Share Posted January 27, 2017 I see now! I just realized the whole object context thing. So the Sector():getCoordinates() method should return the sector coordinates for the player who ran the command? Link to comment Share on other sites More sharing options...
Boxelware Team koonschi Posted January 27, 2017 Boxelware Team Share Posted January 27, 2017 Yup. Link to comment Share on other sites More sharing options...
furyan Posted January 27, 2017 Author Share Posted January 27, 2017 I really appreciate the help! For some reason when I assign Sector():getCoordinates() to a variable I get the error "attempt to index a nil value". Any idea why? I updated the gist here: https://gist.github.com/furyanPDX/1c4cb9956196c2994345fbc8f6136e81 Link to comment Share on other sites More sharing options...
furyan Posted January 27, 2017 Author Share Posted January 27, 2017 I figured out my issue. When pulling the coordinates from Sector():getCoordinates the values returned are exploded! example: local x, y = Sector():getCoordinates() I'll get the command updated! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now