NWNX:EE  8193.36.12
Tileset

Readme

This plugin allows the builder to override the tiles of areas created with CreateArea(). It also exposes various properties from tileset .set files.

Notes

This is a pretty advanced plugin, the builder should be familiar with .set files and the tiles part of the area file format. See: Bioware_Aurora_AreaFile_Format.pdf on the Neverwinter Vault Modding Wiki.

Simple Example

Please create a small area with myarea as resref as prerequisite. The tileset and size doesn't matter as we'll be overriding them. You can set any other area settings though.

#include "nwnx_tileset"
// A wrapper around NWNX_Tileset_SetCustomTileData()
void SetTileData(string sOverrideName, int nTileIndex, int nTileID, int nTileOrientation)
{
ctd.nOrientation = nTileOrientation;
ctd.nHeight = 0;
ctd.nMainLightColor1 = TILE_MAIN_LIGHT_COLOR_BRIGHT_WHITE;
ctd.nMainLightColor2 = TILE_MAIN_LIGHT_COLOR_BRIGHT_WHITE;
ctd.nSourceLightColor1 = TILE_SOURCE_LIGHT_COLOR_PALE_YELLOW;
ctd.nSourceLightColor2 = TILE_SOURCE_LIGHT_COLOR_PALE_YELLOW;
ctd.bAnimLoop1 = TRUE;
ctd.bAnimLoop2 = TRUE;
ctd.bAnimLoop3 = TRUE;
NWNX_Tileset_SetOverrideTileData(sOverrideName, nTileIndex, ctd);
}
void main()
{
string sOverrideName = "MyTileOverride";
string sTileset = TILESET_RESREF_RURAL;
int nWidth = 3, nHeight = 3;
// We're creating an override that is a 3x3 area using the rural tileset.
NWNX_Tileset_CreateTileOverride(sOverrideName, sTileset, nWidth, nHeight);
// Tiles are stored in an array where 0 is the bottom left tile.
// A 3x3 area would have the following indexes for the tiles:
// 6 7 8
// 3 4 5
// 0 1 2
// The orientation of a tile is specified by a 0-3 value.
// 0 = normal orientation.
// 1 = 90 degrees counterclockwise.
// 2 = 180 degrees counterclockwise.
// 3 = 270 degrees counterclockwise.
// Here we set the data for the first tile at index 0, the bottom left tile.
// 35 is the ID of a corner tile with trees.
// Rotate the tile 180 degrees counterclockwise.
SetTileData(sOverrideName, 0, 35, 2);
// Set the data for the tile at index 1.
// 36 is the ID of a edge tile with trees.
// Rotate the tile 270 degrees counterclockwise.
SetTileData(sOverrideName, 1, 36, 3);
// Set the data for the tile at index 2.
// 35 again for another corner with trees.
// Rotate the tile 270 degrees counterclockwise.
SetTileData(sOverrideName, 2, 35, 3);
// Set the data for the tile at index 3.
// 36 again for another edge with trees.
// Rotate the tile 180 degrees counterclockwise.
SetTileData(sOverrideName, 3, 36, 2);
// Set the data for the tile at index 4.
// 120 is the ID of a tile that's just grass.
// No need to rotate it
SetTileData(sOverrideName, 4, 120, 0);
// Setting the rest of the tiles.
SetTileData(sOverrideName, 5, 36, 0);
SetTileData(sOverrideName, 6, 35, 1);
SetTileData(sOverrideName, 7, 36, 1);
SetTileData(sOverrideName, 8, 35, 0);
// Here we override the tiles of the area that has "myarea" as resref with our override.
NWNX_Tileset_SetAreaTileOverride("myarea", sOverrideName);
// We can't override or change the tiles of existing areas so we have to
// create a new one using the resref we've just overridden the tiles of
CreateArea("myarea", "MY_COOL_AREA", "Optional Cool Name");
}

