More Modding Questions
Moderator: rbodleyscott
More Modding Questions
How do I mod the game to lessen the chances for the general to die in battle?
I want to make melees to last longer by making all units more resilient in melee and/or making the units inflict less
casualties in melee. How can I do this please?
How can I mod the game so units fragment less or lose cohesion less on first impact?
I want to make units react more to their own units breaking, by increasing the chances of damage being done to their
morale and widen the scope of the impact of breaking units to impact more units around them.
Is it possible to add the banners of allies in battle. So that units of allies don't fight under the main army banner?
If I wanted to make terrain and foliage to reflect spring or autumn in northern lands, is it possible to add them in the
game and as a choice for a terrain for a custom battle?
Thank you for any help
I want to make melees to last longer by making all units more resilient in melee and/or making the units inflict less
casualties in melee. How can I do this please?
How can I mod the game so units fragment less or lose cohesion less on first impact?
I want to make units react more to their own units breaking, by increasing the chances of damage being done to their
morale and widen the scope of the impact of breaking units to impact more units around them.
Is it possible to add the banners of allies in battle. So that units of allies don't fight under the main army banner?
If I wanted to make terrain and foliage to reflect spring or autumn in northern lands, is it possible to add them in the
game and as a choice for a terrain for a custom battle?
Thank you for any help
-
- Field of Glory 2
- Posts: 28260
- Joined: Sun Dec 04, 2005 6:25 pm
Re: More Modding Questions
Alter the numbers in
FUNCTION TestForGeneralLost(me, loser, pursuit, notional_turn)
in GeneralTools.BSF
Reduce the value inI want to make melees to last longer by making all units more resilient in melee and/or making the units inflict less casualties in melee. How can I do this please?
damage = 50; // Basic damage inflicted by a UnitSize 6 unit in terms of % of a UnitSize point. This may need tweaking to allow for multiple rounding down errors.
in
FUNCTION ModifiedCloseCombatDamage(me, enemy, EffectiveSize, POA, moraleModifier, attacking, test)
in
CloseCombatLogic.BSF
This should affect both close combat casualties and reduce morale tests.
You can reduce the chance of double drops greatly by changing the 3 to a 2 inHow can I mod the game so units fragment less or lose cohesion less on first impact?
if ((score < 3) && (reason != 0)) // Double drop if score low enough and not testing for being shot at
in
FUNCTION CohesionTest(me, enemy, reason, combatLog, shot, notional_turn, fullReason)
in
MoraleTools.BSF
You could change the distance values inI want to make units react more to their own units breaking, by increasing the chances of damage being done to their morale and widen the scope of the impact of breaking units to impact more units around them.
SetProximityMoraleFlags(router)
in
MoraleTools.BSF to widen the scope.
To increase the chance of failing you would need to add an additional modifier in
FUNCTION CohesionTest(me, enemy, reason, combatLog, shot, notional_turn, fullReason)
if (fullReason == 6)
No, otherwise we would already have done it. The engine only allows each side to have one banner.Is it possible to add the banners of allies in battle. So that units of allies don't fight under the main army banner?
It should be, but there no simple fix like the above. It would require many changes in many places.If I wanted to make terrain and foliage to reflect spring or autumn in northern lands, is it possible to add them in the game and as a choice for a terrain for a custom battle?
Take a look at the stuff in the
/Data/objects
and
/Data/TILES
folders.
Also the
FUNCTION GetTerrain(type)
and you would need to add a bunch of strings and modify the UI to show your alternative map types.
Richard Bodley Scott


