Frequency of Winters?

Moderator: Pocus

Post Reply
kronenblatt
Major - 8.8 cm FlaK 36
Major - 8.8 cm FlaK 36
Posts: 969
Joined: Mon Jun 03, 2019 4:17 pm
Location: Stockholm, SWEDEN

Frequency of Winters?

Post by kronenblatt » Tue Jul 28, 2020 4:47 pm

Is it possible to mod whether 'winter' sets in during a specific year? E.g., through setting gTurnInfos.winterFreq = 0 in SCENARIO.BSF, but as part of every turn let the value of gTurnInfos.winterFreq be determined randomly as part of a new event.

To me, it's slightly too predictable with harsh winters every four years... :)

Code: Select all

int winter_year
winter_year = Rand(1;100);
if ( winter_year <= 25 )
{
gTurnInfos.winterFreq = 1; // how often there is a winter turn 0: never, 1: always, 2: every other turn, etc.
}
else
{
gTurnInfos.winterFreq = 0; // how often there is a winter turn 0: never, 1: always, 2: every other turn, etc.
}
Arranging the The Year of Many Emperors (TYME), Dividing the Spoils (DiSp), and The West is No More (TWiNM) tournaments for Field of Glory II!

kronenblatt
Major - 8.8 cm FlaK 36
Major - 8.8 cm FlaK 36
Posts: 969
Joined: Mon Jun 03, 2019 4:17 pm
Location: Stockholm, SWEDEN

Re: Frequency of Winters?

Post by kronenblatt » Wed Aug 05, 2020 1:54 pm

Yup, it works. Did the following (it's now in my Remote Regions mod, in a version yet unpublished):

Code: Select all

FUNCTION Event_EntryPoint()
{
	EventCustom_RandomWeather()
}

FUNCTION EventCustom_RandomWeather()
{
	int winter_year;

	// IF ALREADY HARSH WEATHER, THEN 33% (25/75) OF CONTINUED HARSH WEATHER, OTHERWISE 25% (25/100)
	if ( gTurnInfos.winterFreq == 1 )
	{
		winter_year = Rand(1, 75);
	}
	else
	{
		winter_year = Rand(1, 100);	
	}

	if ( winter_year <= 25 )
	{
		gTurnInfos.winterFreq = 1; 
	}
	else
	{
		gTurnInfos.winterFreq = 0;
	}
}
Arranging the The Year of Many Emperors (TYME), Dividing the Spoils (DiSp), and The West is No More (TWiNM) tournaments for Field of Glory II!

Pocus
Ageod
Ageod
Posts: 2679
Joined: Tue Oct 02, 2012 3:05 pm

Re: Frequency of Winters?

Post by Pocus » Thu Aug 27, 2020 9:43 am

This was clearly an abstraction, to introduce some seasonality in turns spanning one full year. But glad you achieved what you desired.
AGEOD Team - Makers of Empires, ACW2, WON, EAW, PON, AJE, RUS, ROP, WIA.

nikossaiz
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 38
Joined: Tue Sep 01, 2020 9:26 am

Re: Frequency of Winters?

Post by nikossaiz » Tue Oct 27, 2020 7:04 pm

please note that the winter mod adds a random element (25% chance of harsh weather next turn if not harsh weather this turn, 33% if already harsh weather this turn) to whether harsh weather actually occurs that turn or not. So it's not that "winter" occurs always or never.)
i post here to keep cohesion of the mods' posts.

so to clarify, a percentage ( chance ) to have winter has all the parts of a province that winter can occur? ( hopefully no winter in desert :) so it is not possible to have a warning like "the next year weather will be harsh" on the vanilla base game.

great, ill be waiting for your reply. "remote regions" will be a grandier mod or is just a project?

kronenblatt
Major - 8.8 cm FlaK 36
Major - 8.8 cm FlaK 36
Posts: 969
Joined: Mon Jun 03, 2019 4:17 pm
Location: Stockholm, SWEDEN

Re: Frequency of Winters?

Post by kronenblatt » Sun Nov 01, 2020 5:31 pm

nikossaiz wrote:
Tue Oct 27, 2020 7:04 pm
please note that the winter mod adds a random element (25% chance of harsh weather next turn if not harsh weather this turn, 33% if already harsh weather this turn) to whether harsh weather actually occurs that turn or not. So it's not that "winter" occurs always or never.)
i post here to keep cohesion of the mods' posts.

so to clarify, a percentage ( chance ) to have winter has all the parts of a province that winter can occur? ( hopefully no winter in desert :) so it is not possible to have a warning like "the next year weather will be harsh" on the vanilla base game.

great, ill be waiting for your reply. "remote regions" will be a grandier mod or is just a project?
No difference to vanilla in that sense. That is, instead of "winter" (or harsh weather) always occurring every four years, this mod has a random element with a probability of harsh weather occurring a certain year 25% (if not harsh weather the previous year) or 33% (if harsh weather the previous year). Nothing more than that.
Arranging the The Year of Many Emperors (TYME), Dividing the Spoils (DiSp), and The West is No More (TWiNM) tournaments for Field of Glory II!

kronenblatt
Major - 8.8 cm FlaK 36
Major - 8.8 cm FlaK 36
Posts: 969
Joined: Mon Jun 03, 2019 4:17 pm
Location: Stockholm, SWEDEN

Re: Frequency of Winters?

Post by kronenblatt » Sun Nov 01, 2020 5:33 pm

nikossaiz wrote:
Tue Oct 27, 2020 7:04 pm
"remote regions" will be a grandier mod or is just a project?
The Remote Regions mod is finalised, but I'm looking at bundling "all" my three mods together into one (since I like them myself :) ).
Arranging the The Year of Many Emperors (TYME), Dividing the Spoils (DiSp), and The West is No More (TWiNM) tournaments for Field of Glory II!

nikossaiz
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 38
Joined: Tue Sep 01, 2020 9:26 am

Re: Frequency of Winters?

Post by nikossaiz » Mon Nov 02, 2020 9:44 am

The Remote Regions mod is finalised
so, what are the changes that this mod offer? more factions on the edge of the map? anyway, i like your other 2 mods ( still need to be told how to compine winter and alternative armies in order to use them both ) that is why the curiosity :)

nikossaiz
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 38
Joined: Tue Sep 01, 2020 9:26 am

Re: Frequency of Winters?

Post by nikossaiz » Thu Nov 26, 2020 1:31 pm

Hello kronenblatt, do you care explain me how to implement the weather mod on a scenario?

Post Reply

Return to “MOD”