Page 1 of 1

Enhanced artillery fire power

Posted: Mon Nov 04, 2024 4:12 pm
by Lysimachos
Hi guys!
Being working on an Age of Reason mod I would like to enhance a bit the power fire of artillery pieces.
I tried, very simply, to give the selected units a superior morale status but it doesn't seem to achieve nothing.
Has anyone some hints about haw to reach the desired effect?
Many thanks for your help!

Re: Enhanced artillery fire power

Posted: Sat Nov 09, 2024 10:29 am
by Athos1660
I could have answered you a few years ago when I played with modding P&S. Unfortunately, I don't remember.

Maybe, before looking at the Scripts files, you could try to modify the squads file comparing it with what have already been done (ie. modded squads files), if you haven't done it yet :
1) Download, for example, Cronos' mod : https://www.slitherine.com/forum/viewtopic.php?t=110276
2) Open squads.csv both in your Vanilla P&S folder (in your steamapps if you use Steam) and in Cronos' mod.
3) Also open squads.xlsx in your Vanilla P&S folder
4) Compare a type of artillery in both squads.csv files. For example :

In the mod :
Saxon_Heavy_Cannon1,142,Allies,1,Artillery,Artillery,1,60,25,200,20,36,0,1,6,400,1,0,saxon_h_artillery,100,0,1,0,0,0,-1,1,0,200,100,200,0,100,100,0,0,100,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,,0,0,0,100,,,-1,6900,1,-100,1,100,,,0

In P&S :
Red_Heavy_Guns,22,Axis,2,Artillery,Artillery,1,60,25,200,20,50,0,1,0,0,1,0,Heavy_Guns,100,0,1,0,0,0,0,0,0,0,0,0,-1,1,-2,0,0,0,0,0,0,200,100,200,0,100,100,0,0,0,0,0,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,100,,,,

5) Look for numbers that are different in both lines
6) Look for what these numbers correspond in the squads.xlsx file to understand their use :
Image

For example :
- in the squads.xlsx file above, column AH is 'bombard_shots'
- in P&S : -2
- in the mod : 100 (if I am not mistaken)

7) Make modifications, tests, tweak values...
The best for you about 'bombard_shots' may be -2 (as in Vanilla), 10, 50, 70, 100 (as in this mod), 200...

Hoping that it will help and that I don't say too much nonsense, it's been a long time since I didn't mod :-)

Hoping you'll get your way !

PS : first verifiy any changes of columns between the squads.csv in P&S and in FoG2, comparing the column headers in their Vanilla squads.xlsx (in your steamapps ?) (btw for this reason, my example about the AH column might be wrong).

Re: Enhanced artillery fire power

Posted: Sat Nov 09, 2024 1:37 pm
by Paul59
Lysimachos wrote: Mon Nov 04, 2024 4:12 pm Hi guys!
Being working on an Age of Reason mod I would like to enhance a bit the power fire of artillery pieces.
I tried, very simply, to give the selected units a superior morale status but it doesn't seem to achieve nothing.
Has anyone some hints about haw to reach the desired effect?
Many thanks for your help!

You would need to change the artillery POA values in the scripts, possibly in CombatTools.bsf. There is nothing in the Squads.csv that would change their effectiveness.

Re: Enhanced artillery fire power

Posted: Sat Nov 09, 2024 2:22 pm
by Athos1660
Image

Re: Enhanced artillery fire power

Posted: Sun Nov 10, 2024 9:26 am
by Lysimachos
Thank's guys for the hints!
I'm going to have a look at the CombatTools.bsf. :)

Re: Enhanced artillery fire power

Posted: Tue Nov 12, 2024 9:00 am
by Cronos09
Lysimachos wrote: Mon Nov 04, 2024 4:12 pm Hi guys!
Being working on an Age of Reason mod I would like to enhance a bit the power fire of artillery pieces.
I tried, very simply, to give the selected units a superior morale status but it doesn't seem to achieve nothing.
Has anyone some hints about haw to reach the desired effect?
Many thanks for your help!
You can change artillery firepower in Shooting_Logic.BSF. An example from my mod (where I added more powerful artillery canister shots, when the distance is 4 tiles or less):