If all went well, when you move to the newly created area, it should look like this:

Area

Files

file  nwnx_tileset.nss
 

Classes

struct  NWNX_Tileset_TilesetData
 A structure containing general tileset data. More...
 
struct  NWNX_Tileset_TilesetGroupData
 A structure containing the group data for a tileset. More...
 
struct  NWNX_Tileset_TileEdgesAndCorners
 A structure containing the edge and corner types of a tile. More...
 
struct  NWNX_Tileset_TileDoorData
 A structure containing the door data for a tile. More...
 
struct  NWNX_Tileset_CustomTileData
 A structure containing custom tile data,. More...
 

Functions

struct NWNX_Tileset_TilesetData NWNX_Tileset_GetTilesetData (string sTileset)
 Get general data of sTileset. More...
 
string NWNX_Tileset_GetTilesetTerrain (string sTileset, int nIndex)
 Get the name of sTileset's terrain at nIndex. More...
 
string NWNX_Tileset_GetTilesetCrosser (string sTileset, int nIndex)
 Get the name of sTileset's crosser at nIndex. More...
 
struct NWNX_Tileset_TilesetGroupData NWNX_Tileset_GetTilesetGroupData (string sTileset, int nIndex)
 Get general data of the group at nIndex in sTileset. More...
 
int NWNX_Tileset_GetTilesetGroupTile (string sTileset, int nGroupIndex, int nTileIndex)
 Get the tile ID at nTileIndex in nGroupIndex of sTileset. More...
 
string NWNX_Tileset_GetTileModel (string sTileset, int nTileID)
 Get the model name of a tile in sTileset. More...
 
string NWNX_Tileset_GetTileMinimapTexture (string sTileset, int nTileID)
 Get the minimap texture name of a tile in sTileset. More...
 
struct NWNX_Tileset_TileEdgesAndCorners NWNX_Tileset_GetTileEdgesAndCorners (string sTileset, int nTileID)
 Get the edges and corners of a tile in sTileset. More...
 
int NWNX_Tileset_GetTileNumDoors (string sTileset, int nTileID)
 Get the number of doors of a tile in sTileset. More...
 
struct NWNX_Tileset_TileDoorData NWNX_Tileset_GetTileDoorData (string sTileset, int nTileID, int nIndex=0)
 Get the door data of a tile in sTileset. More...
 
void NWNX_Tileset_SetAreaTileOverride (string sAreaResRef, string sOverrideName)
 Override the tiles of sAreaResRef with data in sOverrideName. More...
 
void NWNX_Tileset_CreateTileOverride (string sOverrideName, string sTileSet, int nWidth, int nHeight)
 Create a tile override named sOverrideName. More...
 
void NWNX_Tileset_DeleteTileOverride (string sOverrideName)
 Delete a tile override named sOverrideName. More...
 
void NWNX_Tileset_SetOverrideTileData (string sOverrideName, int nIndex, struct NWNX_Tileset_CustomTileData strCustomTileData)
 Set custom tile data for the tile at nIndex in sOverrideName. More...
 
void NWNX_Tileset_DeleteOverrideTileData (string sOverrideName, int nIndex)
 Delete custom tile data of the tile at nIndex in sOverrideName. More...
 

Function Documentation

◆ NWNX_Tileset_GetTilesetData()

struct NWNX_Tileset_TilesetData NWNX_Tileset_GetTilesetData ( string  sTileset)

Get general data of sTileset.

Parameters
sTilesetThe tileset.
Returns
A NWNX_Tileset_TilesetData struct.

Definition at line 167 of file nwnx_tileset.nss.

◆ NWNX_Tileset_GetTilesetTerrain()

string NWNX_Tileset_GetTilesetTerrain ( string  sTileset,
int  nIndex 
)

Get the name of sTileset's terrain at nIndex.

