Jump to content
Sykriss

Is there a function to get the tile type the player is on?

Recommended Posts

 

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.

Share this post


Link to post
Share on other sites

Ah sorry. Just got up :P

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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

easier way is:

getPlayer():getCurrentSquare(); -- single player only

or

getSpecificPlayer(player):getCurrentSquare(); -- for multiplayer and single player

where '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

Share this post


Link to post
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.

Loading...

×
×
  • Create New...