Page 1 of 1

Frequency of Winters?

Posted: Tue Jul 28, 2020 4:47 pm
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.
}

Re: Frequency of Winters?

Posted: Wed Aug 05, 2020 1:54 pm
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;
	}
}

Re: Frequency of Winters?

Posted: Thu Aug 27, 2020 9:43 am
by Pocus
This was clearly an abstraction, to introduce some seasonality in turns spanning one full year. But glad you achieved what you desired.

Re: Frequency of Winters?

Posted: Tue Oct 27, 2020 7:04 pm
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?

Re: Frequency of Winters?

Posted: Sun Nov 01, 2020 5:31 pm
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.

Re: Frequency of Winters?

Posted: Sun Nov 01, 2020 5:33 pm
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 :) ).

Re: Frequency of Winters?

Posted: Mon Nov 02, 2020 9:44 am
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 :)

Re: Frequency of Winters?

Posted: Thu Nov 26, 2020 1:31 pm
by nikossaiz
Hello kronenblatt, do you care explain me how to implement the weather mod on a scenario?