Re: More Modding Questions
Thank you for so much for your help and taking your time to answer my questions.
I have come up with more questions to nag you with.
How do I decrease the chances of the AI using flank march or to make the flank march units appear more quickly?
How do I shorten the time cavalry pursue routed units?
Is their any way to change the AI so it does not counter flanking units by moving way more units than is necessary to counter them with and then chasing after them? It so easy to fool the AI by letting it chase after flanking units with a much bigger
force, which weakens the Ai front line. Also the AI has a habit of leaving gaps in the front line than can exploited for usually only one round, but even so it weakens the AI unit which is so unnecessary.
Thank you again
I have come up with more questions to nag you with.
How do I decrease the chances of the AI using flank march or to make the flank march units appear more quickly?
How do I shorten the time cavalry pursue routed units?
Is their any way to change the AI so it does not counter flanking units by moving way more units than is necessary to counter them with and then chasing after them? It so easy to fool the AI by letting it chase after flanking units with a much bigger
force, which weakens the Ai front line. Also the AI has a habit of leaving gaps in the front line than can exploited for usually only one round, but even so it weakens the AI unit which is so unnecessary.
Thank you again
-
- Field of Glory 2
- Posts: 28260
- Joined: Sun Dec 04, 2005 6:25 pm
Re: More Modding Questions
In
FUNCTION SequesterOffMapUnits(side)
in
MoreScenarioTools.bsf
you will find a section of code reading:
Code: Select all
// Side 1 can send a flank march in Open Battle (if NOT overconfident), Reinforcements (Own) or (player) Flank March scenario.
if ((scenarioType == 0) || (scenarioType == 2) || (scenarioType == 3)) // vM1.4.0 change - for clarity and ease of searching
{
if ((Rand(1,100) <= 10) && (IsMultiplayer() == 0)) // Fairly small chance of flank march - may need tweaking. No chance in Multiplayer.
{
SequesterFlankMarch(side, SkewedRandom(10, 25, 2));
}
}
Code: Select all
(Rand(1,100) <= 10)
Richard Bodley Scott


-
- Field of Glory 2
- Posts: 28260
- Joined: Sun Dec 04, 2005 6:25 pm
Re: More Modding Questions
In
FUNCTION CheckForSkirmishFlankMarch(side)
in
MoreScenarioTools.BSF
there is a section of code:
Code: Select all
deadline = GetUniversalVar("ScenarioDeadline") / 2;
min = (deadline / 4); // May need tweaking
max = (deadline / 3); // May need tweaking
Richard Bodley Scott


-
- Field of Glory 2
- Posts: 28260
- Joined: Sun Dec 04, 2005 6:25 pm
Re: More Modding Questions
In
FUNCTION WillUnitPursue(me, enemy, type)
in
CombatTools.bsf
you will find
Code: Select all
if (type > 0)
{
stopChance = 50; // May need tweaking
// Foot won't continue to pursue mounted and will rarely continue to pursue at all
if (IsFoot(me) == 1)
{
if (IsMounted(enemy) == 1)
{
stopChance = 100; // May need tweaking
}
else
{
stopChance = 75; // May need tweaking
}
}
// Knights tend to keep pursuing
if (IsUnitSquadType(me, "Knights") == 1)
{
// stopChance = 25; // May need tweaking
stopChance = 40; // May need tweaking // v1.7.4 change
}
}
Code: Select all
stopChance = 50;
For knights, increase the value in
Code: Select all
stopChance = 40;
Richard Bodley Scott


-
- Field of Glory 2
- Posts: 28260
- Joined: Sun Dec 04, 2005 6:25 pm
Re: More Modding Questions
If you discover a way to do this, please let me know.Mav01 wrote: ↑Sat Mar 08, 2025 11:42 am Is their any way to change the AI so it does not counter flanking units by moving way more units than is necessary to counter them with and then chasing after them? It so easy to fool the AI by letting it chase after flanking units with a much bigger force, which weakens the Ai front line.
Likewise.Also the AI has a habit of leaving gaps in the front line than can exploited for usually only one round, but even so it weakens the AI unit which is so unnecessary.
Richard Bodley Scott