Parameters
sTilesetThe tileset.
nIndexThe index of the terrain. Range: NWNX_Tileset_TilesetData.nNumTerrain > nIndex >= 0
Returns
The terrain name or "" on error.

Definition at line 189 of file nwnx_tileset.nss.

◆ NWNX_Tileset_GetTilesetCrosser()

string NWNX_Tileset_GetTilesetCrosser ( string  sTileset,
int  nIndex 
)

Get the name of sTileset's crosser at nIndex.

Parameters
sTilesetThe tileset.
nIndexThe index of the crosser. Range: NWNX_Tileset_TilesetData.nNumCrossers > nIndex >= 0
Returns
The crosser name or "" on error.

Definition at line 198 of file nwnx_tileset.nss.

◆ NWNX_Tileset_GetTilesetGroupData()

struct NWNX_Tileset_TilesetGroupData NWNX_Tileset_GetTilesetGroupData ( string  sTileset,
int  nIndex 
)

Get general data of the group at nIndex in sTileset.

Parameters
sTilesetThe tileset.
nIndexThe index of the group. Range: NWNX_Tileset_TilesetData.nNumGroups > nIndex >= 0
Returns
A NWNX_Tileset_TilesetGroupData struct.

Definition at line 207 of file nwnx_tileset.nss.

◆ NWNX_Tileset_GetTilesetGroupTile()

int NWNX_Tileset_GetTilesetGroupTile ( string  sTileset,
int  nGroupIndex,
int  nTileIndex 
)

Get the tile ID at nTileIndex in nGroupIndex of sTileset.

Parameters
sTilesetThe tileset.
nGroupIndexThe index of the group. Range: NWNX_Tileset_TilesetData.nNumGroups > nGroupIndex >= 0
nTileIndexThe index of the tile. Range: (NWNX_Tileset_TilesetGroupData.nRows * NWNX_Tileset_TilesetGroupData.nColumns) > nTileIndex >= 0
Returns
The tile ID or 0 on error.

Definition at line 222 of file nwnx_tileset.nss.

◆ NWNX_Tileset_GetTileModel()

string NWNX_Tileset_GetTileModel ( string  sTileset,
int  nTileID 
)

Get the model name of a tile in sTileset.

Parameters
sTilesetThe tileset.
nTileIDThe tile ID.
Returns
The model name or "" on error.

Definition at line 232 of file nwnx_tileset.nss.

◆ NWNX_Tileset_GetTileMinimapTexture()

string NWNX_Tileset_GetTileMinimapTexture ( string  sTileset,
int  nTileID 
)

Get the minimap texture name of a tile in sTileset.

Parameters
sTilesetThe tileset.
nTileIDThe tile ID.
Returns
The minimap texture name or "" on error.

Definition at line 241 of file nwnx_tileset.nss.

◆ NWNX_Tileset_GetTileEdgesAndCorners()

struct NWNX_Tileset_TileEdgesAndCorners NWNX_Tileset_GetTileEdgesAndCorners ( string  sTileset,
int  nTileID 
)

Get the edges and corners of a tile in sTileset.

Parameters
sTilesetThe tileset.
nTileIDThe tile ID.
Returns
A NWNX_Tileset_TileEdgesAndCorners struct.

Definition at line 250 of file nwnx_tileset.nss.

◆ NWNX_Tileset_GetTileNumDoors()

int NWNX_Tileset_GetTileNumDoors ( string  sTileset,
int  nTileID 
)

Get the number of doors of a tile in sTileset.

Parameters
sTilesetThe tileset.
nTileIDThe tile ID.
Returns
The amount of doors.

Definition at line 269 of file nwnx_tileset.nss.

◆ NWNX_Tileset_GetTileDoorData()

struct NWNX_Tileset_TileDoorData NWNX_Tileset_GetTileDoorData ( string  sTileset,
int  nTileID,
int  nIndex = 0 
)

Get the door data of a tile in sTileset.

