Alrights but this is the primitive test!
TERRAFORM.BSF:
Code: Select all
FUNCTION ALL_TERRAFORM(me, tilex, tiley)
{
int tuilex;
int tuiley;
int id;
int count;
int object;
tuilex = GetUnitX(me);
tuiley = GetUnitY(me);
id = GetTileID("MoreTiles", "Tile1") ;
AddVizText(tuilex, tuiley, "IDS_TT_TERRAFORM", "ffffff");
PlaceTile(tuilex, tuiley, id, 0);
for (count = 100 ; count >= 0; count--)
{
object = GetTileObject(tuilex, tuiley, count);
//Log("Object:", object);
if (object != -1)
{
if (IsObjectName(object, "tree") == 1)
{
DeleteObject(object);
}
if (IsObjectName(object, "tree1") == 1)
{
DeleteObject(object);
}
if (IsObjectName(object, "tree2") == 1)
{
DeleteObject(object);
}
if (IsObjectName(object, "tree3") == 1)
{
DeleteObject(object);
}
if (IsObjectName(object, "tree4") == 1)
{
DeleteObject(object);
}
if (IsObjectName(object, "TREE_BLOCKING") == 1)
{
DeleteObject(object);
}
}
}
SetAttrib(me, "AP", 0);
}
FUNCTION CHECK_ALL_TERRAFORM(me, tilex, tiley)
{
int ret ;
int id;
int id2;
int id3;
int tuilex;
int tuiley;
ret = -2 ;
tuilex = GetUnitX(me);
tuiley = GetUnitY(me);
if ((tuilex == tilex) && (tuiley == tiley))
{
if ((IsUnitType(me, "us_engineer") == 1) && (IsUnitValid(me) == 1))
{
id = GetTileOnTile(0, tuilex, tuiley);
id2 = GetTileID("MoreTiles", "Tile8") ;
id3 = GetTileID("MoreTiles", "Tile9") ;
if ((id == id2) || (id == id3))
{
if (GetAttrib(me, "AP") == GetBaseAttrib(me, "AP"))
{
ret = 1;
}
}
}
}
return ret ;
}
FUNCTION UISETUP_ALL_TERRAFORM()
{
StartString() ;
PrintString("IDS_TT_TERRAFORM") ;
SetUITooltip();
SetUITexture("action_terraform", "ffffffff") ;
}
FUNCTION UIBUTTON_ALL_TERRAFORM(me, x,y,width, height, tilex, tiley)
{
//RenderVCenteredString(x,y,width,height,10,1,"ff000000") ;
}
TANKTRAP.BSF:
Code: Select all
FUNCTION ALL_TANKTRAP(me, tilex, tiley)
{
int count;
int object;
AddVizText(tilex, tiley, "IDS_TT_TANKTRAP", "ffffff");
for (count = 0 ; count < 100; count++)
{
object = GetTileObject(tilex, tiley, count);
if (IsObjectName(object, "TANKTRAPS") == 1)
{
DeleteObject(object);
count = 101;
}
}
SetAttrib(me, "AP", 0);
}
FUNCTION CHECK_ALL_TANKTRAP(me, tilex, tiley)
{
int ret ;
int tuilex;
int tuiley;
int object;
int count;
ret = -2 ;
tuilex = GetUnitX(me);
tuiley = GetUnitY(me);
if (GetDistanceBetweenTiles(tilex, tiley, tuilex, tuiley) > 1)
{
return ret;
}
if ((IsUnitType(me, "us_engineer") == 1) && (IsUnitValid(me) == 1))
{
for (count = 0 ; count < 100; count++)
{
object = GetTileObject(tilex, tiley, count);
if (object != -1)
{
if (IsObjectName(object, "TANKTRAPS") == 1)
{
if (GetAttrib(me, "AP") == GetBaseAttrib(me, "AP"))
{
ret = 1;
}
}
}
}
}
return ret ;
}
FUNCTION UISETUP_ALL_TANKTRAP()
{
StartString() ;
PrintString("IDS_TT_TANKTRAP") ;
SetUITooltip();
SetUITexture("action_tanktrap", "ffffffff") ;
}
FUNCTION UIBUTTON_ALL_TANKTRAP(me, x,y,width, height, tilex, tiley)
{
//RenderVCenteredString(x,y,width,height,10,1,"ff000000") ;
}
ADDTRAP.BSF
Code: Select all
FUNCTION ALL_ADDTRAP(me, tilex, tiley)
{
int object;
int orientation;
int tuilex;
int tuiley;
tuilex = tilex * 100 ;
tuiley = tiley * 100 ;
tuilex = tuilex + 50;
tuiley = tuiley + 50;
AddVizText(tuilex, tuiley, "IDS_TT_ADDTANKTRAP", "ffffff");
object = PlaceObject(tuilex, tuiley, "Test", "TankTraps");
Log("Object:", object);
// orientation = GetObjectRotation(me);
// SetObjectRotation(object, 0) ;
SetAttrib(me, "AP", 0);
}
FUNCTION CHECK_ALL_ADDTRAP(me, tilex, tiley)
{
int ret ;
int tuilex;
int tuiley;
int object;
int count;
ret = -2 ;
tuilex = GetUnitX(me);
tuiley = GetUnitY(me);
if (GetDistanceBetweenTiles(tilex, tiley, tuilex, tuiley) > 1)
{
return ret;
}
if ((IsUnitType(me, "us_engineer") == 1) && (IsUnitValid(me) == 1))
{
ret = 1;
for (count = 0 ; count < 100; count++)
{
object = GetTileObject(tilex, tiley, count);
if (object != -1)
{
if (IsObjectName(object, "TANKTRAPS") == 1)
{
ret = -2;
}
}
}
}
return ret ;
}
FUNCTION UISETUP_ALL_ADDTRAP()
{
StartString() ;
PrintString("IDS_TT_ADDTANKTRAP") ;
SetUITooltip();
SetUITexture("action_tanktrap", "ffffffff") ;
}
FUNCTION UIBUTTON_ALL_ADDTRAP(me, x,y,width, height, tilex, tiley)
{
//RenderVCenteredString(x,y,width,height,10,1,"ff000000") ;
}
CUTHEDGEDROW.BSF:
Code: Select all
FUNCTION ALL_CUTHEDGEDROW(me, tilex, tiley)
{
int object;
AddVizText(tilex, tiley, "IDS_TT_CUTHEDGEDROW", "ffffff");
object = GetGlobal("Del_Hedge");
Log("Object:", object);
DeleteObject(object);
SetAttrib(me, "AP", 0);
}
FUNCTION CHECK_ALL_CUTHEDGEDROW(me, tilex, tiley)
{
int ret ;
int id;
int id2;
int id3;
int tuilex;
int tuiley;
int count;
int object;
int UnitFace;
int xd;
int yd;
int ux;
int uy;
int flag;
ret = -2 ;
flag = 0;
tuilex = GetUnitX(me);
tuiley = GetUnitY(me);
UnitFace = GetUnitFacing(me);
Log("UnitFace:", UnitFace);
if (GetDistanceBetweenTiles(tilex, tiley, tuilex, tuiley) > 1)
{
return ret;
}
if ((IsUnitType(me, "us_engineer") == 1) && (IsUnitValid(me) == 1))
{
for (count = 0 ; count < 100; count++)
{
object = GetTileObject(tilex, tiley, count);
if (object != -1)
{
if (IsObjectName(object, "hedgrow2") == 1)
{
if (UnitFace == 0)
{
xd = GetObjectPositionX(object);
yd = GetObjectPositionY(object);
// Log("Hedge:", xd, yd);
ux = tilex * 100;
uy = tiley * 100;
ux = ux + 50;
// uy = uy + 50;
Log("Need:", ux, uy);
if ((xd == ux) && (yd == uy))
{
flag = 1;
SetGlobal("Del_Hedge", object);
// Log("Object:", object);
count = 101;
}
}
if (UnitFace == 90)
{
xd = GetObjectPositionX(object);
yd = GetObjectPositionY(object);
// Log("Hedge:", xd, yd);
ux = tilex * 100;
uy = tiley * 100;
uy = uy + 50;
// uy = uy + 50;
Log("Need:", ux, uy);
if ((xd == ux) && (yd == uy))
{
flag = 1;
SetGlobal("Del_Hedge", object);
// Log("Object:", object);
count = 101;
}
}
if (UnitFace == 180)
{
xd = GetObjectPositionX(object);
yd = GetObjectPositionY(object);
// Log("Hedge:", xd, yd);
ux = tilex * 100;
uy = tiley * 100;
ux = ux - 50;
// uy = uy + 50;
Log("Need:", ux, uy);
if ((xd == ux) && (yd == uy))
{
flag = 1;
SetGlobal("Del_Hedge", object);
Log("Object:", object);
count = 101;
}
}
if (UnitFace == 270)
{
xd = GetObjectPositionX(object);
yd = GetObjectPositionY(object);
// Log("Hedge:", xd, yd);
ux = tilex * 100;
uy = tiley * 100;
uy = uy - 50;
// uy = uy + 50;
Log("Need:", ux, uy);
if ((xd == ux) && (yd == uy))
{
flag = 1;
SetGlobal("Del_Hedge", object);
// Log("Object:", object);
count = 101;
}
}
}
}
}
}
if (flag == 1)
{
if (GetAttrib(me, "AP") == GetBaseAttrib(me, "AP"))
{
ret = 1;
}
}
return ret ;
}
FUNCTION UISETUP_ALL_CUTHEDGEDROW()
{
StartString() ;
PrintString("IDS_TT_CUTHEDGEDROW") ;
SetUITooltip();
SetUITexture("action_terraform", "ffffffff") ;
}
FUNCTION UIBUTTON_ALL_CUTHEDGEDROW(me, x,y,width, height, tilex, tiley)
{
//RenderVCenteredString(x,y,width,height,10,1,"ff000000") ;
}