2021-10-05 22:15:58 +00:00
Scriptname _00E_PlayerSetUpScript extends ObjectReference
2021-12-15 06:49:12 +00:00
{Initializes all the necessary Quests, maintains the player, contains various OnPlayerLoadGame() failsafes. This script is important for proper updating, do not overwrite it.}
2021-10-05 22:15:58 +00:00
2023-10-26 19:22:14 +00:00
int function _GetScriptVersion() Global
return 1
endFunction
2021-10-05 22:59:59 +00:00
2021-10-05 22:15:58 +00:00
;=====================================================================================
; EVENTS
;=====================================================================================
Event OnInit()
2021-12-15 06:49:12 +00:00
If self != (PlayerREF as ObjectReference)
return
EndIf
PlayerREF.SetActorValue("speedMult", 95)
PlayerREF.SetActorValue("Healrate", 0)
EnableDisableKillmove()
; starts all quests that are in the formlist
Int iIndex = QuestsToStart.GetSize()
2021-12-29 21:20:10 +00:00
While iIndex > 0
2021-12-15 06:49:12 +00:00
iIndex -= 1
Quest kQuest = QuestsToStart.GetAt(iIndex) as Quest
kQuest.Start()
endwhile
2021-10-05 22:15:58 +00:00
EndEvent
Event OnPlayerLoadGame()
If self == (PlayerREF as ObjectReference) ; A check just in case. Most likely this condition is always True
Maintenance()
EndIf
EndEvent
2021-10-05 22:59:59 +00:00
2021-10-05 22:15:58 +00:00
;=====================================================================================
; ALL UPDATES
;=====================================================================================
Function EnableDisableKillmove()
; it seems like that this ini setting does not do stuff by itself (or it is bugged)
; therefore we need to read it from the file and change the global with which the killmoves are conditioned
2021-12-11 15:36:03 +00:00
If Utility.GetINIBool("bVATSDisable:VATS") == false
2021-10-05 22:15:58 +00:00
KillMove.SetValueInt(1)
2021-12-11 15:36:03 +00:00
Else
KillMove.SetValueInt(0)
2021-10-05 22:15:58 +00:00
EndIf
2021-12-11 15:36:03 +00:00
2021-10-05 22:15:58 +00:00
EndFunction
Function SetAutoSaveInterval()
; updates the autosave interval
_00E_AutoSaveSystem_Functions AutoSaveSystem_Functions = Game.GetFormFromFile(0x00048141, "Skyrim.esm") as _00E_AutoSaveSystem_Functions
AutoSaveSystem_Functions.UpdateAutoSaveInterval()
EndFunction
Function FailsafeMQ05PrologueAliases()
; failsafe for issue 1536, fills empty aliases
If MQ05PrologueFunctions == None
2021-12-29 21:20:10 +00:00
MQ05PrologueFunctions = Game.GetForm(0x00033A5B) as _00E_MQ05Prologue_Functions
2021-10-05 22:15:58 +00:00
EndIf
MQ05PrologueFunctions.FillEmptyAliasesFailsafe()
EndFunction
Function RefreshMountNamesOnLoad()
2022-07-29 22:05:32 +00:00
_00E_NQ06_Functions NQ06Functions = Game.GetForm(0x725BA) as _00E_NQ06_Functions
2021-10-05 22:15:58 +00:00
NQ06Functions.RefreshNamesOnSaveLoad()
EndFunction
2021-10-05 22:59:59 +00:00
2021-10-05 22:15:58 +00:00
;=====================================================================================
; MAINTENANCE
;=====================================================================================
Function Maintenance()
2021-11-29 02:47:56 +00:00
2021-10-05 22:15:58 +00:00
; changes to the actor value healrate will not persist in consecutive saves
; every time a save gets loaded the healrate needs to be set to 0, otherwise it will go back again to default at 0.7
; this is called before active magic effects of potions or spells are applied to the player which could also alter the value
PlayerREF.SetActorValue("Healrate", 0)
2021-12-29 21:20:10 +00:00
; Workaround for broken physics on loading saves, made on a mount
If PlayerREF.IsOnMount()
PlayerREF.Dismount()
EndIf
2022-08-12 17:46:50 +00:00
; Clear stuck help messages, leaking between game loads
Message.ResetHelpMessage("Clear")
(Game.GetForm(0xAC80E) as Message).ShowAsHelpMessage("Clear", 0.1, 1, 1)
2021-10-05 22:15:58 +00:00
EnableDisableKillmove()
SetAutoSaveInterval()
FailsafeMQ05PrologueAliases()
RefreshMountNamesOnLoad()
2021-12-04 01:30:32 +00:00
2022-08-01 00:44:56 +00:00
SendModEvent("Enderal_GameLoaded")
2021-10-05 22:15:58 +00:00
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
_00E_MQ05Prologue_Functions Property MQ05PrologueFunctions Auto
Actor Property PlayerREF Auto
FormList Property QuestsToStart Auto
2021-10-05 22:59:59 +00:00
GlobalVariable Property KillMove Auto