Scripting Help needed for Desert Campaign mod

Forum for discussion of the next iteration of the BA engine. This time with a all new open development approach!

Moderators: Slitherine Core, BA Moderators

Post Reply
Paul59
General - King Tiger
General - King Tiger
Posts: 3859
Joined: Tue Jul 21, 2015 11:26 pm

Scripting Help needed for Desert Campaign mod

Post by Paul59 »

Hi,

Is there anyone in the Battle Academy community that is an expert at scripting?

I need help with my Desert Campaign Skirmish mod. I have modified the game's Map Generating scripts (and the terrain textures and models) to produce a decent desert terrain selection, however there is one large problem.

Because of the bare nature of the battlefield, the deployment of the AI's troops on the edge of their deployment area, and the game's preference for placing all the fortifications and villages near the baseline of the map, Attack type battles against the AI are far too easy, his infantry and AT guns are just sat in bare terrain and are easily destroyed.

What I need is for the fortifications and villages to be placed on the deployment area edge, where the AI's troops are!

I have examined the scripts and I cannot find what I need to alter this behaviour, everything I try has no affect at all.

So can anyone take a look at these scripts for me to solve this problem?

Cheers

Paul
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.

Field of Glory II Medieval Scenario Designer.

FOGII TT Mod Creator

Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
rico21
Staff Sergeant - StuG IIIF
Staff Sergeant - StuG IIIF
Posts: 272
Joined: Mon Nov 07, 2016 5:38 pm

Re: Scripting Help needed for Desert Campaign mod

Post by rico21 »

I don't understand everything about the skirmish script but if I coded myself,

if (GetTileCoverFlag (x, y) == 1)
{
AddUnit (x, y, 1, "afrika_korps_mg34")
SetUnitTurnToFace (GetUnitOnTile (x, y), x, y-1);
}

I will check this;

// return the cover flag for a tile. 1 set means can be hidden in
GetTileCoverFlag (x, y)
// return the LOS value of a tile. 0 = hidden, 1 = shown, 2 = cover
GetTileLOS (x, y, side)
// get the terrain cover value for the given x, y
Get TerrainCoverValue (x, y, index)
// get the terrain cover value for the given x, y, based on side's LOS to the tile
Get TerrainCoverValueFromLOS (x, y, index, side)

because in my scripted scenarios, I use the value of the "cover" to hide my units.
Paul59
General - King Tiger
General - King Tiger
Posts: 3859
Joined: Tue Jul 21, 2015 11:26 pm

Re: Scripting Help needed for Desert Campaign mod

Post by Paul59 »

rico21 wrote: Mon Apr 06, 2020 8:45 am I don't understand everything about the skirmish script but if I coded myself,

if (GetTileCoverFlag (x, y) == 1)
{
AddUnit (x, y, 1, "afrika_korps_mg34")
SetUnitTurnToFace (GetUnitOnTile (x, y), x, y-1);
}

I will check this;

// return the cover flag for a tile. 1 set means can be hidden in
GetTileCoverFlag (x, y)
// return the LOS value of a tile. 0 = hidden, 1 = shown, 2 = cover
GetTileLOS (x, y, side)
// get the terrain cover value for the given x, y
Get TerrainCoverValue (x, y, index)
// get the terrain cover value for the given x, y, based on side's LOS to the tile
Get TerrainCoverValueFromLOS (x, y, index, side)

because in my scripted scenarios, I use the value of the "cover" to hide my units.
Thanks Rico,

But unfortunately I don't think that is much help. The Random Skirmish scripts don't specify what units are going to be used, it just selects anything that is available in the Squads.csv.

As far as I can tell the scripts that control the Random Skirmish unit and terrain selection are these:

MapGenerate2.BSF
MapGenerateWild2.BSF
Slith_RandomMap2.BSF

Note that there are other .BSF files for City and Farm terrain, but because of the greater amount of cover on those maps they do not have the same problem. I am using the Wild (Wilderness) terrain to represent desert.

In MapGenerateWild2.BSF there is this function that seems to control where the bases (I think by "Bases" it means fortifications and villages) are placed :

stepX = (width - 34) / controlled ;
stepY = (height - 34) / 4 ;
if (stepY > 12) // on long maps, keep bases close to ends
{
stepY = 12 ;
}

But changing the values has no affect.

cheers

Paul
Last edited by Paul59 on Mon Apr 06, 2020 2:52 pm, edited 1 time in total.
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.

Field of Glory II Medieval Scenario Designer.

FOGII TT Mod Creator

Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
rico21
Staff Sergeant - StuG IIIF
Staff Sergeant - StuG IIIF
Posts: 272
Joined: Mon Nov 07, 2016 5:38 pm

Re: Scripting Help needed for Desert Campaign mod

Post by rico21 »

I know that certain fortifications on certain grounds do not work.
Especially the sandbags.
You should try Russian-style fortifications to see if the problem persists.
Eagletanker
Sergeant - Panzer IIC
Sergeant - Panzer IIC
Posts: 197
Joined: Sat Apr 15, 2017 3:30 pm

Re: Scripting Help needed for Desert Campaign mod

Post by Eagletanker »

I am not good with scripting, but could you try and edit it to where you have it where the AI just has the baseline for deployment? It’s a temporary solution that isn’t very good, but it should work.
Paul59
General - King Tiger
General - King Tiger
Posts: 3859
Joined: Tue Jul 21, 2015 11:26 pm

Re: Scripting Help needed for Desert Campaign mod

Post by Paul59 »

TankerOne wrote: Fri Apr 10, 2020 4:36 am I am not good with scripting, but could you try and edit it to where you have it where the AI just has the baseline for deployment? It’s a temporary solution that isn’t very good, but it should work.
Unfortunately those scripts are equally as hard to find. I think they might be in the MapGenerate2.BSF file, but that won't help us at all, because that governs the unit placement on all maps, and I only want to change the deployment (or fortifications) for the Desert maps. The Urban and Farmland maps do not have the same problem because they have a lot more cover for the AI.

It was a good suggestion though. It might be some lateral thinking like that which eventually provides a solution.
Field of Glory II Scenario Designer - Age of Belisarius, Rise of Persia, Wolves at the Gate and Swifter than Eagles.

Field of Glory II Medieval Scenario Designer.

FOGII TT Mod Creator

Warhammer 40,000: Sanctus Reach Tournament Scenario Designer.
Post Reply

Return to “Battle Academy 2 – Eastern Front”