Page 1 of 1

Modding shooting range

Posted: Sun Apr 17, 2022 8:54 am
by Lysimachos
Hi guys,
I was thinking about modding the shooting range of horse archers from 2 to 3 squares.
It shouldn't be much complicated but I don't know in which file I have to work in order to modify this parameter.
Is there anyone out here able to give me an hint?

Thank's a lot for any reply and Good Easter everybody!

Re: Modding shooting range

Posted: Sun Apr 17, 2022 9:50 am
by Cronos09
Lysimachos wrote: Sun Apr 17, 2022 8:54 am Hi guys,
I was thinking about modding the shooting range of horse archers from 2 to 3 squares.
It shouldn't be much complicated but I don't know in which file I have to work in order to modify this parameter.
Is there anyone out here able to give me an hint?

Thank's a lot for any reply and Good Easter everybody!
Greeting to Alexander the Great's Diadochos :)
CombatTools.BSF, FUNCTION MaximumRange(me), next script block:

Code: Select all

//	if ((GetAttrib(me, "Bow") > 0) || (GetAttrib(me, "Crossbow") > 0))
	if ((GetAttrib(me, "Bow") > 0) || (GetAttrib(me, "Longbow") > 0) || (GetAttrib(me, "Crossbow") > 0)) //v1.3.0
		{
			if (IsMounted(me) == 1)
				{
					range = 2;
				}
			else
				{
					range = 4;
				}
You need to change range=2 to range=3. In this case, the maximum losses will be caused by shooting up to 2 tiles inclusive and on 3 tiles with a reduced effect.
And do not change the main game folder!
PS. You should also to add FUNCTION IsLongRange(me, target) - comment out like this

Code: Select all

		//	if (IsFoot(me) == 1)
			//	{
					if (distance > 2)
						{
							ret = 1;
						}
			//	}
FUNCTION GetShootingWeaponModifier(me, target, distance, volley, test, print)

Code: Select all

	// Bow (Foot or Mounted)
	percent = GetAttrib(me, "Bow");
	if (percent > 20) // Stop Late Romans long distance shooting
		{
			any_shooters = 1;
			if (IsMounted(me) == 1)
				{
					range = 2;
				}
			else
				{
					range = 4;
				}
change range = 2 to range = 3 and the same for Crossbow below in this function.

Re: Modding shooting range

Posted: Mon Apr 18, 2022 9:28 am
by Lysimachos
Thank's mate, you've been really clear.

I didn't imagine it could be so complex! :D

Re: Modding shooting range

Posted: Mon Apr 18, 2022 9:53 am
by Lysimachos
And what about improving the horse archers ammunitions from 5 to 6 or 7 turns?

I think there should be a way also to do this!! :wink:

As you can imagine I'm feeling as this kind of unit is quite underrepresented in its strength now ...

Re: Modding shooting range

Posted: Mon Apr 18, 2022 12:00 pm
by Cronos09
Lysimachos wrote: Mon Apr 18, 2022 9:53 am And what about improving the horse archers ammunitions from 5 to 6 or 7 turns?

I think there should be a way also to do this!! :wink:

As you can imagine I'm feeling as this kind of unit is quite underrepresented in its strength now ...
There are a few ways to do so:
1) If you wish to increase the ammunition for all units - copy Macros.BSF to your module folder

Code: Select all

#define FULL_EFFECT_SHOTS 10 // Number of shots before ammunition is low. (Number of turns of full effect shooting will be half this as there are 2 shots per turn of shooting)
10 corresponds to 5 original turns, 12 will correspond to 6 turns, 14 - to 7 turns etc.
2) If you only wish to do so for horse archers and you are creating a custom historical battle - (Your scenario name).BSF

Code: Select all

FUNCTION StartTurn(side)
{
int id;
int i;
	
...
	
	if (GetTurn() == 0) // Increase horse archers full ammunition 
    {    
			for (i = 0; i < GetUnitCount(side); i++)
			{
				id = GetUnitID(side,i);
				if (id != -1)
					{					
						if ((IsMounted(id) == 1) && ((GetAttrib(id, "Bow") == 100) || (GetAttrib(id, "Crossbow") == 100)))
			                { 
			                   SetAttrib(id, "TotalShots", -2); 
			                } 				
					}
			}     
		               
    }	
side: 0 or 1,
In the line SetAttrib(id, "TotalShots", -2); you can change the number -2 (6 full ammo turns), -4 (7 full ammo turns) etc
For an example see Crecy_E.BSF from Storm of Arrows FoG Medieval.

Re: Modding shooting range

Posted: Mon Apr 18, 2022 8:46 pm
by Lysimachos
Thank's Cronos, you're precious! :D :D :D