generated from Jaysyn/ModuleTemplate
181 lines
5.2 KiB
Plaintext
181 lines
5.2 KiB
Plaintext
const int X2_TL_GROUNDTILE_ICE = 426;
|
|
const int X2_TL_GROUNDTILE_WATER = 401;
|
|
const int X2_TL_GROUNDTILE_GRASS = 402;
|
|
const int X2_TL_GROUNDTILE_LAVA_FOUNTAIN = 349; // ugly
|
|
const int X2_TL_GROUNDTILE_LAVA = 350;
|
|
const int X2_TL_GROUNDTILE_CAVEFLOOR = 406;
|
|
const int X2_TL_GROUNDTILE_SEWER_WATER = 461;
|
|
|
|
//::///////////////////////////////////////////////
|
|
//:: satchmogold's VFX Tool library
|
|
//:: sc_inc_mytmagic
|
|
//:://////////////////////////////////////////////
|
|
//* ***************************** INTERFACE *************************************
|
|
|
|
// change the type of the ground or (by default) sub ground tiles (i.e. water) to the specified type
|
|
// Valid values are
|
|
// const int X2_TL_GROUNDTILE_ICE = 426;
|
|
// const int X2_TL_GROUNDTILE_WATER = 401;
|
|
// const int X2_TL_GROUNDTILE_GRASS = 402;
|
|
// const int X2_TL_GROUNDTILE_LAVA_FOUNTAIN = 349; // ugly
|
|
// const int X2_TL_GROUNDTILE_LAVA = 350;
|
|
// const int X2_TL_GROUNDTILE_CAVEFLOOR = 406;
|
|
// const int X2_TL_GROUNDTILE_SEWER_WATER = 461;
|
|
// int nType 0 = fill an area, 1 = flood, 2 = ground cover
|
|
// Set int nIsSewerCity to TRUE if area is a sewer or city, as for some reason this is different
|
|
void JWChangeAllAreaGroundTiles(object oArea, int nGroundTileConst, int nType, int nIsSewerCity=FALSE );
|
|
// remove any ground area tiles created with TLChangeAreaGroundTiles in current area
|
|
void JWResetALLAreaGroundTiles(object oArea);
|
|
// Valid values are
|
|
// const int X2_TL_GROUNDTILE_ICE = 426;
|
|
// const int X2_TL_GROUNDTILE_WATER = 401;
|
|
// const int X2_TL_GROUNDTILE_GRASS = 402;
|
|
// const int X2_TL_GROUNDTILE_LAVA_FOUNTAIN = 349; // ugly
|
|
// const int X2_TL_GROUNDTILE_LAVA = 350;
|
|
// const int X2_TL_GROUNDTILE_CAVEFLOOR = 406;
|
|
// const int X2_TL_GROUNDTILE_SEWER_WATER = 461;
|
|
//(object oArea, int nColumn, int nRow);
|
|
// lLocation is the place to do it, fDelay is how long it lasts, fZOffset shouldn't need changing
|
|
// to make it permanent, set fDelay to 0.0
|
|
void JWChangeoneAreaGroundTileOnly(location lLocation, int nGroundTileConst, float fDelay = 12.0, float fZOffset = -0.4f );
|
|
|
|
|
|
|
|
|
|
void JWChangeoneAreaGroundTileOnly(location lLocation, int nGroundTileConst, float fDelay = 12.0, float fZOffset = -0.4f )
|
|
{
|
|
vector vVector=GetPositionFromLocation(lLocation);
|
|
vVector.z=fZOffset;
|
|
lLocation=Location(GetArea(OBJECT_SELF),vVector,180.0);
|
|
object oTile = CreateObject(OBJECT_TYPE_PLACEABLE, "plc_invisobj", lLocation,FALSE, "x2_tmp_tile");
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(nGroundTileConst), oTile);
|
|
if (fDelay>0.0)
|
|
{
|
|
DelayCommand(fDelay,(DestroyObject(oTile)));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void JWResetAllAreaGroundTiles(object oArea)
|
|
{
|
|
object oTile = GetFirstObjectInArea(oArea);
|
|
|
|
while (GetIsObjectValid(oTile))
|
|
{
|
|
if (GetObjectType(oTile) == OBJECT_TYPE_PLACEABLE && GetTag(oTile) == "x2_tmp_tile")
|
|
{
|
|
SetPlotFlag(oTile,FALSE);
|
|
DestroyObject (oTile);
|
|
}
|
|
oTile = GetNextObjectInArea(oArea);
|
|
}
|
|
|
|
}
|
|
|
|
int GetAreaXAxis(object oArea)
|
|
{
|
|
|
|
location locTile;
|
|
int iX = 0;
|
|
int iY = 0;
|
|
vector vTile = Vector(0.0, 0.0, 0.0);
|
|
|
|
for (iX = 0; iX < 32; ++iX)
|
|
{
|
|
vTile.x = IntToFloat(iX);
|
|
locTile = Location(oArea, vTile, 0.0);
|
|
int iRes = GetTileMainLight1Color(locTile);
|
|
if (iRes > 32 || iRes < 0)
|
|
return(iX);
|
|
}
|
|
|
|
return 32;
|
|
}
|
|
|
|
int GetAreaYAxis(object oArea)
|
|
{
|
|
location locTile;
|
|
int iX = 0;
|
|
int iY = 0;
|
|
vector vTile = Vector(0.0, 0.0, 0.0);
|
|
|
|
for (iY = 0; iY < 32; ++iY)
|
|
{
|
|
vTile.y = IntToFloat(iY);
|
|
locTile = Location(oArea, vTile, 0.0);
|
|
int iRes = GetTileMainLight1Color(locTile);
|
|
if (iRes > 32 || iRes < 0)
|
|
return(iY);
|
|
}
|
|
|
|
return 32;
|
|
}
|
|
|
|
void JWChangeAllAreaGroundTiles(object oArea, int nGroundTileConst, int nType, int nIsSewerCity=FALSE )
|
|
{
|
|
|
|
// nType definitions:
|
|
// 0 fill
|
|
// 1 flood
|
|
// 2 groundcover
|
|
int iXAxis = GetAreaXAxis(oArea);
|
|
int iYAxis = GetAreaYAxis(oArea);
|
|
float ZEffectAdjust = 0.0;
|
|
float ZTypeAdjust = 1.2; //default is groundcover
|
|
float ZTileAdjust = 0.0;
|
|
float ZFinalAxis;
|
|
|
|
|
|
if (nGroundTileConst == X2_TL_GROUNDTILE_SEWER_WATER)
|
|
ZEffectAdjust = 0.8;
|
|
|
|
//now sep based on nType
|
|
if (nType == 0) //fill
|
|
ZTypeAdjust=-1.0;
|
|
else if (nType ==1)
|
|
ZTypeAdjust = 2.0;
|
|
|
|
ZFinalAxis = ZEffectAdjust + ZTypeAdjust + ZTileAdjust;
|
|
|
|
//special case for filling of water and sewer regions
|
|
if ((nIsSewerCity==TRUE) && (nType==0))
|
|
ZFinalAxis = -0.1;
|
|
|
|
// Author: Brad "Cutscene" Prince
|
|
// * flood area with tiles
|
|
object oTile;
|
|
// * put ice everywhere
|
|
vector vPos;
|
|
vPos.x = 5.0;
|
|
vPos.y = 0.0;
|
|
vPos.z = ZFinalAxis;
|
|
float fFace = 0.0;
|
|
location lLoc;
|
|
|
|
// * fill x axis
|
|
int i, j;
|
|
for (i=0 ; i <= iXAxis; i++)
|
|
{
|
|
vPos.y = -5.0;
|
|
// fill y
|
|
for (j=0; j <= iYAxis; j++)
|
|
{
|
|
vPos.y = vPos.y + 10.0;
|
|
lLoc = Location(oArea, vPos, fFace);
|
|
// Ice tile (even though it says water).
|
|
oTile = CreateObject(OBJECT_TYPE_PLACEABLE, "plc_invisobj", lLoc,FALSE, "x2_tmp_tile");
|
|
SetPlotFlag(oTile,TRUE);
|
|
ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectVisualEffect(nGroundTileConst), oTile);
|
|
}
|
|
vPos.x = vPos.x + 10.0;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|