Sykriss Posted October 12, 2015 Share Posted October 12, 2015 Is there any way to get what type of tile is at specific xyz coordinates? Link to comment Share on other sites More sharing options...
RoboMat Posted October 12, 2015 Share Posted October 12, 2015 https://github.com/rm-code/Better-Shouts/blob/develop/RMBetterShouts/media/lua/client/bettershouts/Shouting.lua#L15 Get the player object and then simply call getX, getY and getZ on it Link to comment Share on other sites More sharing options...
Sykriss Posted October 12, 2015 Author Share Posted October 12, 2015 https://github.com/rm-code/Better-Shouts/blob/develop/RMBetterShouts/media/lua/client/bettershouts/Shouting.lua#L15Get the player object and then simply call getX, getY and getZ on it That gives the coordinates (which solves one problem), but doesn't tell me what kind of tile (grass, dirt, asphalt, etc) is at those coordinates - which is essential to the functionality of the mod I plan on making using this method. Link to comment Share on other sites More sharing options...
RoboMat Posted October 12, 2015 Share Posted October 12, 2015 Ah sorry. Just got up Check the javadocs. The IsoCharacter should have a getter for the tile it is standing on. Probably something like getTile() or getSquare() and from there you can access the tile object and get its name / type. Link to comment Share on other sites More sharing options...
ethanwdp Posted October 12, 2015 Share Posted October 12, 2015 function ayyLmao() local wz = getPlayer():getZ(); local wx, wy = ISCoordConversion.ToWorld(getPlayer():getX(), getPlayer():getY(), wz); wx = math.floor(wx); wy = math.floor(wy); local cell = getWorld():getCell(); local sq = cell:getGridSquare(wx, wy, wz); local sqObjs = sq:getObjects(); local sqSize = sqObjs:size(); for i = sqSize-1, 0, -1 do local obj = sqObjs:get(i); print(obj:getSprite():getName()) endend Something like this? Link to comment Share on other sites More sharing options...
MisterInSayne Posted October 13, 2015 Share Posted October 13, 2015 easier way is:getPlayer():getCurrentSquare(); -- single player onlyorgetSpecificPlayer(player):getCurrentSquare(); -- for multiplayer and single playerwhere 'player' is the number provided it most cases. with using ethanwdp's example you get:function ayyLmao(player) local sq = getSpecificPlayer(player):getCurrentSquare(); for i=0, sq:getObjects():size()-1 do local obj = sq:getObjects():get(i); print(obj:getSprite():getName()) endend Link to comment Share on other sites More sharing options...
jeph300 Posted January 16 Share Posted January 16 How to extend that to get all tile of the house the player is in, all level? 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