Re: More Modding Questions
Well if bigger brains like you and others can't work it out, then I have no chance.
Is it possible to change daylight in a custom battle, So the daylight changes from dusk to dawn as the battle progresses?
Here is a cheeky question.
Are the team going to create a future field of glory II game set in the flintlock musket era?
Thank you for your help
Is it possible to change daylight in a custom battle, So the daylight changes from dusk to dawn as the battle progresses?
Here is a cheeky question.
Are the team going to create a future field of glory II game set in the flintlock musket era?
Thank you for your help
Re: More Modding Questions
How do I increase armour protection against ranged weapons?
-
- Field of Glory 2
- Posts: 28260
- Joined: Sun Dec 04, 2005 6:25 pm
Re: More Modding Questions
Yes, but you would need lighting files for each stage, then all you have to do in your scenario script is specify on which turns the lighting files switch.
Using
SetLightingFile(lightFile);
e.g.
SetLightingFile("default_night");
Richard Bodley Scott


-
- Field of Glory 2
- Posts: 28260
- Joined: Sun Dec 04, 2005 6:25 pm
Re: More Modding Questions
You would need to mod
FUNCTION GetShootingWeaponModifier(me, target, distance, volley, test, print)
in
CombatTools.BSF
Unfortunately, each weapon type has its own armour code - because some weapons are better against armour than others. So you would need to alter the code for each weapon type whose effect against armour you want to alter, and the code is fairly complicated.
Look for the sections of code starting
Code: Select all
effective_armour = bodyArmour;
Richard Bodley Scott


Re: More Modding Questions
Thank you so much Richard, you have constantly been helpful. The game is so great to be so moddable.
-
- General - Carrier
- Posts: 4621
- Joined: Mon Jun 03, 2019 4:17 pm
- Location: Stockholm, SWEDEN
Re: More Modding Questions
Interesting! Which file and which script would be the proper one to mod for this?rbodleyscott wrote: ↑Mon Mar 17, 2025 6:58 amYes, but you would need lighting files for each stage, then all you have to do in your scenario script is specify on which turns the lighting files switch.
Using
SetLightingFile(lightFile);
e.g.
SetLightingFile("default_night");
kronenblatt's campaign and tournament thread hub:
https://www.slitherine.com/forum/viewtopic.php?t=108643
https://www.slitherine.com/forum/viewtopic.php?t=108643
-
- Field of Glory 2
- Posts: 28260
- Joined: Sun Dec 04, 2005 6:25 pm
Re: More Modding Questions
The lighting files are text files in /Data/Lightingkronenblatt wrote: ↑Wed Apr 09, 2025 4:22 pmInteresting! Which file and which script would be the proper one to mod for this?rbodleyscott wrote: ↑Mon Mar 17, 2025 6:58 amYes, but you would need lighting files for each stage, then all you have to do in your scenario script is specify on which turns the lighting files switch.
Using
SetLightingFile(lightFile);
e.g.
SetLightingFile("default_night");
I have no idea how they work.
(Ignore the CLUT files, that system does not work.)
If you want to change the lighting in an editor-created scenario you need to use SetLightingFile("filename") in the scenario script, probably in the StartTurn() function.
Richard Bodley Scott


-
- General - Carrier
- Posts: 4621
- Joined: Mon Jun 03, 2019 4:17 pm
- Location: Stockholm, SWEDEN
Re: More Modding Questions
StartTurn() in Core.BSF? Because I'm not sure what you mean by "scenario script"? Would this be implementable in a Custom Battles campaign, for example? And if yes, how?rbodleyscott wrote: ↑Wed Apr 09, 2025 5:06 pm If you want to change the lighting in an editor-created scenario you need to use SetLightingFile("filename") in the scenario script, probably in the StartTurn() function.
kronenblatt's campaign and tournament thread hub:
https://www.slitherine.com/forum/viewtopic.php?t=108643
https://www.slitherine.com/forum/viewtopic.php?t=108643
-
- Field of Glory 2
- Posts: 28260
- Joined: Sun Dec 04, 2005 6:25 pm
Re: More Modding Questions
I meant in the secnario script - which is how the "epic battles" work. Each one has a scenario script.kronenblatt wrote: ↑Wed Apr 09, 2025 5:20 pmStartTurn() in Core.BSF? Because I'm not sure what you mean by "scenario script"? Would this be implementable in a Custom Battles campaign, for example? And if yes, how?rbodleyscott wrote: ↑Wed Apr 09, 2025 5:06 pm If you want to change the lighting in an editor-created scenario you need to use SetLightingFile("filename") in the scenario script, probably in the StartTurn() function.
As for doing it for Custom Battles, that would be different as there are no scenario scripts. What exactly are you trying to achieve?
Richard Bodley Scott


