Skip to content

Metatable:Tile

Stefan A. Brannfjell edited this page Oct 25, 2020 · 7 revisions

A tile is a map square in the server. It holds information such as tile type, house association, ground type, items and creatures.

A Position object can be used to grab a specific tile in the server.

local tile = Tile(player:getPosition())

Available methods:

getBottomCreature()
getBottomVisibleCreature(creature)
getCreatureCount()
getCreatures()
getDownItemCount()
getFieldItem()
getGround()
getHouse()
getItemById(itemId, subType = -1)
getItemByTopOrder(topOrder)
getItemByType(itemType)
getItemCount()
getItemCountById(itemId, subType = -1)
getItems()
getPosition()
getThing(index)
getThingCount()
getThingIndex(thing)
getTopCreature()
getTopDownItem()
getTopItemCount()
getTopTopItem()
getTopVisibleCreature(creature)
getTopVisibleThing(creature)
hasFlag(flag)
hasProperty(property, item)
isCreature()
isItem()
isTile()
queryAdd(thing, flags)
remove()


getBottomCreature()

Description: N/A
Parameters: None
Returns: N/A
Example:

local tile = Tile(...)
tile:getBottomCreature()

[To the top] Added in version: 1.0


getBottomVisibleCreature(creature)

Description: N/A
Parameters:

  • creature - No description
Returns: N/A
Example:
local tile = Tile(...)
tile:getBottomVisibleCreature(some_userdata)

[To the top] Added in version: 1.0


getCreatureCount()

Description: N/A
Parameters: None
Returns: N/A
Example:

local tile = Tile(...)
tile:getCreatureCount()

[To the top] Added in version: 1.0


getCreatures()

Description: N/A
Parameters: None
Returns: N/A
Example:

local tile = Tile(...)
tile:getCreatures()

[To the top] Added in version: 1.0


getDownItemCount()

Description: N/A
Parameters: None
Returns: N/A
Example:

local tile = Tile(...)
tile:getDownItemCount()

[To the top] Added in version: 1.0


getFieldItem()

Description: N/A
Parameters: None
Returns: N/A
Example:

local tile = Tile(...)
tile:getFieldItem()

[To the top] Added in version: 1.0


getGround()

Description: N/A
Parameters: None
Returns: N/A
Example:

local tile = Tile(...)
tile:getGround()

[To the top] Added in version: 1.0


getHouse()

Description: N/A
Parameters: None
Returns: N/A
Example:

local tile = Tile(...)
tile:getHouse()

[To the top] Added in version: 1.0


getItemById(itemId[, subType = -1])

Description: N/A
Parameters:

  • itemId - No description
  • subType - (optional, default: -1)
Returns: N/A
Example:
local tile = Tile(...)
tile:getItemById(2400, -1)

[To the top] Added in version: 1.0


getItemByTopOrder(topOrder)

Description: N/A
Parameters:

  • topOrder - No description
Returns: N/A
Example:
local tile = Tile(...)
tile:getItemByTopOrder(unknown)

[To the top] Added in version: 1.0


getItemByType(itemType)

Description: N/A
Parameters:

  • itemType - No description
Returns: N/A
Example:
local tile = Tile(...)
tile:getItemByType(ITEM_TYPE_TELEPORT)

[To the top] Added in version: 1.0


getItemCount()

Description: N/A
Parameters: None
Returns: N/A
Example:

local tile = Tile(...)
tile:getItemCount()

[To the top] Added in version: 1.0


getItemCountById(itemId[, subType = -1])

Description: N/A
Parameters:

  • itemId - No description
  • subType - (optional, default: -1)
Returns: N/A
Example:
local tile = Tile(...)
tile:getItemCountById(2400, -1)

[To the top] Added in version: 1.0


getItems()

Description: N/A
Parameters: None
Returns: N/A
Example:

local tile = Tile(...)
tile:getItems()

[To the top] Added in version: 1.0


getPosition()

Description: N/A
Parameters: None
Returns: N/A
Example:

local tile = Tile(...)
tile:getPosition()

[To the top] Added in version: 1.0


getThing(index)

Description: N/A
Parameters:

  • index - No description
Returns: N/A
Example:
local tile = Tile(...)
tile:getThing(some_id)

[To the top] Added in version: 1.0


getThingCount()

Description: N/A
Parameters: None
Returns: N/A
Example:

local tile = Tile(...)
tile:getThingCount()

[To the top] Added in version: 1.0


getThingIndex(thing)

Description: N/A
Parameters:

  • thing - No description
Returns: N/A
Example:
local tile = Tile(...)
tile:getThingIndex(userdata_or_id)

[To the top] Added in version: 1.0


getTopCreature()

Description: N/A
Parameters: None
Returns: N/A
Example:

local tile = Tile(...)
tile:getTopCreature()

[To the top] Added in version: 1.0


getTopDownItem()

Description: N/A
Parameters: None
Returns: N/A
Example:

local tile = Tile(...)
tile:getTopDownItem()

[To the top] Added in version: 1.0


getTopItemCount()

Description: N/A
Parameters: None
Returns: N/A
Example:

local tile = Tile(...)
tile:getTopItemCount()

[To the top] Added in version: 1.0


getTopTopItem()

Description: N/A
Parameters: None
Returns: N/A
Example:

local tile = Tile(...)
tile:getTopTopItem()

[To the top] Added in version: 1.0


getTopVisibleCreature(creature)

Description: N/A
Parameters:

  • creature - No description
Returns: N/A
Example:
local tile = Tile(...)
tile:getTopVisibleCreature(some_userdata)

[To the top] Added in version: 1.0


getTopVisibleThing(creature)

Description: N/A
Parameters:

  • creature - No description
Returns: N/A
Example:
local tile = Tile(...)
tile:getTopVisibleThing(some_userdata)

[To the top] Added in version: 1.0


hasFlag(flag)

Description: N/A
Parameters:

  • flag - No description
Returns: N/A
Example:
local tile = Tile(...)
tile:hasFlag(unknown)

[To the top] Added in version: 1.0


hasProperty(property[, item])

Description: N/A
Parameters:

  • property - No description
  • item - (optional)
Returns: N/A
Example:
local tile = Tile(...)
tile:hasProperty(unknown, nil)

[To the top] Added in version: 1.0


isCreature()

Description: N/A
Parameters: None
Returns: false
Example:

local tile = Tile(...)
tile:isCreature()

[To the top] Added in version: 1.1


isItem()

Description: N/A
Parameters: None
Returns: false
Example:

local tile = Tile(...)
tile:isItem()

[To the top] Added in version: 1.1


isTile()

Description: N/A
Parameters: None
Returns: true
Example:

local tile = Tile(...)
tile:isTile()

[To the top] Added in version: 1.1


queryAdd(thing[, flags])

Description: N/A
Parameters:

  • thing - No description
  • flags - (optional)
Returns: N/A
Example:
local tile = Tile(...)
tile:queryAdd(userdata_or_id, nil)

[To the top] Added in version: 1.0


remove()

Description: Remove a tile, ground, items and creatures in that tile. (Except players, which are being teleported to temple position)
Parameters: None
Returns: nil if tile doesn't exist, otherwise true.
Example:

local tile = Tile(...)
tile:remove()

[To the top] Added in version: 1.4 #2952

Clone this wiki locally