Modding shooting range

Post Reply
Lysimachos
Colonel - Fallschirmjäger
Colonel - Fallschirmjäger
Posts: 1415
Joined: Tue Dec 08, 2009 9:38 am
Location: Italy

Modding shooting range

Post 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!
"Audentis fortuna iuvat"
- Virgilius

(Good luck favours the brave)
Cronos09
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 326
Joined: Thu Feb 22, 2018 4:28 pm

Re: Modding shooting range

Post 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.
Lysimachos
Colonel - Fallschirmjäger
Colonel - Fallschirmjäger
Posts: 1415
Joined: Tue Dec 08, 2009 9:38 am
Location: Italy

Re: Modding shooting range

Post by Lysimachos »

Thank's mate, you've been really clear.

I didn't imagine it could be so complex! :D
"Audentis fortuna iuvat"
- Virgilius

(Good luck favours the brave)
Lysimachos
Colonel - Fallschirmjäger
Colonel - Fallschirmjäger
Posts: 1415
Joined: Tue Dec 08, 2009 9:38 am
Location: Italy

Re: Modding shooting range

Post 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 ...
"Audentis fortuna iuvat"
- Virgilius

(Good luck favours the brave)
Cronos09
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 326
Joined: Thu Feb 22, 2018 4:28 pm

Re: Modding shooting range

Post 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.
Lysimachos
Colonel - Fallschirmjäger
Colonel - Fallschirmjäger
Posts: 1415
Joined: Tue Dec 08, 2009 9:38 am
Location: Italy

Re: Modding shooting range

Post by Lysimachos »

Thank's Cronos, you're precious! :D :D :D
"Audentis fortuna iuvat"
- Virgilius

(Good luck favours the brave)
Post Reply

Return to “Field of Glory II: Modding”