Table of Contents

Tile Magic

This article was initially published on the BioWare forums and later added to the NWN Lexicon.

If you played chapter 3 of the official campaign, you probably asked yourself several times “how did they do this, they can't be changing the tilesets on the fly?!”

Without a spoiler, here is a short introduction to Tile Magic™:

How to perform tile magic


The file you want to look at is “x2_inc_toollib.nss”. Two of the functions in this file are dealing with changing tiles in a tileset (or better creating the illusion to do that).


To give you a short idea of what you can do with it, try this example:

Example 1 - Pond in the forest

  1. Create a new module with a new forest area, 8×8 tiles
  2. Create a pit in the middle of the forest area, maybe 3×3 tiles
  3. Stick the script below in your module:
  4. Start your module, enter the area, enable debugmode and run your script using the runscript command ….
#include "x2_inc_toollib"
void main()
{
        int nX = 8;
        int nY = 8;
        TLChangeAreaGroundTiles(GetArea(OBJECT_SELF),X2_TL_GROUNDTILE_WATER,nX,nY,-0.92f);
}

Example 2 - Lava City

  1. Create a City Interior area, 4×4 tiles
  2. Draw an Inn environment
  3. Place some broken furniture placeables around
  4. Save the script below into your module:
  5. Run the script via the console's runscript command
#include "x2_inc_toollib"
void main()
{
        int nX = 4;
        int nY = 4;
        TLChangeAreaGroundTiles(GetArea(OBJECT_SELF),X2_TL_GROUNDTILE_LAVA,nX,nY,0.3f);
}


Of course this is just one of the many things you can do using the technique we used. You've probably seen many other applications in the Hordes of the Underdark official campaign, especially Chapter 2 and 3.

Further Links

  1. HotU new features Explained - A post I made on the NWN Forums explaining new features we added in HotU.
  2. SunJammer's Tile Magic System - A great library for tile magic effects in your module from community scripting wizard Sunjammer.