Moved dependency checks to a separate script

This commit is contained in:
Eddoursul 2021-12-09 21:28:54 +01:00
parent 10a133a2c3
commit 55734a99be
6 changed files with 73 additions and 98 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,49 @@
Scriptname _00E_Func_CheckDependencies Hidden
Function CheckDependencies() global
; If Enderal - Forgotten Stories.esm is not loaded, kick the player back to main menu
if (Game.GetFormFromFile(0x0004320E, "Skyrim.esm") as GlobalVariable).GetValueInt() != 1
Utility.wait(2.0)
Game.QuitToMainMenu()
Debug.MessageBox("Enderal - Forgotten Stories.esm is not loaded! The game will not run properly. Open Data Files and enable it.")
EndIf
; Skip all other check on non-PC/non-VR platforms (for future ports)
; If you are porting Enderal to another platform, you may want to replace _00E_Func_CheckDependencies with your own script.
if Debug.GetPlatformName() != "Win64"
return
endif
Int SKSEVer = SKSE.GetVersion()
if SKSEVer == 0
Utility.wait(2.0)
Game.QuitToMainMenu()
Debug.MessageBox("SKSE is not detected! Start Enderal through the launcher or skse64_loader.exe in the game directory.")
Return
endif
Quest bSkyUI = Game.GetFormFromFile(0x00000802, "SkyUI_SE.esp") as Quest
If bSkyUI == None
Utility.wait(2.0)
Game.QuitToMainMenu()
Debug.MessageBox("SkyUI_SE.esp is not loaded! The game will not run properly. Open Data Files and enable it.")
Return
EndIf
if SKSE.GetPluginVersion("fs_skse_functions") == -1
Utility.wait(2.0)
Game.QuitToMainMenu()
Debug.MessageBox("fs.dll is not loaded! The game will not run properly. Verify integrity of your files.\n\nThis may also happen, if your version of SKSE or Enderal is too old. In this case, it is advised to upgrade.")
Return
endif
if SKSE.GetPluginVersion("JContainers64") == -1
; JContainers is only required for lycanthropy, so we just nag users without preventing playing without it
Utility.wait(2.0)
Debug.MessageBox("JContainers is not loaded! The game will not run properly. Verify integrity of your files or reinstall JContainers.")
endif
EndFunction

View File

