2023-12-03 22:45:37 +00:00
|
|
|
Scriptname _00E_AutoSaveSystem_Functions extends Quest
|
2021-10-05 22:15:58 +00:00
|
|
|
|
|
|
|
Event OnUpdate()
|
2023-12-03 22:45:37 +00:00
|
|
|
|
|
|
|
Actor PlayerREF = Game.GetForm(0x14) as Actor
|
|
|
|
|
2024-01-26 22:10:06 +00:00
|
|
|
if PlayerREF.IsDead()
|
2024-01-22 22:42:34 +00:00
|
|
|
return
|
|
|
|
endif
|
|
|
|
|
2024-01-26 22:10:06 +00:00
|
|
|
If PlayerREF.IsInCombat() || PlayerREF.IsOnMount() || PlayerREF.IsSwimming() || ! Game.IsFightingControlsEnabled() || Utility.IsInMenuMode() || UI.IsTextInputEnabled() || UI.IsMenuOpen("Dialogue Menu") || ! PlayerREF.GetParentCell()
|
2023-12-03 22:45:37 +00:00
|
|
|
RegisterForSingleUpdate(5)
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
|
2024-01-24 17:12:06 +00:00
|
|
|
Game.SaveGame(EnderalFunctions.GetAutosaveName(iAutosaveIndex))
|
2023-12-03 22:45:37 +00:00
|
|
|
|
|
|
|
iAutosaveIndex += 1
|
|
|
|
if iAutosaveIndex >= Utility.GetIniInt("iAutoSaveCount:SaveGame")
|
|
|
|
iAutosaveIndex = 0
|
|
|
|
endif
|
|
|
|
|
|
|
|
RegisterForSingleUpdate(fUpdateTime*60)
|
|
|
|
|
2021-10-05 22:15:58 +00:00
|
|
|
EndEvent
|
|
|
|
|
2023-12-03 19:10:04 +00:00
|
|
|
; called from _00E_AutosaveIntervalAlias to update ini setting fAutosaveEveryXMins in case it was changed
|
2021-10-05 22:15:58 +00:00
|
|
|
Function UpdateAutoSaveInterval()
|
|
|
|
|
2023-12-04 00:38:52 +00:00
|
|
|
if SKSE.GetVersion() <= 0
|
|
|
|
UnregisterForUpdate()
|
2024-02-07 15:20:32 +00:00
|
|
|
Debug.Trace("NO SKSE: timed autosaves are disabled")
|
2023-12-04 00:38:52 +00:00
|
|
|
return
|
|
|
|
endif
|
2024-01-22 22:42:34 +00:00
|
|
|
|
2023-12-04 00:38:52 +00:00
|
|
|
fUpdateTime = Utility.GetIniFloat("fAutosaveEveryXMins:SaveGame")
|
|
|
|
|
|
|
|
If fUpdateTime <= 0.0 ; just in case
|
2024-01-22 22:42:34 +00:00
|
|
|
fUpdateTime = 30.0
|
2021-10-05 22:15:58 +00:00
|
|
|
EndIf
|
|
|
|
|
2023-12-04 00:38:52 +00:00
|
|
|
RegisterForSingleUpdate(fUpdateTime*60)
|
2024-01-22 22:42:34 +00:00
|
|
|
RegisterForMenu("Journal Menu")
|
2021-10-05 22:15:58 +00:00
|
|
|
|
|
|
|
EndFunction
|
|
|
|
|
2024-01-22 22:42:34 +00:00
|
|
|
Event OnMenuClose(String MenuName)
|
|
|
|
float fAutosaveEveryXMins = Utility.GetIniFloat("fAutosaveEveryXMins:SaveGame")
|
|
|
|
|
|
|
|
if fUpdateTime as int != fAutosaveEveryXMins as int
|
|
|
|
fUpdateTime = fAutosaveEveryXMins
|
|
|
|
RegisterForSingleUpdate(fUpdateTime*60)
|
|
|
|
endif
|
|
|
|
EndEvent
|
|
|
|
|
2023-12-03 22:45:37 +00:00
|
|
|
int iAutosaveIndex = 0
|
2021-10-05 22:15:58 +00:00
|
|
|
float fUpdateTime
|