// Include file for storing commonly-used functions // Created By: Bioware Team // Created Date: 01-30-04 // Modified Date: 02-02-04 // Modified By: Mike Immordino // Description: Rewrote 2 functions for ease of use and clarity; changed function // to eliminate unneeded variables. // // Included Functions (see each function for description): // TLResetSpecificTile(object oArea, int iY, int iX) // TLResetAreaTiles(object oArea) // TLChangeSpecificTile(object oArea, int iTile, int iY, int iX, float fHeight) // TLChangeAreaTiles(object oArea, int iTile, int iY, int iX, float fHeight) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // CONSTANTS: // 426 = Ice 350 = Lava // 401 = Water 406 = Cave Floor // 402 = Grass 461 = Sewer Water // 349 = Lava Fountain (??) //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // The below is needed to compile successfully; // uncomment, compile, comment out, then save //void main(){} //============================================================================== // This function resets a specific Area tile, destroying any tile that has been // overlaid. Takes the Area of the tile, and the Y,X coordinates to destroy. //============================================================================== void TLResetSpecificTile(object oArea,int iY,int iX) { object oTile = GetFirstObjectInArea(oArea); float x = 5.0 + ( 10.0 * iX ); float y = 5.0 + ( 10.0 * iY ); vector vPos; while (GetIsObjectValid(oTile)) { if (GetObjectType(oTile) == OBJECT_TYPE_PLACEABLE && GetTag(oTile) == "x2_tmp_tile") { vPos = GetPosition( oTile ); if ( vPos.x == x && vPos.y == y ) { SetPlotFlag(oTile,FALSE); // un-trip the Plot flag so we can destroy DestroyObject (oTile); // destroy the invisible object overlay } } oTile = GetNextObjectInArea(oArea); } } //============================================================================== // This function resets a range of Area tiles, destroying any overlaid tile // effects. Takes the Area of the tile, and a range starting from 0,0 to X,Y //============================================================================== void TLResetAreaTiles(object oArea) { object oTile = GetFirstObjectInArea(oArea); // cycle through all tiles in an Area while (GetIsObjectValid(oTile)) { if (GetObjectType(oTile) == OBJECT_TYPE_PLACEABLE && GetTag(oTile) == "x2_tmp_tile") { SetPlotFlag(oTile,FALSE); // un-trip the Plot flag so we can destroy this DestroyObject (oTile); // destroy the invisible object overlay } oTile = GetNextObjectInArea(oArea); } } //============================================================================== // This function changes a specific Area tile, overlaying it with a secondary // tile effect (see constants above). fHeight defines the Z height of the tile. //============================================================================== void TLChangeSpecificTile(object oArea,int iTile,int iY,int iX,float fHeight=-0.4f ) { object oTile; vector vPos; vPos.x = 5.0 + ( 10.0 * iX ); vPos.y = 5.0 + ( 10.0 * iY ); vPos.z = fHeight; float fFace = 0.0; location lLoc = Location(oArea, vPos, fFace); // the tile overlay is really just an invisble object oTile = CreateObject(OBJECT_TYPE_PLACEABLE, "plc_invisobj", lLoc,FALSE, "x2_tmp_tile"); SetPlotFlag(oTile,TRUE); // don't let the PCs destroy the tile overlay // set the tile overlay effect ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(iTile), oTile); } //============================================================================== // This function changes a range of Area tiles, overlaying the entire range with // a tile effect (see constants above). Range begins at 0,0 and covers up to // X,Y. fHeight sets the Z dimension height of the tile effect. //============================================================================== void TLChangeAreaTiles(object oArea,int iTile,int iY,int iX, float fHeight=-0.4f ) { object oTile; vector vPos; vPos.x = 5.0; vPos.y = 0.0; vPos.z = fHeight; float fFace = 0.0; location lLoc; // use nested For loops to fill first the X, then the Y axis // outer loop fills the X axis last int i, j; // indexes for looping for (i=0 ; i <= iY; i++) { vPos.y = -5.0; // inner loop fills the Y axis first for (j=0; j <= iX; j++) { vPos.y = vPos.y + 10.0; lLoc = Location(oArea, vPos, fFace); // the tile overlay is just an invisble object oTile = CreateObject(OBJECT_TYPE_PLACEABLE, "plc_invisobj", lLoc,FALSE, "x2_tmp_tile"); SetPlotFlag(oTile,TRUE); // don't let PCs destroy the tile overlay // set the tile overlay effect ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(iTile), oTile); } vPos.x = vPos.x + 10.0; } }