// Artillery more random than other types - but high damage hits less frequent than low damage hits
if ((IsUnitSquadType(me, "Artillery") == 1) || (IsUnitSquadType(me, "Light_Artillery") == 1))
{
if (distance > 4)
{
skew_type = 2;
minDam = 0;
maxDam = base_damage * 3;
}
else
{
skew_type = 1;
minDam = base_damage * 2;
maxDam = base_damage * 4;
}
}
else
{
skew_type = 1;
minDam = base_damage / 2;
maxDam = base_damage * 3;
maxDam /= 2;
}

Re: Enhanced artillery fire power

Posted: Tue Nov 12, 2024 10:23 pm
by Lysimachos
Really interesting stuff, Cronos, I'll take care of the great tip! (hoping to release soon a first little version of the mod I'm working on)

Re: Enhanced artillery fire power

Posted: Sat Jan 11, 2025 8:02 pm
by Lysimachos
I've tried to work on the Shooting_Logic.BSF file but I'm not really happy of the results.
Probably I miss something.

First of all I don't understand what the skew_type definition refers to.
Secondly, it seems to me that augmenting the numbers in the minDam and maxDam column should enhance the chance of making casaulties but it doesn't seem to have a real impact because in many occasion the gun shot is completely useless and no one is killed ...

Is there anyone that can explain a bit how the file really works?

Thanks for any hint

Re: Enhanced artillery fire power

Posted: Sun Jan 12, 2025 6:07 pm
by Cronos09
Lysimachos wrote: Sat Jan 11, 2025 8:02 pm First of all I don't understand what the skew_type definition refers to.
There is the FUNCTION SkewedRandom(min, max, skew_type) in Tools.BSF - all skew types are described in comments:

Code: Select all

// Returns skewed randomly generated number.
FUNCTION SkewedRandom(min, max, skew_type)
{
int result;
int randomizer;
int difference;

	if (skew_type == 0) // Uniform distribution
		{
			result = Rand(min,max);
		}

	if (skew_type == 1) // Bell-shaped distribution
		{
			result = Rand(min,max) + Rand(min,max);
			result /= 2;
		}

	if (skew_type == 2) // Left skew (low values predominant)
		{
			// This version is equivalent to (Rand(0, max - min) ^ 2) / ((max - min) ^ 1) + min.
			// It gives an average value of approximately 2/3 of the average of a non-skewed range.

			difference = max - min;
			result = Rand(0, difference);
			result *= result;
			result /= difference;
			result += min;
		}

	if (skew_type == 3) // Right skew (high values predominant)
		{
			// Not yet implemented.
			Log ("Skew Type 3 not yet implemented");
			result = Rand(min,max); // To avoid crashing if it is attempted to be used.
		}

return result;
}
If you pointed minDam > 0 for your artillery (as I wrote in my previous post) you will always kill more than nill on your turn.

Re: Enhanced artillery fire power

Posted: Thu Jan 16, 2025 3:39 pm
by Lysimachos
Thanks mate for the further explanation.

It seems to me that now I'm (hopefully) beginning to better understand the mechanism involved in the script.

Will make some trials and then I'll report the results!

Re: Enhanced artillery fire power

Posted: Sun Jan 19, 2025 10:46 am
by Lysimachos
At the moment it seems I've obtained good results for a more impressive gun fire (no 0 casualties reports, damages generally between 10 and 25 and some provoked disruptions) inserting the skew_type=0 as follows:

// Artillery more random than other types - but high damage hits less frequent than low damage hits
if ((IsUnitSquadType(me, "Artillery") == 1) || (IsUnitSquadType(me, "Light_Artillery") == 1))

{
skew_type = 0;
minDam = base_damage / 2;
maxDam = base_damage * 3;
}
else
{
skew_type = 1;
minDam = base_damage / 2;
maxDam = base_damage * 3;
maxDam /= 2;
}
if ((print == 1) && (printPOAs == 0))
{