Methods
# destroyVector(vectorId)
Destroys a vector by its ID field.
Parameters:
Name | Type | Description |
---|---|---|
vectorId |
string | The ID of the vector as it appears in the editor. |
Example
rpgcode.destroyVector("some-vector-id");
# getBoard() → {Asset.BoardAsset}
Gets the current board, useful for accessing certain properties e.g.
name, description etc.
Current board object.
Example
var board = rpgcode.getBoard();
rpgcode.log(board);
# getBoardName() → {string}
Gets the current board's name and returns it.
Name of the current board.
string
Example
var boardName = rpgcode.getBoardName();
rpgcode.log(boardName);
# getTileData(tileX, tileY, layer) → {Board.TileData}
Gets the data associated with a tile on the board as set in the Editor's
Tileset properties.
Returns "null" if no data can be found.
Throws an exception if either the layer or tile is out-of-bounds.
Parameters:
Name | Type | Description |
---|---|---|
tileX |
number | |
tileY |
number | |
layer |
number |
"layer out of range" or "tile out of range"
An object containing the tile's properties.
Example
// Get the tile data at (10, 5, 1), and log the output
const tileData = rpgcode.getTileData(10, 5, 1);
rpgcode.log(tileData.type);
rpgcode.log(tileData.defence);
rpgcode.log(tileData.custom);
# removeTile(tileX, tileY, layer)
Removes the specified tile from the board.
Parameters:
Name | Type | Description |
---|---|---|
tileX |
number | The x position in tiles. |
tileY |
number | The y postion in tiles. |
layer |
number | The layer the tile is on. |
Example
// Removes the tile at (x: 11, y: 9, layer: 1).
rpgcode.removeTile(11, 9, 1);
# replaceTile(tileX, tileY, layer, tileSet, tileIndex)
Replaces a tile at the supplied (x, y, layer) position.
Parameters:
Name | Type | Description |
---|---|---|
tileX |
number | The x position in tiles. |
tileY |
number | The y postion in tiles. |
layer |
number | The layer the tile is on. |
tileSet |
string | The name of the TileSet of the replacement tile. |
tileIndex |
number | The index of the tile in the replacement TileSet. |
Example
// Places the tile at (x: 11, y: 10, layer: 0) with the 81st tile
// from the tileset "tileset1.tileset".
rpgcode.replaceTile(11, 10, 0, "tileset1.tileset", 81);
# sendToBoard(boardName, tileX, tileY, layer)
Sends the character to a board and places them at the given (x, y, [optional] layer) position in tiles.
Parameters:
Name | Type | Description |
---|---|---|
boardName |
string | The board to send the character to. |
tileX |
number | The x position to place the character at, in tiles. |
tileY |
number | The y position to place the character at, in tiles. |
layer |
number | [Optional] The layer to place the character on, defaults to the current layer otherwise. |
Example
// Use current character layer.
rpgcode.sendToBoard("Room1.board", 11.5, 18);
// Explictly state which layer.
rpgcode.sendToBoard("Room1.board", 11.5, 18, 1);