TLChangeAreaGroundTiles(object, int, int, int, float)
Changes the tiles of an entire area.
void TLChangeAreaGroundTiles( object oArea, int nGroundTileConst, int nColumns, int nRows, float fZOffset = -0.4f );
Parameters
oArea
Area to change the tiles of
nGroundTileConst
nColumns
Columns in the area
nRows
Rows in the area
fZOffset
Z-axis coordinate for the tile magic. (Default: -0.4f)
Description
Change the type of the ground or (by default) sub ground tiles (i.e. water) to the specified type.
Remarks
This function will flood the entire area with the tile in question. nColumns and nRows indicate the size of the area. For instance, a 4 * 6 area will have 4 columns and 6 rows.
You may not want to flood your entire area, but this function will give you a pretty good idea how to use the tile magic (tm). Basically, you just create an invisible object in the center of a tile, and apply a permanent visual effect to that invisible object.
Requirements
#include "x2_inc_toollib"
Version
1.61
Example
// Create a Small (4x4) Rural or City Exterior area, place the Start Location // in the area and add this script to the area's OnEnter event. When the first // player (or creature) enters the area the TileMagic effect will be created. // This script will actually work from any object event except the module events. #include "x2_inc_toollib" void main() { object oArea = GetArea(OBJECT_SELF); // We only want to apply tilemagic if it does not already exist. if(GetLocalInt(oArea, "TILEMAGIC_APPLIED") == FALSE) { // Cover a 3x3 square with knee-high water: the square starts in the // area's bottom left corner and extends x columns right and y rows up. // NOTE: the water tile has a built in z-offset of -1m, so to make it // it knee-high for a human (about 0.5m) we have to raise it by 1.5m. TLChangeAreaGroundTiles(oArea, X2_TL_GROUNDTILE_WATER, 3, 3, 1.5); // Set a variable to indicate the tilemagic exists. SetLocalInt(oArea, "TILEMAGIC_APPLIED", TRUE); } }
See Also
functions: | TLChangeAreaGroundTilesEx | TLResetAreaGroundTiles | TLResetAreaGroundTilesEx |
categories: | Area Functions | Visual Effects Functions |
constants: | X2_TL_GROUNDTILE_* Constants |
tutorials: | An Introduction To TileMagic |
author: Lilac Soul, editors: Mistress, Sunjammer, Axe Murderer