Author Topic: TileMagic Layers  (Read 1208 times)

Legacy_JediMindTrix

  • Sr. Member
  • ****
  • Posts: 383
  • Karma: +0/-0
TileMagic Layers
« on: June 17, 2016, 03:02:37 am »


               

Sunjammer's tutorial makes mention of 'layers', however I think this term is misleading. In my experiments with his system, it does not seem to be possible to layer tilemagic effects atop of each other:


 


ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_DUR_GLYPH_OF_WARDING), GetObjectByTag("jmt_glyph001")); //Glyph at the player's entrance
SJ_TileMagic_CoverRange(OBJECT_SELF, SJ_TILEMAGIC_ORDINARY_CAVE, 0, 1, 6, 7, -5.40, TRUE); //Cavefloor Tiles
SJ_TileMagic_CoverTile(OBJECT_SELF, SJ_TILEMAGIC_FEATURE_UNDERDARK_WATERFALL, 5, 4, -2.45, TRUE); //Waterfall Tile
SJ_TileMagic_CoverRange(OBJECT_SELF, SJ_TILEMAGIC_ORDINARY_WATER_BLUE_1, 0, 1, 6, 7, -2.43, TRUE); //Water Tiles

 


This results in only water tiles being present ^


Since this is the case with this system, is there a possible workaround? Am I using the system wrong?



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
TileMagic Layers
« Reply #1 on: June 17, 2016, 08:35:09 am »


               

I guess that the water placeable you're using isn't translucent.


 


I have read that it is possible to make a translucent placeable, so perhaps translucent water already exists on the vault?


 


I've only done this with tiles, which normally have a translucent water layer above the floor layer.


 


Probably others know more.


               
               

               
            

Legacy_JediMindTrix

  • Sr. Member
  • ****
  • Posts: 383
  • Karma: +0/-0
TileMagic Layers
« Reply #2 on: June 18, 2016, 05:59:30 am »


               

Sunjammer's system will only apply one tilemagic effect per tile, and will remove the last one applied.



void SJMT_TileMagic_CoverLayerTile(object oArea, int nTile, int nColumn, int nRow, float fZ=0.0, int bNormalise=TRUE, int nRotation=0)
{
    // use unique tag to ID tile node
    string sTag = SJ_TileMagic_GetTagForTile(oArea, nColumn, nRow);
    object oTile = GetObjectByTag(sTag);
    // is location valid?
    if(SJ_GetIsTileValid(oArea, nColumn, nRow))
    {
        // calculate centre of actual tile
        float fX = 10.0 * nColumn + 5.0;
        float fY = 10.0 * nRow + 5.0;
        if(bNormalise)
        {
            // get normalised height as required
            fZ = SJ_TileMagic_GetNormalisedHeight(nTile, fZ);
        }
        // convert rotation from number of quarters to number of degrees
        nRotation = (nRotation < 0) ? Random(4) * 90 : (nRotation % 4) * 90;
        // generate location
        location lTile = Location(oArea, Vector(fX, fY, fZ), IntToFloat(nRotation));
        // create tile
        oTile = SJ_TileMagic_CreateTile(nTile, lTile, sTag);
    }
    else
    {
        // log an error
        string sDebug =  "SJ_TileMagic_CoverTile: failed as target (" + SJ_TileMagic_TileToString(oArea, sTag, nTile) + ") was outwith area.";
        SJ_Debug(SJ_DEBUG_PREFIX_ERROR + sDebug, TRUE);
    }
}

This worked, all I did was remove five lines, but I changed the prefix so the server I made it for would know who made the addition.