Scriptname _00E_PlayerSetUpScript extends ObjectReference {Initializes all the necessary Quests, maintains the player, contains various OnPlayerLoadGame() failsafes. This script is important for proper updating, do not overwrite it.} Float Property CURRENT_PATCH_VERSION = 2.12 AutoReadOnly ;===================================================================================== ; EVENTS ;===================================================================================== Event OnInit() If self != (PlayerREF as ObjectReference) return EndIf ; needs the IsInMenuMode() check to prevent stuck messages when FS is not loaded While Utility.IsInMenuMode() Utility.WaitMenuMode(0.1) EndWhile _00E_Func_CheckDependencies.CheckDependencies() If fPatchVersion == 0.00 fPatchVersion = CURRENT_PATCH_VERSION EndIf GoToState("RealPlayer") PlayerREF.SetActorValue("speedMult", 95) PlayerREF.SetActorValue("Healrate", 0) EnableDisableKillmove() ; Added in 1.5.8.0 ; starts all quests that are in the formlist Int iIndex = QuestsToStart.GetSize() While iIndex > 0 iIndex -= 1 Quest kQuest = QuestsToStart.GetAt(iIndex) as Quest kQuest.Start() endwhile ; Added in 2.0.12 AddPlayerPerks() EndEvent Event OnPlayerLoadGame() If self == (PlayerREF as ObjectReference) ; A check just in case. Most likely this condition is always True _00E_Func_CheckDependencies.CheckDependencies() Maintenance() If GetState() != "RealPlayer" ; Post-1.2.5.0 version update GoToState("RealPlayer") EndIf EndIf EndEvent State RealPlayer ;/ Event OnBeginState() Debug.Trace(self + ": OnBeginState RealPlayer") EndEvent /; EndState ;===================================================================================== ; 2.0.6 ;===================================================================================== Function UpdateMQ12b_206() _00E_MQ12b_Functions MQ12bFunctions = Game.GetFormFromFile(0x0002EBAD, "Skyrim.esm") as _00E_MQ12b_Functions Quest MQ15 = Game.GetFormFromFile(0x0002EBB0, "Skyrim.esm") as Quest If MQ12bFunctions.GetStage() >= 135 && MQ15.GetStage() < 5 MQ12bFunctions.OldReenableDisabledNPC() EndIf EndFunction ;===================================================================================== ; 2.0.8 ;===================================================================================== Function Update_208() ; Obsolete abilities cleanup _00E_FS_NQ07_Functions FS_NQ07_Quest = Game.GetFormFromFile(0x0001CA09, "Enderal - Forgotten Stories.esm") as _00E_FS_NQ07_Functions Int iFS_NQ07Stage = FS_NQ07_Quest.GetStage() If iFS_NQ07Stage >= 5 && iFS_NQ07Stage < 410 FS_NQ07_Quest.UpdateAarosCarryTraySpell() Else RemoveObsoleteSpell(0x0009A893, "Skyrim.esm", 0x000F649A, "Skyrim.esm") EndIf RemoveObsoleteSpell(0x0010D339, "Skyrim.esm", 0x000F649A, "Skyrim.esm") RemoveObsoleteSpell(0x0006FFAF, "Skyrim.esm", 0x000F6498, "Skyrim.esm") RemoveObsoleteSpell(0x000F64A0, "Skyrim.esm", 0x000F6498, "Skyrim.esm") ; Refill _00E_AnimTest_SC package arrays where needed FillAnimTestPackages(0x00137889, "Skyrim.esm", 0x00070657, "Skyrim.esm") FillAnimTestPackages(0x0013788A, "Skyrim.esm", 0x00070657, "Skyrim.esm") FillAnimTestPackages(0x0013789F, "Skyrim.esm", 0x00070657, "Skyrim.esm") FillAnimTestPackages(0x001378A2, "Skyrim.esm", 0x00070657, "Skyrim.esm") FillAnimTestPackages(0x001378AA, "Skyrim.esm", 0x00070657, "Skyrim.esm") FillAnimTestPackages(0x001378AB, "Skyrim.esm", 0x00070657, "Skyrim.esm") FillAnimTestPackages(0x00147E12, "Skyrim.esm", 0x00070657, "Skyrim.esm") FillAnimTestPackages(0x00147E14, "Skyrim.esm", 0x00070657, "Skyrim.esm") FillAnimTestPackages(0x0010D336, "Skyrim.esm", 0x00070645, "Skyrim.esm") FillAnimTestPackages(0x0010D33B, "Skyrim.esm", 0x00070645, "Skyrim.esm") FillAnimTestPackages(0x00147DEA, "Skyrim.esm", 0x00070645, "Skyrim.esm") FillAnimTestPackages(0x00147E37, "Skyrim.esm", 0x00070645, "Skyrim.esm") ; "Gypsy minstrels" update Keyword performSpotKwd = Game.GetFormFromFile(0x000FB905, "Skyrim.esm") as Keyword (Game.GetFormFromFile(0x00044EBC, "Skyrim.esm") as _00E_BardPlayInstrumentScript).LinkedPlayMarkerKeyword = performSpotKwd (Game.GetFormFromFile(0x00046D79, "Skyrim.esm") as _00E_GypsyMinstrelsControlScript).UpdateWaypoint() EndFunction Function RemoveObsoleteSpell(Int idNPC, String esmNPC, Int idSpell, String esmSpell) Spell obsoleteSpell = Game.GetFormFromFile(idSpell, esmSpell) as Spell (Game.GetFormFromFile(idNPC, esmNPC) as Actor).RemoveSpell(obsoleteSpell) EndFunction Function FillAnimTestPackages(Int idNPC, String esmNPC, Int idPackage, String esmPackage) Package newPackage = Game.GetFormFromFile(idPackage, esmPackage) as Package (Game.GetFormFromFile(idNPC, esmNPC) as _00E_AnimTest_SC).UpdateFillPackages(newPackage) EndFunction ;===================================================================================== ; 2.0.10 ;===================================================================================== Function Update_210() Spell abSoulcaller = Game.GetFormFromFile(0x002F0EA, "Enderal - Forgotten Stories.esm") as Spell If PlayerREF.HasSpell(abSoulcaller) PlayerREF.RemoveSpell(abSoulcaller) Utility.Wait(1) PlayerREF.AddSpell(abSoulcaller, False) EndIf Perk perkBloodlust = Game.GetFormFromFile(0x00069D38, "Skyrim.esm") as Perk _ResetPerk(perkBloodlust) _00E_PlayerhousingMaster.GetMaster().Update_209() ; Previous versions may have silence tracks stuck Levelsystem.RemoveSilence() EndFunction ;===================================================================================== ; 2.0.12 ;===================================================================================== Function Update_212() ; EndFunction Function AddPlayerPerks() if PlayerPerks == None PlayerPerks = Game.GetForm(0x000493B8) as FormList endif Perk kPerk int iIndex = PlayerPerks.GetSize() While iIndex > 0 iIndex -= 1 kPerk = PlayerPerks.GetAt(iIndex) as Perk if ! PlayerREF.HasPerk(kPerk) PlayerREF.AddPerk(kPerk) endif endwhile EndFunction ;===================================================================================== ; 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 If Utility.GetINIBool("bVATSDisable:VATS") == false KillMove.SetValueInt(1) Else KillMove.SetValueInt(0) EndIf 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 MQ05PrologueFunctions = Game.GetForm(0x00033A5B) as _00E_MQ05Prologue_Functions EndIf MQ05PrologueFunctions.FillEmptyAliasesFailsafe() EndFunction Function RefreshMountNamesOnLoad() _00E_NQ06_Functions NQ06Functions = Game.GetFormFromFile(0x000725BA,"Skyrim.esm") as _00E_NQ06_Functions NQ06Functions.RefreshNamesOnSaveLoad() EndFunction Function _ResetPerk(Perk p) If PlayerREF.HasPerk(p) PlayerREF.RemovePerk(p) PlayerREF.AddPerk(p) EndIf EndFunction Function ResetArmorWeightPerks() ; Perks modifying armor weights need some push on each game load to work. ; The push is needed only if the player is over-encumbered on game load. ; If the player is not over-encumbered, the push is not needed because checking the inventory, picking up items, sheathing/drawing a weapon will reset the perks anyway. If PlayerREF.IsOverEncumbered() _ResetPerk(_00E_Class_Keeper_P05_C_Conditioning) _ResetPerk(_00E_Class_Vagrant_P05_B_Lightweight) EndIf EndFunction Function FixMoreAffinitiesMod() {Fixes "More Affinites" mod missing properties in the Levelsystem scripts} _00E_QuestFunctions QuestFunctionsScript = (Game.GetFormFromFile(0x00010AA2, "Skyrim.esm") as Quest) as _00E_QuestFunctions If QuestFunctionsScript._00E_RemoveAllItems_TrashContainer == NONE Debug.Messagebox("Found broken scripts caused by mod >>More Affinities<<. Press OK to fix scripts.") _00E_ConfigMenu ConfigMenuScript = (Game.GetFormFromFile(0x00010AA2, "Skyrim.esm") as Quest) as _00E_ConfigMenu ConfigMenuScript.controlQuest = (Game.GetFormFromFile(0x0101EC71, "Enderal - Forgotten Stories.esm") as Quest) as _FS_Phasmalist_ControlQuest ConfigMenuScript._00E_ConfigMenu_DisableCraftingTutorials = Game.GetFormFromFile(0x00046D8E, "Skyrim.esm") as Message ConfigMenuScript._00E_ConfigMenu_DisableMenuTutorials = Game.GetFormFromFile(0x00046D8A, "Skyrim.esm") as Message ConfigMenuScript._00E_ConfigMenu_DisableOtherTutorials = Game.GetFormFromFile(0x00046D8F, "Skyrim.esm") as Message ConfigMenuScript._00E_ConfigMenu_DisableQuestTutorials = Game.GetFormFromFile(0x00046D8C, "Skyrim.esm") as Message ConfigMenuScript._00E_ConfigMenu_DisableReadAloudBooks = Game.GetFormFromFile(0x0102E982, "Enderal - Forgotten Stories.esm") as Message ConfigMenuScript._00E_ConfigMenu_DisableSkillTutorials = Game.GetFormFromFile(0x00046D8D, "Skyrim.esm") as Message ConfigMenuScript._00E_ConfigMenu_GameplayOptions = Game.GetFormFromFile(0x0102F1BC, "Enderal - Forgotten Stories.esm") as Message ConfigMenuScript._00E_ConfigMenu_Meditate = Game.GetFormFromFile(0x00046D98, "Skyrim.esm") as Message ConfigMenuScript._00E_ConfigMenu_OtherOptions = Game.GetFormFromFile(0x00046D89, "Skyrim.esm") as Message ConfigMenuScript._00E_ConfigMenu_VideoSkip = Game.GetFormFromFile(0x0102E983, "Enderal - Forgotten Stories.esm") as Message ConfigMenuScript._00E_DisableCraftingTutorials = Game.GetFormFromFile(0x00046D90, "Skyrim.esm") as GlobalVariable ConfigMenuScript._00E_DisableMenuTutorials = Game.GetFormFromFile(0x00046D8B, "Skyrim.esm") as GlobalVariable ConfigMenuScript._00E_DisableOtherTutorials = Game.GetFormFromFile(0x00046D93, "Skyrim.esm") as GlobalVariable ConfigMenuScript._00E_DisableQuestTutorials = Game.GetFormFromFile(0x00046D92, "Skyrim.esm") as GlobalVariable ConfigMenuScript._00E_DisableReadAloudBooks = Game.GetFormFromFile(0x0102E984, "Enderal - Forgotten Stories.esm") as GlobalVariable ConfigMenuScript._00E_DisableSkillTutorials = Game.GetFormFromFile(0x00046D91, "Skyrim.esm") as GlobalVariable ConfigMenuScript._00E_FS_ConfigMenu_Mount_Teleport = Game.GetFormFromFile(0x0102F1B9, "Enderal - Forgotten Stories.esm") as Message ConfigMenuScript._00E_FS_ConfigMenu_Phasmalist_Teleport = Game.GetFormFromFile(0x0101F2B6, "Enderal - Forgotten Stories.esm") as Message ConfigMenuScript._00E_FS_IsForgottenStoriesActivated = Game.GetFormFromFile(0x0004320E, "Skyrim.esm") as GlobalVariable ConfigMenuScript._00E_HorseFlute_New = ((Game.GetFormFromFile(0x000725BA, "Skyrim.esm") as Quest).GetAliasByName("HorseFlute")) as _00E_Horseflute_SC ConfigMenuScript._00E_VideoSkip = Game.GetFormFromFile(0x0102E985, "Enderal - Forgotten Stories.esm") as GlobalVariable QuestFunctionsScript.BastionPerks = Game.GetFormFromFile(0x0006686B, "Skyrim.esm") as Formlist QuestFunctionsScript.DerwishPerks = Game.GetFormFromFile(0x0006686D, "Skyrim.esm") as Formlist QuestFunctionsScript.ElementalismPerks = Game.GetFormFromFile(0x00066875, "Skyrim.esm") as Formlist QuestFunctionsScript.EspionagePerks = Game.GetFormFromFile(0x00066889, "Skyrim.esm") as Formlist QuestFunctionsScript.GameHour = Game.GetFormFromFile(0x00000038, "Skyrim.esm") as GlobalVariable QuestFunctionsScript.Gold001 = Game.GetFormFromFile(0x0000000f, "Skyrim.esm") as MiscObject QuestFunctionsScript.LifeAndDeathPerks = Game.GetFormFromFile(0x00066873, "Skyrim.esm") as Formlist QuestFunctionsScript.MAGIllusionCharm = Game.GetFormFromFile(0x00075805, "Skyrim.esm") as Sound QuestFunctionsScript.ManipulationPerks = Game.GetFormFromFile(0x0006686A, "Skyrim.esm") as Formlist QuestFunctionsScript.PlayerSkillMenu = ((Game.GetFormFromFile(0x00010AA2, "Skyrim.esm") as Quest).GetAliasByName("Player") as Alias) as _00E_Game_SkillmenuSC QuestFunctionsScript.RagePerks = Game.GetFormFromFile(0x00066887, "Skyrim.esm") as Formlist QuestFunctionsScript.SympathyEsme = Game.GetFormFromFile(0x0102A498, "Enderal - Forgotten Stories.esm") as GlobalVariable QuestFunctionsScript.TrickeryPerks = Game.GetFormFromFile(0x0006687F, "Skyrim.esm") as Formlist QuestFunctionsScript.VagabondPerks = Game.GetFormFromFile(0x00066877, "Skyrim.esm") as Formlist QuestFunctionsScript._00E_AchievementsEnabled = Game.GetFormFromFile(0x00046F83, "Skyrim.esm") as GlobalVariable QuestFunctionsScript._00E_AllAmmos = Game.GetFormFromFile(0x000456C0, "Skyrim.esm") as Formlist QuestFunctionsScript._00E_ArmorSetScript_sSetBonusRemoved = Game.GetFormFromFile(0x00036F96, "Skyrim.esm") as Message QuestFunctionsScript._00E_DisableQuestTutorials = Game.GetFormFromFile(0x00046D92, "Skyrim.esm") as GlobalVariable QuestFunctionsScript._00E_DisableSkillTutorials = Game.GetFormFromFile(0x00046D91, "Skyrim.esm") as GlobalVariable QuestFunctionsScript._00E_FS_A3_AlreadyKnowThisLevel = Game.GetFormFromFile(0x0102F533, "Enderal - Forgotten Stories.esm") as Message QuestFunctionsScript._00E_FS_A3_NeedToLearnOtherLevels = Game.GetFormFromFile(0x0101EC7D, "Enderal - Forgotten Stories.esm") as Message QuestFunctionsScript._00E_FS_A3_sIn = Game.GetFormFromFile(0x00043BE0, "Skyrim.esm") as Message QuestFunctionsScript._00E_FS_A3_sMageClassName = Game.GetFormFromFile(0x00043BE4, "Skyrim.esm") as Message QuestFunctionsScript._00E_FS_A3_sRogueClassName = Game.GetFormFromFile(0x00043BE3, "Skyrim.esm") as Message QuestFunctionsScript._00E_FS_A3_sToUnlockThisClass = Game.GetFormFromFile(0x00043BE1, "Skyrim.esm") as Message QuestFunctionsScript._00E_FS_A3_sWarriorClassName = Game.GetFormFromFile(0x00043BE2, "Skyrim.esm") as Message QuestFunctionsScript._00E_FS_A3_sYouNeedSkillpoints = Game.GetFormFromFile(0x00043BDF, "Skyrim.esm") as Message QuestFunctionsScript._00E_FS_NQ02_Esme = Game.GetFormFromFile(0x0101F0D0, "Enderal - Forgotten Stories.esm") as ActorBase QuestFunctionsScript._00E_FS_NQR05_SlowMotionSP = Game.GetFormFromFile(0x0102E2BD, "Enderal - Forgotten Stories.esm") as Spell QuestFunctionsScript._00E_FS_NQR05_SlowMotion_IntroM = Game.GetFormFromFile(0x0102E2BF, "Enderal - Forgotten Stories.esm") as Sound QuestFunctionsScript._00E_FS_NQR05_SlowMotion_OutroM = Game.GetFormFromFile(0x0102E2C1, "Enderal - Forgotten Stories.esm") as Sound QuestFunctionsScript._00E_Levelsystem_sAbilityStanceQyrai = Game.GetFormFromFile(0x00046D9B, "Skyrim.esm") as Message QuestFunctionsScript._00E_Levelsystem_sAbilityStanceSkaragg = Game.GetFormFromFile(0x00046D9C, "Skyrim.esm") as Message QuestFunctionsScript._00E_PleaseRemoveMoney = Game.GetFormFromFile(0x000480DA, "Skyrim.esm") as Message QuestFunctionsScript._00E_RemoveAllItems_TrashContainer = Game.GetFormFromFile(0x000469E7, "Skyrim.esm") as ObjectReference QuestFunctionsScript._00E_SkillbookWarning = Game.GetFormFromFile(0x00031ACF, "Skyrim.esm") as Message _00E_Game_SkillmenuSC SkillMenuScript = ((Game.GetFormFromFile(0x00010AA2, "Skyrim.esm") as Quest).GetAliasByName("Player") as Alias) as _00E_Game_SkillmenuSC SkillMenuScript._00E_FS_Game_Affinity_Spectralist = Game.GetFormFromFile(0x01029A35, "Skyrim.esm") as Message _00E_PlayerHousing_CellNameSC CellNameScript = ((Game.GetFormFromFile(0x00010AA2, "Skyrim.esm") as Quest).GetAliasByName("Player") as Alias) as _00E_PlayerHousing_CellNameSC CellNameScript.FS_NQR03 = Game.GetFormFromFile(0x0014CEA2, "Skyrim.esm") as Quest CellNameScript.FS_NQR03_RhalataTemple = Game.GetFormFromFile(0x0010D1C2, "Skyrim.esm") as Cell CellNameScript._00E_sPlayerHouseMarketQuarterName = Game.GetFormFromFile(0x00047CA5, "Skyrim.esm") as Message CellNameScript._00E_sPlayerHouseNobleQuarterName = Game.GetFormFromFile(0x00047CA6, "Skyrim.esm") as Message CellNameScript._00E_sRhalataTempleName = Game.GetFormFromFile(0x00047C29, "Skyrim.esm") as Message _00E_WeatherControlScriptSC WeatherControlScript = ((Game.GetFormFromFile(0x00010AA2, "Skyrim.esm") as Quest).GetAliasByName("Player") as Alias) as _00E_WeatherControlScriptSC WeatherControlScript.CapitalCityCastleWorld = Game.GetFormFromFile(0x00070729, "Skyrim.esm") as WorldSpace WeatherControlScript.CapitalCityLocation = Game.GetFormFromFile(0x000A1A12, "Skyrim.esm") as Location WeatherControlScript.MQ09 = Game.GetFormFromFile(0x0007FA91, "Skyrim.esm") as Quest WeatherControlScript.MQ12b = Game.GetFormFromFile(0x0002EBAD, "Skyrim.esm") as Quest WeatherControlScript.MQ17 = Game.GetFormFromFile(0x0007FA93, "Skyrim.esm") as Quest WeatherControlScript.SkyrimOvercastRain = Game.GetFormFromFile(0x000C821F, "Skyrim.esm") as Weather WeatherControlScript.Vyn = Game.GetFormFromFile(0x00001D3C, "Skyrim.esm") as WorldSpace WeatherControlScript._00E_EnderalOvercast = Game.GetFormFromFile(0x00072785, "Skyrim.esm") as Weather WeatherControlScript._00E_MQ11c_SilberhainDeadWeather = Game.GetFormFromFile(0x00096807, "Skyrim.esm") as GlobalVariable WeatherControlScript._00E_SuntempleLocations = Game.GetFormFromFile(0x0003BB5B, "Skyrim.esm") as FormList Utility.Wait(1) Debug.Messagebox("Scripts fixed. Make sure to save the game. Restart the client and reload the save that you just created.\n If you have set items equipped, unequip them all and re-equip them for potential set bonuses to apply.") EndIf EndFunction ;===================================================================================== ; MAINTENANCE ;===================================================================================== Function Maintenance() if fPatchVersion < 1.62 Debug.MessageBox("A savegame was loaded which was made before the release of Enderal SE. In this save, several new features won't be available and there is a chance that you'll encounter grave bugs. Please, start a new game.") Game.QuitToMainMenu() return endif if fPatchVersion < CURRENT_PATCH_VERSION If fPatchVersion < 2.06 UpdateMQ12b_206() EndIf If fPatchVersion < 2.08 Update_208() EndIf If fPatchVersion < 2.10 Update_210() EndIf If fPatchVersion < 2.12 Update_212() EndIf fPatchVersion = CURRENT_PATCH_VERSION endif ; 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) ; Workaround for broken physics on loading saves, made on a mount If PlayerREF.IsOnMount() PlayerREF.Dismount() EndIf EnableDisableKillmove() ResetArmorWeightPerks() AddPlayerPerks() SetAutoSaveInterval() FailsafeMQ05PrologueAliases() RefreshMountNamesOnLoad() ; 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 ;===================================================================================== ; PROPERTIES ;===================================================================================== float fPatchVersion _00E_MQ05Prologue_Functions Property MQ05PrologueFunctions Auto Actor Property PlayerREF Auto FormList Property QuestsToStart Auto FormList Property PlayerPerks Auto GlobalVariable Property KillMove Auto Perk Property _00E_Class_Keeper_P05_C_Conditioning Auto Perk Property _00E_Class_Vagrant_P05_B_Lightweight Auto _00E_QuestFunctions Property Levelsystem Auto