Code: Select all
//add the object at x,y (in 100ths) to the map. Returns an id for use with other object functions - not constant across game runs. Returns -1 if not valid object
PlaceObject(x, y, objectSet, objectName)
Code: Select all
if (GetTurn() == 2) // ((GetGlobal("vp6") == 0) && (GetUniversalVar("bridgerepaired") == 0)) (GetTurn() == 2) is for testing convenience
{
AddVizCam(37,28,0);
PlaceObject(37, 28, "Bridge", "BridgeRiver");
ShowUIScreen("BattlePop0", "Anim1", "IDS_SCN_ORLEANS_BRIDGEREPAIRED");
AddVizDelay(30);
SetUniversalVar("bridgerepaired",1);
}
then I tried to use this
Code: Select all
PlaceObjectByStyle(37, 28, "NorthernEurope", "BridgeRiver", "SouthernEurope");
Code: Select all
//place an object from the specified style with the specified name. x and y are in 100ths. If an alternateStyle is specified, it will be used if the primary style does not contain an appropriate object
PlaceObjectByStyle(x, y, style, name, [alternateStyle])
Does the program permit such order in-battle?
Perhaps I should look into this
Code: Select all
FUNCTION ALL_PLACE_FF(me, tilex, tiley)
{
int facing;
int rotation;
int object;
int unitX;
int unitY;
int x;
int y;
int side;
int type;
int edge;
side = GetUnitSide(me);
type = gFFStats[side].type;
edge = 0;
if (type == 0)
{
edge = 1;
}
SetVisibleUnitCount(me); // Set pre-move visible unit count for Undo purposes.
ResetMovedLastFlags(side);
unitX = GetUnitX(me);
unitY = GetUnitY(me);
facing = GetFacing(unitX,unitY,tileX,tileY);
rotation = GetFFRotation(facing, edge);
if (type == 0) // Ditch (Edge object)
{
if (facing == 0)
{
x = (unitX * 100) + 50;
y = (unitY * 100) + 100;
}
if (facing == 90)
{
x = (unitX * 100) + 100;
y = (unitY * 100) + 50;
}
if (facing == 180)
{
x = (unitX * 100) + 50;
y = unitY * 100;
}
if (facing == 270)
{
x = unitX * 100;
y = (unitY * 100) + 50;
}
}
else // Centred object
{
x = (unitX * 100) + 50;
y = (unitY * 100) + 50;
}
GetFFObjectName(type, 0);
// object = PlaceObject(x, y, gAdjustableObjectStyle, GetWorkString(0));
object = PlaceObjectByStyle(x, y, gAdjustableObjectStyle, GetWorkString(0), "NorthernEurope"); // vM1.3.2 change
SetObjectRotation(object, rotation);
SetLocalTileData(tilex, tiley);
gFFStats[side].number -= 1;
// If stakes replaced by FF, don't keep stakes as well.
if (GetAttrib(me, "Stakes") == 1)
{
SetAttrib(me, "Stakes", 2);
}
}

