Page 2 of 2

Re: More Modding Questions

Posted: Sat Apr 12, 2025 9:42 am
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:

Re: More Modding Questions

Posted: Sat Apr 12, 2025 10:07 am
by kronenblatt
NorthernEurope_Dawn
Image

NorthernEurope_EarlyMorning
Image

NorthernEurope_MidMorning
Image

Re: More Modding Questions

Posted: Sat Apr 12, 2025 2:57 pm
by rbodleyscott
Nice

Re: More Modding Questions

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

How can I force the machine to adopt a defensive stance in defensive battles (AI defends)?

Re: More Modding Questions

Posted: Sun May 18, 2025 4:27 pm
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

Re: More Modding Questions

Posted: Tue May 20, 2025 10:21 pm
by toska
It works! This should be in the base game so that battles where the AI ​​defends make sense.