Parameters
sTilesetThe tileset.
nTileIDThe tile ID.
nIndexThe index of the door. Range: NWNX_Tileset_GetTileNumDoors() > nIndex >= 0
Returns
A NWNX_Tileset_TileDoorData struct.

Definition at line 278 of file nwnx_tileset.nss.

◆ NWNX_Tileset_SetAreaTileOverride()

void NWNX_Tileset_SetAreaTileOverride ( string  sAreaResRef,
string  sOverrideName 
)

Override the tiles of sAreaResRef with data in sOverrideName.

Parameters
sAreaResRefThe resref of the area to override.
sOverrideNameThe name of the override containing the custom tile data or "" to remove the override.

Definition at line 295 of file nwnx_tileset.nss.

◆ NWNX_Tileset_CreateTileOverride()

void NWNX_Tileset_CreateTileOverride ( string  sOverrideName,
string  sTileSet,
int  nWidth,
int  nHeight 
)

Create a tile override named sOverrideName.

Parameters
sOverrideNameThe name of the override.
sTileSetThe tileset the override should use.
nWidthThe width of the area. Valid values: 1-32.
nHeightThe height of the area. Valid values: 1-32.

Definition at line 302 of file nwnx_tileset.nss.

◆ NWNX_Tileset_DeleteTileOverride()

void NWNX_Tileset_DeleteTileOverride ( string  sOverrideName)

Delete a tile override named sOverrideName.

Note
This will also delete all custom tile data associated with sOverrideName.
Parameters
sOverrideNameThe name of the override.

Definition at line 311 of file nwnx_tileset.nss.

◆ NWNX_Tileset_SetOverrideTileData()

void NWNX_Tileset_SetOverrideTileData ( string  sOverrideName,
int  nIndex,
struct NWNX_Tileset_CustomTileData  strCustomTileData 
)

Set custom tile data for the tile at nIndex in sOverrideName.

Note
An override must first be created with NWNX_Tileset_CreateTileOverride().
Parameters
sOverrideNameThe name of the override.
nIndexThe index of the tile.
strCustomTileDataA NWNX_Tileset_CustomTileData struct.

Definition at line 317 of file nwnx_tileset.nss.

◆ NWNX_Tileset_DeleteOverrideTileData()

void NWNX_Tileset_DeleteOverrideTileData ( string  sOverrideName,
int  nIndex 
)

Delete custom tile data of the tile at nIndex in sOverrideName.

Parameters
sOverrideNameThe name of the override.
nIndexThe tile's index or -1 to remove all custom tile data.

Definition at line 334 of file nwnx_tileset.nss.

NWNX_Tileset_CustomTileData
A structure containing custom tile data,.
Definition: nwnx_tileset.nss:59
main
void main()
Definition: array_example.nss:133
NWNX_Tileset_CustomTileData::nTileID
int nTileID
The tile ID. See the tileset's .set file.
Definition: nwnx_tileset.nss:61
NWNX_Tileset_SetAreaTileOverride
void NWNX_Tileset_SetAreaTileOverride(string sAreaResRef, string sOverrideName)
Override the tiles of sAreaResRef with data in sOverrideName.
Definition: nwnx_tileset.nss:295
NWNX_Tileset_SetOverrideTileData
void NWNX_Tileset_SetOverrideTileData(string sOverrideName, int nIndex, struct NWNX_Tileset_CustomTileData strCustomTileData)
Set custom tile data for the tile at nIndex in sOverrideName.
Definition: nwnx_tileset.nss:317
NWNX_Tileset_CreateTileOverride
void NWNX_Tileset_CreateTileOverride(string sOverrideName, string sTileSet, int nWidth, int nHeight)
Create a tile override named sOverrideName.
Definition: nwnx_tileset.nss:302
NWNX_Tileset_CustomTileData::nHeight
int nHeight
The height of the tile.
Definition: nwnx_tileset.nss:63