@ -15,7 +15,7 @@ Event OnInit()
Utility.WaitMenuMode(0.1)
EndWhile
CheckIfForgottenStoriesIsLoaded()
_00E_Func_CheckDependencies.CheckDependencies()
If self == (PlayerREF as ObjectReference)
@ -29,10 +29,22 @@ Event OnInit()
EnableDisableKillmove()
AddPerks()
DisableRegularWaiting()
StartQuests(QuestsToStart)
; Added in 1.5.8.0
; adds the new Balancing perks for alchemy potions to the player, this is needed because of the changes with the Lycanthropy
PlayerREF.AddPerk(_00E_FS_Alchemy_BalancingPerk)
PlayerREF.AddPerk(_00E_FS_Alchemy_BalancingPerk_RestorePotions)
; Disables regular waiting by adding the no-wait ability
PlayerREF.AddSpell(_00E_AbBlockWaiting, False)
; starts all quests that are in the formlist
Int iIndex = QuestsToStart.GetSize()
While iIndex
iIndex -= 1
Quest kQuest = QuestsToStart.GetAt(iIndex) as Quest
kQuest.Start()
endwhile
EndIf
@ -40,7 +52,7 @@ EndEvent
Event OnPlayerLoadGame()
If self == (PlayerREF as ObjectReference) ; A check just in case. Most likely this condition is always True
CheckIfForgottenStoriesIsLoaded()
_00E_Func_CheckDependencies.CheckDependencies()
Maintenance()
If GetState() != "RealPlayer" ; Post-1.2.5.0 version update
GoToState("RealPlayer")
@ -57,96 +69,6 @@ State RealPlayer
EndState
;=====================================================================================
; FUNCTIONS
;=====================================================================================
Function CheckIfForgottenStoriesIsLoaded()
; function that quits back to the main menu when the Enderal - Forgotten Stories.esm is not not being added to the plugins.txt
; and hence not being loaded in-game. Unknown reason, probably write protection issues
if (Game.GetFormFromFile(0x0004320E, "Skyrim.esm") as GlobalVariable).GetValueInt() != 1
Utility.wait(2.0)
Game.QuitToMainMenu()
Debug.MessageBox("Enderal - Forgotten Stories.esm is not loaded! The game will not run properly. Open Data Files and enable it.")
EndIf
if Debug.GetPlatformName() != "Win64"
return
endif
Int SKSEVer = SKSE.GetVersion()
if SKSEVer == 0
Utility.wait(2.0)
Game.QuitToMainMenu()
Debug.MessageBox("SKSE is not detected! Start Enderal through the launcher or skse64_loader.exe in the game directory.")
Return
endif
Quest bSkyUI = Game.GetFormFromFile(0x00000802, "SkyUI_SE.esp") as Quest
If bSkyUI == None
Utility.wait(2.0)
Game.QuitToMainMenu()
Debug.MessageBox("SkyUI_SE.esp is not loaded! The game will not run properly. Open Data Files and enable it.")
Return
EndIf
if SKSE.GetPluginVersion("fs_skse_functions") == -1
Utility.wait(2.0)
Game.QuitToMainMenu()
Debug.MessageBox("fs.dll is not loaded! The game will not run properly. Verify integrity of your files.\n\nThis may also happen, if your version of SKSE or Enderal is too old. In this case, it is advised to upgrade.")
Return
endif
if SKSE.GetPluginVersion("JContainers64") == -1
Utility.wait(2.0)
Game.QuitToMainMenu()
Debug.MessageBox("JContainers is not loaded! The game will not run properly. Verify integrity of your files or reinstall JContainers.")
Return
endif
; fixes properties that were accidentally set to NONE by the "More Affinities" mod
If Game.GetModByName("Enderal_FS_More_Affinities.esp") != 255
FixMoreAffinitiesMod()
EndIf
EndFunction
;=====================================================================================
; 1.5.8.0
;=====================================================================================
Function AddPerks()
; adds the new Balancing perks for alchemy potions to the player, this is needed because of the changes with the Lycantroph
PlayerREF.AddPerk(_00E_FS_Alchemy_BalancingPerk)
PlayerREF.AddPerk(_00E_FS_Alchemy_BalancingPerk_RestorePotions)
EndFunction
Function DisableRegularWaiting()
{Disables regular waiting by adding the no-wait ability}
PlayerREF.AddSpell(_00E_AbBlockWaiting, False)
EndFunction
Function StartQuests(Formlist QuestList)
; starts all quests that are in the formlist
Int iIndex = QuestList.GetSize()
While iIndex
iIndex -= 1
Quest kQuest = QuestList.GetAt(iIndex) as Quest
kQuest.Start()
endwhile
EndFunction
;=====================================================================================
; 2.0.6
;=====================================================================================
@ -212,7 +134,7 @@ EndFunction
;=====================================================================================
; 2.0.9
; 2.0.10
;=====================================================================================
Function Update_210()
@ -441,6 +363,11 @@ Function Maintenance()
PlayerREF.Dismount()
EndIf
; fixes properties that were accidentally set to NONE by the "More Affinities" mod
If Game.GetModByName("Enderal_FS_More_Affinities.esp") != 255
FixMoreAffinitiesMod()
EndIf
EndFunction
;=====================================================================================

View File

@ -1963,7 +1963,6 @@ function AddEnderalIcons()
_categoryIconThemeValues[4] = "skyui\\icons_category_psychosteve.swf"
_categoryIconThemeIdx = 0
SetTextOptionValueST(_categoryIconThemeShortNames[_categoryIconThemeIdx])
SKI_SettingsManagerInstance.ClearOverride("Appearance$icons$category$source")
SKI_SettingsManagerInstance.SetOverride("Appearance$icons$category$source", _categoryIconThemeValues[_categoryIconThemeIdx])
endFunction