Jump to content

Weather challenges break after reload


Narrnika

Recommended Posts

This is already a pretty old bug, but I finally found the time to figure out what was going on here. I checked it for “Winter is coming”, but most likely the same will be for other challenges.

When I start a new game - all right; when I exit from game (to desktop, or in main menu), and use "Continue" (last save) - all ok, too. But if I run “Winter is coming”-save via LoadGameScreen (Load - Select saved game - Play) then the winter breaks: the weather corresponds to usual summer weather in PZ.

I added print-markers to WinterIsComing.lua and found out that with the last option (Load menu), WinterIsComing.OnInitWorld function is not executed - which means that other functions that should work in WinterIsComing (OnGameStart, EveryDays, OnInitSeasons) will not be executed.

Ok, I won’t tell how I looked for the reason for this difference - it was cooler than any AAA-horror-game 😱 But in the end this block of code seemed critical to me:

-- MainScreen.lua, function MainScreen.continueLatestSave,from line 1384
for i,challenge in ipairs(LastStandChallenge) do
	if challenge.gameMode == gameMode then
		LastStandData.chosenChallenge = challenge
		doChallenge(challenge)
		getWorld():setWorld(saveName)
		MainScreen.instance:setDefaultSandboxVars()
		MainScreen.continueLatestSaveAux()
		return
	end
end

I added a similar code to the function for load menu:

-- LoadGameScreen.lua, function LoadGameScreen:clickPlay, line 565, before "getWorld():setWorld(sel.item.saveName);"
for i,challenge in ipairs(LastStandChallenge) do
	if challenge.gameMode == sel.item.gameMode then
		LastStandData.chosenChallenge = challenge
		doChallenge(challenge)
		getWorld():setWorld(sel.item.saveName);
		MainScreen.instance:setDefaultSandboxVars()
		-- duplicated code from source function in order to use "return"
		self:setVisible(false);
		MainScreen.instance.bottomPanel:setVisible(true);
		if self.joyfocus then
			self.joyfocus.focus = MainScreen.instance;
			updateJoypadFocus(self.joyfocus);
		end
	
		MainScreen.continueLatestSaveAux(false, self)
		return
	end
end

It seems to work - now "Winter is coming" for real, regardless of the way it is loaded.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...