2023-12-03 22:45:37 +00:00
|
|
|
Scriptname _00E_AutoSaveSystem_Functions extends Quest
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2023-12-03 22:45:37 +00:00
|
|
|
; Save Name Structure (from NQS NamedQuicksaves by Ryan McKenzie)
|
|
|
|
|
|
|
|
; Save3_0C2D58E2_0_507269736F6E6572_Tamriel_000002_20180503063315_4_1.ess
|
|
|
|
; Save3: Type and index of save
|
|
|
|
; 0C2D58E2: Unique hash used to identify your save profile. Regenerated on closing racemenu.
|
|
|
|
; 0: Flag for modded game.
|
|
|
|
; 507269736F6E6572: Character name in hex.
|
|
|
|
; Tamriel: coc code.
|
|
|
|
; 000002: Days, hours, minutes played.
|
|
|
|
; 20180503063315: Year, month, day, hour, minute, second in GMT + 0.
|
|
|
|
; 4: Player level.
|
|
|
|
; 1: Unknown flag.
|
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
|
|
|
|
|
2023-12-04 00:38:52 +00:00
|
|
|
If PlayerREF.IsInCombat() || PlayerREF.IsOnMount() || PlayerREF.IsSwimming() || ! Game.IsFightingControlsEnabled() || PlayerREF.IsDead() || Utility.IsInMenuMode() || UI.IsTextInputEnabled() || UI.IsMenuOpen("Dialogue Menu")
|
2023-12-03 22:45:37 +00:00
|
|
|
RegisterForSingleUpdate(5)
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
|
|
|
|
; Eddoursul: Index prefixed with 0 ensures the engine does not rotate these saves out
|
|
|
|
Game.SaveGame("Autosave0" + iAutosaveIndex + "_" + EnderalFunctions.GetPlayerHash() + "_0_" + EnderalFunctions.StringToHex(PlayerREF.GetActorBase().GetName()) + "_EnderalSE_000000_00000000000000_1_1")
|
|
|
|
|
|
|
|
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()
|
|
|
|
return
|
|
|
|
endif
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2023-12-04 00:38:52 +00:00
|
|
|
fUpdateTime = Utility.GetIniFloat("fAutosaveEveryXMins:SaveGame")
|
|
|
|
|
|
|
|
If fUpdateTime <= 0.0 ; just in case
|
|
|
|
fUpdateTime = 30
|
2021-10-05 22:15:58 +00:00
|
|
|
EndIf
|
|
|
|
|
2023-12-04 00:38:52 +00:00
|
|
|
RegisterForSingleUpdate(fUpdateTime*60)
|
2021-10-05 22:15:58 +00:00
|
|
|
|
|
|
|
EndFunction
|
|
|
|
|
2023-12-03 22:45:37 +00:00
|
|
|
int iAutosaveIndex = 0
|
2021-10-05 22:15:58 +00:00
|
|
|
float fUpdateTime
|