-
- General - Carrier
- Posts: 4621
- Joined: Mon Jun 03, 2019 4:17 pm
- Location: Stockholm, SWEDEN
Re: More Modding Questions
The light of each Custom Battle to change from dawn to dusk and ultimately night, as turns pass. Along the lines of what you wrote above: ”specify on which turns the lighting files switch.”rbodleyscott wrote: ↑Thu Apr 10, 2025 6:32 amI meant in the secnario script - which is how the "epic battles" work. Each one has a scenario script.kronenblatt wrote: ↑Wed Apr 09, 2025 5:20 pmStartTurn() in Core.BSF? Because I'm not sure what you mean by "scenario script"? Would this be implementable in a Custom Battles campaign, for example? And if yes, how?rbodleyscott wrote: ↑Wed Apr 09, 2025 5:06 pm If you want to change the lighting in an editor-created scenario you need to use SetLightingFile("filename") in the scenario script, probably in the StartTurn() function.
As for doing it for Custom Battles, that would be different as there are no scenario scripts. What exactly are you trying to achieve?
kronenblatt's campaign and tournament thread hub:
https://www.slitherine.com/forum/viewtopic.php?t=108643
https://www.slitherine.com/forum/viewtopic.php?t=108643
-
- Field of Glory 2
- Posts: 28260
- Joined: Sun Dec 04, 2005 6:25 pm
-
- Field of Glory 2
- Posts: 28260
- Joined: Sun Dec 04, 2005 6:25 pm
Re: More Modding Questions
Core.bsf cannot be safely modded. The engine will ignore any version in a mod folder.
You should be able to put the code in StartTurn.BSF in \Data\Battle\Scripts
Try putting the code immediately after
before
e.g.
Or something like that. Night will automatically be set at the end of the battle by the existing code.
I am not entirely sure how that will interact with the default code, which sets daylight to daylight at the start of the battle and night at the end.
But it may well work. But sSeems a lot of work for minor cosmetic benefit.
You should be able to put the code in StartTurn.BSF in \Data\Battle\Scripts
Try putting the code immediately after
Code: Select all
// Reset Undo variables to current unit position (Do this last so starting AP is correct)
ResetUndoPosition(me);
Code: Select all
}
}
Code: Select all
// Reset Undo variables to current unit position (Do this last so starting AP is correct)
ResetUndoPosition(me);
if ((GetTurn() >= -1) && (GetTurn() < 4))
{
SetLightingFile("NorthernEurope_Dawn");
}
if ((GetTurn() >= 4) && (GetTurn() < 44))
{
SetLightingFile("NorthernEurope_DayLight");
}
if (GetTurn() >= 44)
{
SetLightingFile("NorthernEurope_Sunset");
}
}
}
I am not entirely sure how that will interact with the default code, which sets daylight to daylight at the start of the battle and night at the end.
But it may well work. But sSeems a lot of work for minor cosmetic benefit.
Richard Bodley Scott


-
- General - Carrier
- Posts: 4621
- Joined: Mon Jun 03, 2019 4:17 pm
- Location: Stockholm, SWEDEN
Re: More Modding Questions
Hey, never thought you were afraid of work...rbodleyscott wrote: ↑Thu Apr 10, 2025 9:28 am ...
Seems a lot of work for minor cosmetic benefit.
...

Thanks for suggested syntax, I'll give it or something similar a try and post here what works and not, for the benefit of other modders.
kronenblatt's campaign and tournament thread hub:
https://www.slitherine.com/forum/viewtopic.php?t=108643
https://www.slitherine.com/forum/viewtopic.php?t=108643