anyone understand autosave timing?

Pazyryk

Deity
Joined
Jun 13, 2008
Messages
3,584
My life would be much easier if Firaxis had included a gamesave event. In any case, I need to intercept saves just before they happen. I've been able to do this for every possible gamesave except for autosaves. The timing on these is a problem. They seem to occur after the end of the Barb turn, and really after some stuff at the start of the next turn, but before either Events.ActivePlayerTurnStart or GameEvents.PlayerDoTurn for iPlayer=0. Does anyone know any event that could intercept just before this?

Another possibility for me is to take advantage of this line in config.ini:
Code:
; Saves the game after the human player presses 'next turn' but before the game logic advances
PostTurnAutosaves = 0
Assuming it does what it says, I might be able to intercept right before that. However, then I have to tell mod players to change this setting in config.ini, which is really annoying. Or is there some way for a mod to change this setting?
 
The auto-save at the end of the turn isn't in the game core DLL source (so I'm guessing it's in the game engine framework) so it's hard to say what event (if any) triggers before that. The auto-save at the end of the turn (if you enable that option) is in the source, but there's nothing that triggers just before it.

There are getters and setters for the PostTurnAutosaves in the game core C++ code, but they are not exposed to Lua
 
Is there any combination of lua logic and events that would fire at the end (not beginning) of the barbs turn?

Or better, after those pre-turn AI-initiated dialogs, but before GameEvents.PlayerDoTurn for iPlayer=0?

I have some code to test whether some Lua fires before or after autosave, so trial-and-error is fine here.


Edit: I noticed that autosaves generate their own file name: "Turn 100, 2000 BC" or something like that. For regular saves, this string is generated in SaveMenu.lua. But I wonder if autosave sends some request (via Events or to the DLL) asking for a file name. If so, perhaps that could be intercepted?
 
Back
Top Bottom