DailyTick() event (which is for example used to update toops available to recruit in settlements, update recruitable prisoners, possibly troop wages too etc.) is configured in such a way that it fires in periods of 24 hours ingame time since last game load. Which means it can never fire if you save/load game in periods of less than 24h ingame time! And even in more typical scenario where you sometimes save/load more frequently (less than 24h since last saveload), and sometimes less frequently, the event will fire in much less occasions than expected from the flow of game time. Which may skew game balance (because some game logic expected to execute daily will execute more rarily) in player sessions (where players save/load frequently) vs what is expected from test sessions (where I quess developers run the game uninterrupted for longer periods).
The problem also applies with HourlyTick (which will fire 1h after game load) but it is not as visible because player is unlikely to save/load with less than 1h gametime in between.
But more importanly it also applies to WeeklyTick which is dependent on DailyTick, so if DailyTick doesn't fire, WeeklyTick won't either.
The problem appears to be caused by this method in MBCampaignEvent.cs :
(every variable is in hours, and curGameTime means elapsed hours since start of campaign)
This line:
this.NextTriggerTime = curGameTime + this.InitialWait;
causes the delay to always be 24h from game time at the moment of game load.
Instead the initialWait was probably meant to be delay from the start of the campaign, in which case the code probably should be:
var fullPeriodsSinceInitialWait = Math.Floor((curGameTime - initialWait) / triggerPeriod); // can be negative if still in initialWait
var nextFullPeriodNumber = Math.Max(0, periodsSinceInitialWait + 1);
this.NextTriggerTime = initialWait + nextFullPeriodNumber * triggerPeriod;
Game version for which I tested and examined the code: e1.2.1.
How to Reproduce: Load game, wait 24h -> event fires. Load game, wait 12h, save, load, wait 12h etc. -> event never fires.
Version: e1.2.1.
Installed community-made modifications: None
Computer Specs:
OS: Windows 7 64-bit
GPU: Nvidia GTX1060 6GB
CPU: Intel i7-7700K
RAM: 16GB
Motherboard: Asus Z270E
Storage Device (HDD/SSD): HDD
The problem also applies with HourlyTick (which will fire 1h after game load) but it is not as visible because player is unlikely to save/load with less than 1h gametime in between.
But more importanly it also applies to WeeklyTick which is dependent on DailyTick, so if DailyTick doesn't fire, WeeklyTick won't either.
The problem appears to be caused by this method in MBCampaignEvent.cs :
C#:
public MBCampaignEvent(float triggerPeriod, float initialWait, float curGameTime)
{
this.TriggerPeriod = triggerPeriod;
this.InitialWait = initialWait;
this.NextTriggerTime = curGameTime + this.InitialWait;
this.isEventDeleted = false;
}
(every variable is in hours, and curGameTime means elapsed hours since start of campaign)
This line:
this.NextTriggerTime = curGameTime + this.InitialWait;
causes the delay to always be 24h from game time at the moment of game load.
Instead the initialWait was probably meant to be delay from the start of the campaign, in which case the code probably should be:
var fullPeriodsSinceInitialWait = Math.Floor((curGameTime - initialWait) / triggerPeriod); // can be negative if still in initialWait
var nextFullPeriodNumber = Math.Max(0, periodsSinceInitialWait + 1);
this.NextTriggerTime = initialWait + nextFullPeriodNumber * triggerPeriod;
Game version for which I tested and examined the code: e1.2.1.
How to Reproduce: Load game, wait 24h -> event fires. Load game, wait 12h, save, load, wait 12h etc. -> event never fires.
Version: e1.2.1.
Installed community-made modifications: None
Computer Specs:
OS: Windows 7 64-bit
GPU: Nvidia GTX1060 6GB
CPU: Intel i7-7700K
RAM: 16GB
Motherboard: Asus Z270E
Storage Device (HDD/SSD): HDD
Last edited: