More Modding Questions

Moderator: rbodleyscott

kronenblatt
General - Carrier
General - Carrier
Posts: 4621
Joined: Mon Jun 03, 2019 4:17 pm
Location: Stockholm, SWEDEN

Re: More Modding Questions

Post by kronenblatt »

It worked fine. I did as follows.

In StartTurn.BSF file (under DATA\BATTLE\SCRIPTS\), I added a function:

Code: Select all

FUNCTION CustomStartBattleLighting()
{
	int turn;
	turn = GetTurn();
	if (turn < 6)
	{
		SetLightingFile("NorthernEurope_Dawn");
	}
	else if (turn < 10)
	{
		SetLightingFile("NorthernEurope_EarlyMorning");
	}
	else if (turn < 14)
	{
		SetLightingFile("NorthernEurope_MidMorning");
	}
	else if (turn < 40)
	{
		SetLightingFile("NorthernEurope_DayDull");
	}	
	else
	{
		SetLightingFile("NorthernEurope_Sunset");
	}
}
And also referred to it at the beginning of StartTurn() function, adding CustomStartBattleLighting(); :

Code: Select all

	if (GetWinner() == -1) // If game not already ended
		{
			// MODDED
			CustomStartBattleLighting();
Finally, to get the dawn light also when setting up the army, I also added a similar function in MoreScenarioTools.BSF file (under DATA\SCRIPTS\), just to try it out:

Code: Select all

FUNCTION ModdedRegionalDayLight()
{
	SetLightingFile("NorthernEurope_Dawn");
}
And called upon it at the beginning of the SetRegionalDaylight() function in the same file:

Code: Select all

FUNCTION SetRegionalDaylight()
{
	int deadline;
	
	// MODDED TO ADJUST DAY LIGHT
	ModdedRegionalDayLight();
	return;
Of course, more lighting files can be created and called upon, creating a more gradual sunrise and sunset. (There are as mentioned above more lighting files, such as EarlyMorning, MidMorning, and so on.)

I tried it out in Snugglebunnies' Middle Earth Mod and it looked particularly cool in the battles involving the evil side, e.g., Angmar, Orcs, Mordor. :twisted:
Last edited by kronenblatt on Sat Apr 12, 2025 10:09 am, edited 1 time in total.
kronenblatt's campaign and tournament thread hub:

https://www.slitherine.com/forum/viewtopic.php?t=108643
kronenblatt
General - Carrier
General - Carrier
Posts: 4621
Joined: Mon Jun 03, 2019 4:17 pm
Location: Stockholm, SWEDEN

Re: More Modding Questions

Post by kronenblatt »

NorthernEurope_Dawn
Image

NorthernEurope_EarlyMorning
Image

NorthernEurope_MidMorning
Image
kronenblatt's campaign and tournament thread hub:

https://www.slitherine.com/forum/viewtopic.php?t=108643
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28260
Joined: Sun Dec 04, 2005 6:25 pm

Re: More Modding Questions

Post by rbodleyscott »

Nice
Richard Bodley Scott

Image
toska
Master Sergeant - Bf 109E
Master Sergeant - Bf 109E
Posts: 482
Joined: Mon Jan 25, 2016 12:07 pm

Re: More Modding Questions

Post by toska »

Hello!

How can I force the machine to adopt a defensive stance in defensive battles (AI defends)?
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28260
Joined: Sun Dec 04, 2005 6:25 pm

Re: More Modding Questions

Post by rbodleyscott »

toska wrote: Fri May 16, 2025 12:35 pm Hello!

How can I force the machine to adopt a defensive stance in defensive battles (AI defends)?
I presume you mean in one where they are not defending field forticifations.

In that case they will tend to advance if they feel they have sufficient advtantage in infantry.

To stop them doing so would require modifications in AI_Masterplan() in AITools.BSf

There is a line that reads:

if ((OverconfidentAI() == 1) || (((ownArmyCavalry == 0) || (GetTurn() > 1) || (IsFortifiedSide(0) == 1)) && (((comparator > enemyPoints) && (credibleFrontalThreat == 1)) || (distance < 7) || ((ownArmyCavalry == 1) && ((GetTurn() > 1) || ((IsFortifiedSide(0) == 1)))) || (GetTeamActivationStage(1, 7) == 1) || (scenario == 8 )))) // vM1.4.0 change

You could try changing this to

if ((OverconfidentAI() == 1) || (((ownArmyCavalry == 0) || (GetTurn() > 1) || (IsFortifiedSide(0) == 1)) && (((comparator > enemyPoints) && (credibleFrontalThreat == 1) && (scenario!=9)) || (distance < 7) || ((ownArmyCavalry == 1) && ((GetTurn() > 1) || ((IsFortifiedSide(0) == 1)))) || (GetTeamActivationStage(1, 7) == 1) || (scenario == 8 )))) // vM1.4.0 change

No promises
Richard Bodley Scott

Image
Post Reply

Return to “Field of Glory II: Medieval - Modding”