Tile


A tile is the primary building block of a map in RPG in a Box. Tiles are typically used to construct the ground, buildings, and other structures/architecture, and can be independently placed at any XYZ coordinate within the map. A tile's coordinate is unique among other tiles in the same map, as only one tile is permitted per XYZ coordinate. As the player character and NPCs move around the map, any tiles they step onto will act as terrain and determine the vertical positioning of the characters.

Scripting

Refer to the table below for a list of tile properties that can be accessed from a script. If the property's value can be changed using an assignment statement, it will be noted in the description.

PropertyDescription
<tile>.idEntity ID of the tile, as set in the Map Editor from the Entity Properties panel. This can be used to either retrieve or change the ID of the tile.
<tile>.typeType of entity, in this case the constant value TILE.
<tile>.coordCoordinate of the tile.
<tile>.directionCardinal direction (NORTH, SOUTH, WEST, EAST) in which the tile is rotated. The default direction of an entity is SOUTH.
<tile>.objectsAn array of objects currently occupying the tile, or null if there are none.
<tile>.charactersAn array of characters currently occupying the tile, or null if there are none.
<tile>.itemsAn array of items currently occupying the tile, or null if there are none (e.g. those dropped out of the player's inventory or placed via the Add Item To Tile function).
<tile>.groupsAn array of groups to which the tile is assigned. The array will be empty if the tile is not assigned to any groups.
<tile>.tagsAn array of tags (as strings) for the tile, as set in the Voxel Editor from the Model Properties panel.
<tile>.interact_cursorInteraction cursor for the tile, as set in the Map Editor from the Entity Properties panel. This can be used to either retrieve or change the interaction cursor for the tile. Valid values include “default”, “walk”, “interact”, “speak”, “attack”, or any custom cursor defined in your game configuration.
<tile>.property[“x”]Custom property stored on the tile, where “x” is a string containing the name of the property. This can be used to either retrieve or change the property's value.
<tile>.modelName of the tile's model (e.g. “grass”).
<tile>.frameCurrent animation frame (as a number, with the first frame being 1). This can be used to either retrieve or change the model's current frame. If this property is changed and an animation is playing, the animation will first be stopped.
<tile>.animationName of the animation currently playing for this tile (as a string). Value will be null if no animation is playing.
<tile>.animationsAn array of animation names defined for this tile. The names will be string values.
<tile>.attach_pointsAn array of attach point names defined for this tile (across all animation frames). The names will be string values. The array will be empty if no attach points are defined.
<tile>.attachment[“x”]Object attached to the tile, where “x” is the attach point ID.
<tile>.effect[“x”]Effect attached to the tile, where “x” is the attach point ID.
<tile>.texturesAn array of texture names defined for this tile. The names will be string values.
<tile>.terrain_typeTerrain type assigned to the tile (as a string, or null if none is assigned).
<tile>.waypointsAn array of waypoint names defined for this tile. This property will be null if the tile is not currently configured as a moving platform.
<tile>.north_tileTile to the north of this tile (if one is connected via navigation, otherwise null is returned).
<tile>.south_tileTile to the south of this tile (if one is connected via navigation, otherwise null is returned).
<tile>.west_tileTile to the west of this tile (if one is connected via navigation, otherwise null is returned).
<tile>.east_tileTile to the east of this tile (if one is connected via navigation, otherwise null is returned).