An Introduction To Tile Magic

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(tm):


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:


1. Create a new module with a new forest area, 8x8 tiles
2. Create a pit in the middle of the forest area, maybe 3x3 tiles
3. Stick the following script in your module:


#include "x2_inc_toollib"
void main()
{
        int nX = 8;
        int nY = 8;
        TLChangeAreaGroundTiles(GetArea(OBJECT_SELF),X2_TL_GROUNDTILE_WATER,nX,nY,-0.92f);
}

4. Start your module, enter the area, enable debugmode and run your script using the runscript command ....


Example 2:


1. Create a City Interior area, 4x4 tiles
2. Draw an Inn environment
3. Place some broken furniture placeables around
4. Save this script into your module:


#include "x2_inc_toollib"
void main()
{
        int nX = 4;
        int nY = 4;
        TLChangeAreaGroundTiles(GetArea(OBJECT_SELF),X2_TL_GROUNDTILE_WATER,nX,nY,0.3f);
}

5. Run the script via the console's runscript command
6. Woa, what a bad place to live


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. If not ... what are you waiting for, play the game!




See Also

functions:  TLChangeAreaGroundTiles | TLChangeAreaGroundTilesEx | TLResetAreaGroundTiles | TLResetAreaGroundTilesEx

 author: Georg Zoeller, editors: Grimlar, Mistress