Frequency of Winters?

Moderator: Pocus

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

Frequency of Winters?

Post by kronenblatt »

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.
}
kronenblatt's campaign and tournament thread hub:

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

Re: Frequency of Winters?

Post by kronenblatt »

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;
	}
}
kronenblatt's campaign and tournament thread hub:

https://www.slitherine.com/forum/viewtopic.php?t=108643
Pocus
Ageod
Ageod
Posts: 7115
Joined: Tue Oct 02, 2012 3:05 pm

Re: Frequency of Winters?

Post by Pocus »

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 Kingdoms, Empires, ACW2, WON, EAW, PON, AJE, RUS, ROP, WIA.
nikossaiz
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 100
Joined: Tue Sep 01, 2020 9:26 am

Re: Frequency of Winters?

Post by nikossaiz »

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
General - Carrier
General - Carrier
Posts: 4691
Joined: Mon Jun 03, 2019 4:17 pm
Location: Stockholm, SWEDEN

Re: Frequency of Winters?

Post by kronenblatt »

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.
kronenblatt's campaign and tournament thread hub:

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

Re: Frequency of Winters?

Post by kronenblatt »

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 :) ).
kronenblatt's campaign and tournament thread hub:

https://www.slitherine.com/forum/viewtopic.php?t=108643
nikossaiz
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 100
Joined: Tue Sep 01, 2020 9:26 am

Re: Frequency of Winters?

Post by nikossaiz »

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
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 100
Joined: Tue Sep 01, 2020 9:26 am

Re: Frequency of Winters?

Post by nikossaiz »

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

Return to “MOD”