4
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

57 lines
1.4 KiB

Scriptname _00E_AutoSaveSystem_Functions extends Quest
Event OnUpdate()
Actor PlayerREF = Game.GetForm(0x14) as Actor
if PlayerREF.IsDead()
return
endif
If PlayerREF.IsInCombat() || PlayerREF.IsOnMount() || PlayerREF.IsSwimming() || ! Game.IsFightingControlsEnabled() || Utility.IsInMenuMode() || UI.IsTextInputEnabled() || UI.IsMenuOpen("Dialogue Menu") || ! PlayerREF.GetParentCell()
RegisterForSingleUpdate(5)
return
endif
Game.SaveGame(EnderalFunctions.GetAutosaveName(iAutosaveIndex))
iAutosaveIndex += 1
if iAutosaveIndex >= Utility.GetIniInt("iAutoSaveCount:SaveGame")
iAutosaveIndex = 0
endif
RegisterForSingleUpdate(fUpdateTime*60)
EndEvent
; called from _00E_AutosaveIntervalAlias to update ini setting fAutosaveEveryXMins in case it was changed
Function UpdateAutoSaveInterval()
if SKSE.GetVersion() <= 0
UnregisterForUpdate()
Debug.Trace("NO SKSE: timed autosaves are disabled")
return
endif
fUpdateTime = Utility.GetIniFloat("fAutosaveEveryXMins:SaveGame")
If fUpdateTime <= 0.0 ; just in case
fUpdateTime = 30.0
EndIf
RegisterForSingleUpdate(fUpdateTime*60)
RegisterForMenu("Journal Menu")
EndFunction
Event OnMenuClose(String MenuName)
float fAutosaveEveryXMins = Utility.GetIniFloat("fAutosaveEveryXMins:SaveGame")
if fUpdateTime as int != fAutosaveEveryXMins as int
fUpdateTime = fAutosaveEveryXMins
RegisterForSingleUpdate(fUpdateTime*60)
endif
EndEvent
int iAutosaveIndex = 0
float fUpdateTime