Page 1 of 1
Scripting Help needed for Desert Campaign mod
Posted: Sun Apr 05, 2020 5:45 pm
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
Re: Scripting Help needed for Desert Campaign mod
Posted: Mon Apr 06, 2020 8:45 am
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.
Re: Scripting Help needed for Desert Campaign mod
Posted: Mon Apr 06, 2020 10:43 am
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
Re: Scripting Help needed for Desert Campaign mod
Posted: Mon Apr 06, 2020 1:53 pm
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.
Re: Scripting Help needed for Desert Campaign mod
Posted: Fri Apr 10, 2020 4:36 am
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.
Re: Scripting Help needed for Desert Campaign mod
Posted: Fri Apr 10, 2020 3:35 pm
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.