Greetings, I would like to add vegetation to the stream boxes.
Which files decide which types of terrain contain vegetation and which does not?
Add vegetation to the stream boxes
Moderator: rbodleyscott
-
- Field of Glory 2
- Posts: 28047
- Joined: Sun Dec 04, 2005 6:25 pm
Re: Add vegetation to the stream boxes
Do you mean in the random map generator?
If so streams are actually placed by the following loop in BM_PopulateFromTileData() in /Data/Battle/Scripts/MapGenerateBattle.bsf
Code: Select all
// Streams, rivers and roads - also need to be done outside main loop (if streams trump roads where incompatible)
for (x = 0; x < width; x++)
{
for (y = 0; y < height; y++)
{
data = BM_GetTileDataX(x, y, 1);
border = 0;
if (IsValidTile(x,y) != 1)
{
border = 1;
}
if ((data == 11) || (data == 12)) // Stream data not generated outside border
{
PlaceTileByType(x, y, style, "WATER", 1);
if (GetUniversalVar("StreamSize") == 1)
{
PlaceTileByType(x, y, style, "MEDIUMSTREAMS", 0);
}
if (GetUniversalVar("StreamSize") == 2)
{
PlaceTileByType(x, y, style, "DEEPSTREAMS", 0);
}
}
if ((data == 16) || (data == 17))
{
PlaceTileByType(x, y, style, "WATER", 0);
}
if (((data == 6) || (data == 12) || (data == 17)) && (border == 0)) // Road
{
PlaceTileByType(x, y, style, "TRACK", 1);
// PlaceTileByType(x, y, style, "ROAD", 1);
}
}
}
Code: Select all
PlaceTileByType(x, y, style, "WATER", 1);
The hard part would be avoiding placing vegetation in the middle of the stream. That is why I didn't do it myself.
The actual stream overlays are placed automatically by the engine, so you have no control over which ones are used where - at least not without a lot of extra code, as used for rivers.
Richard Bodley Scott
Re: Add vegetation to the stream boxes
Code: Select all
{
PlaceTileByType(x, y, style, "WATER", 1);
object = PlaceObject((x * 100) + Rand(10,100), (y * 100) + Rand(10,100), gAdjustableObjectStyle, "BushesTile");
if (object != -1)
{
SetObjectRotation(object, 157 * Rand(0, 3));
}
This is going to give problems with the multiplayer?
- Attachments
-
- Stream1.jpg (443.03 KiB) Viewed 1163 times
-
- Stream2.jpg (704.74 KiB) Viewed 1163 times
-
- Field of Glory 2
- Posts: 28047
- Joined: Sun Dec 04, 2005 6:25 pm
Re: Add vegetation to the stream boxes
It is hard to say, but as a general rule you should not play MP with a modded main build.toska wrote: ↑Sun Mar 07, 2021 4:32 pmThank you very much Richard. I have done this and I think it looks great!Code: Select all
{ PlaceTileByType(x, y, style, "WATER", 1); object = PlaceObject((x * 100) + Rand(10,100), (y * 100) + Rand(10,100), gAdjustableObjectStyle, "BushesTile"); if (object != -1) { SetObjectRotation(object, 157 * Rand(0, 3)); }
This is going to give problems with the multiplayer?
Richard Bodley Scott