Refactored health bars to SKSE events; SkyUI is now decoupled and is completely optional

This commit is contained in:
Eddoursul 2022-08-01 03:33:22 +02:00
parent 55f7e22fa3
commit 1a8a7f16aa
21 changed files with 112 additions and 106 deletions

BIN
Refactored health bars.esp Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,17 @@
Scriptname HealthBarManager Hidden
function Show(Actor akActor) global
int handle = ModEvent.Create("Enderal_ShowActorHealth")
if handle
ModEvent.PushForm(handle, akActor)
ModEvent.Send(handle)
endIf
endfunction
function Hide(Actor akActor) global
int handle = ModEvent.Create("Enderal_HideActorHealth")
if handle
ModEvent.PushForm(handle, akActor)
ModEvent.Send(handle)
endIf
endfunction

View File

@ -43,20 +43,10 @@ Function TransmuteOre(Form akSource, MineOreScript oreREF, int iCurrentResources
EndFunction EndFunction
Function showActorHealthBars(Actor a)
GUI_ActorHealthBarPanel.addActors(a)
Endfunction
Function hideActorHealthBars(Actor a)
GUI_ActorHealthBarPanel.removeActors(a)
Endfunction
;===================================================================================== ;=====================================================================================
; PROPERTIES ; PROPERTIES
;===================================================================================== ;=====================================================================================
_00E_GUI_ActorHealthBar Property GUI_ActorHealthBarPanel auto
Actor Property PlayerREF Auto Actor Property PlayerREF Auto
Projectile Property AlterPosProjectile Auto Projectile Property AlterPosProjectile Auto

View File

@ -186,10 +186,8 @@ Function EndSpecialAttack()
FS_NQR05_FatherREF.EvaluatePackage() FS_NQR05_FatherREF.EvaluatePackage()
_00E_FS_ForgottenStories_Functions ForgottenStoriesMiscDialogue = Game.GetFormFromFile(0x01016E89, "Enderal - Forgotten Stories.esm") as _00E_FS_ForgottenStories_Functions
If FS_NQR05_SidedWithFather.GetValueInt() == 1 If FS_NQR05_SidedWithFather.GetValueInt() == 1
ForgottenStoriesMiscDialogue.showActorHealthBars(FS_NQR05_FatherREF) HealthBarManager.Show(FS_NQR05_FatherREF)
FS_NQR05_FatherREF.StartCombat(FS_NQR05_TharaelREF) FS_NQR05_FatherREF.StartCombat(FS_NQR05_TharaelREF)
FS_NQR05_TharaelREF.StartCombat(PlayerREF) FS_NQR05_TharaelREF.StartCombat(PlayerREF)
Else Else

View File

@ -2,20 +2,7 @@ Scriptname _00E_Func_CheckDependencies Hidden
Function CheckDependencies() global Function CheckDependencies() global
; If Enderal - Forgotten Stories.esm is not loaded, kick the player back to main menu ; SKSE is currently mandatory
if (Game.GetForm(0x4320E) as GlobalVariable).GetValue() as Int != 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.")
return
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() Int SKSEVer = SKSE.GetVersion()
if SKSEVer == 0 if SKSEVer == 0
@ -25,6 +12,7 @@ Function CheckDependencies() global
Return Return
endif endif
; SkyUI is optional - override quest_journal.swf with the vanilla file, remove this check, and you are good to go
Quest bSkyUI = Game.GetFormFromFile(0x802, "SkyUI_SE.esp") as Quest Quest bSkyUI = Game.GetFormFromFile(0x802, "SkyUI_SE.esp") as Quest
If bSkyUI == None If bSkyUI == None
@ -34,6 +22,7 @@ Function CheckDependencies() global
Return Return
EndIf EndIf
; To get rid of this, make alternatives for CreatePotion and CalculateContentStrength first
if SKSE.GetPluginVersion("EnderalSE") == -1 if SKSE.GetPluginVersion("EnderalSE") == -1
Utility.wait(2.0) Utility.wait(2.0)
Game.QuitToMainMenu() Game.QuitToMainMenu()

View File

@ -107,7 +107,6 @@ event OnWidgetReset()
UpdateFadeOutDuration() UpdateFadeOutDuration()
UpdateMoveDuration() UpdateMoveDuration()
UpdateRemoveDuration() UpdateRemoveDuration()
endEvent endEvent
event OnGameReload() event OnGameReload()
@ -117,13 +116,27 @@ event OnGameReload()
_currentlyDisplayedActors = new Form[4] _currentlyDisplayedActors = new Form[4]
endif endif
RegisterForModEvent("Enderal_ShowActorHealth", "AddActors")
RegisterForModEvent("Enderal_HideActorHealth", "RemoveActors")
UI.Invoke(HUD_MENU, WidgetRoot + ".removeAllActors") UI.Invoke(HUD_MENU, WidgetRoot + ".removeAllActors")
Actor PlayerRef = Game.GetForm(0x14) as Actor
if ! PlayerRef.IsInCombat()
int n = _currentlyDisplayedActors.Length
While n > 0
n -= 1
_currentlyDisplayedActors[n] = None
EndWhile
return
endif
Utility.Wait(FadeOutDuration / 1000.0 + 0.05) Utility.Wait(FadeOutDuration / 1000.0 + 0.05)
int i = _currentlyDisplayedActors.Length int i = _currentlyDisplayedActors.Length
While i > 0 While i > 0
i = i - 1 i -= 1
Actor akActor = _currentlyDisplayedActors[i] as Actor Actor akActor = _currentlyDisplayedActors[i] as Actor
If !akActor || akActor.GetFormID() == 0 || akActor.IsDeleted() || akActor.IsDisabled() If !akActor || akActor.GetFormID() == 0 || akActor.IsDeleted() || akActor.IsDisabled()
_currentlyDisplayedActors[i] = None _currentlyDisplayedActors[i] = None
@ -132,12 +145,12 @@ event OnGameReload()
EndIf EndIf
EndWhile EndWhile
Cell kCell = Game.GetPlayer().GetParentCell() Cell kCell = PlayerRef.GetParentCell()
Int iIndex = kCell.GetNumRefs(43) ; NPC Int iIndex = kCell.GetNumRefs(43) ; NPC
While iIndex While iIndex
iIndex -= 1 iIndex -= 1
Actor akActor = kCell.GetNthRef(iIndex, 43) as Actor Actor akActor = kCell.GetNthRef(iIndex, 43) as Actor
if akActor.IsPlayerTeammate() if akActor && akActor.IsPlayerTeammate()
AddActors(akActor) AddActors(akActor)
endif endif
EndWhile EndWhile
@ -168,6 +181,9 @@ Function UpdateRemoveDuration()
EndFunction EndFunction
Function AddActors(Form aForm) Function AddActors(Form aForm)
if ! aForm
return
endif
if _currentlyDisplayedActors.find(aForm) < 0 if _currentlyDisplayedActors.find(aForm) < 0
int i = _currentlyDisplayedActors.length int i = _currentlyDisplayedActors.length
while i > 0 while i > 0
@ -183,6 +199,9 @@ Function AddActors(Form aForm)
EndFunction EndFunction
Function RemoveActors(Form aForm) Function RemoveActors(Form aForm)
if ! aForm
return
endif
int i = _currentlyDisplayedActors.find(aForm) int i = _currentlyDisplayedActors.find(aForm)
if i >= 0 if i >= 0
_currentlyDisplayedActors[i] = None _currentlyDisplayedActors[i] = None

View File

@ -1,14 +1,10 @@
Scriptname _00E_HealthBarSummons extends Actor Scriptname _00E_HealthBarSummons extends Actor
{Attaches and detaches the health bar to summons} {Attaches and detaches the health bar to summons}
_00E_FS_ForgottenStories_Functions Property ForgottenStoriesMiscDialogue Auto
Bool Property DiesOnBleedout = False Auto Bool Property DiesOnBleedout = False Auto
; Enderal SE: marked obsolete
Bool bRegisteredHealthBars = True ; Default to True, not False, for version update
Event OnLoad() Event OnLoad()
ForgottenStoriesMiscDialogue.showActorHealthBars(self) HealthBarManager.Show(self)
EndEvent EndEvent
Event OnEnterBleedout() Event OnEnterBleedout()
@ -30,15 +26,11 @@ Event OnUnload()
EndEvent EndEvent
Function UnregisterHealthBars() Function UnregisterHealthBars()
ForgottenStoriesMiscDialogue.hideActorHealthBars(self) HealthBarManager.Hide(self)
EndFunction EndFunction
Event OnCombatStateChanged(Actor akTarget, int aeCombatState) Event OnCombatStateChanged(Actor akTarget, int aeCombatState)
if aeCombatState == 1 if aeCombatState == 1
ForgottenStoriesMiscDialogue.showActorHealthBars(self) HealthBarManager.Show(self)
endif endif
endEvent endEvent
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, Bool abPowerAttack, Bool abSneakAttack, Bool abBashAttack, Bool abHitBlocked)
ForgottenStoriesMiscDialogue.showActorHealthBars(self)
endEvent

View File

@ -90,17 +90,6 @@ Sound Property _00E_FS_IncreaseArcaneFeverM Auto
;Sound Property _00E_FS_Phasmalist_EnterWorld_Male Auto ;Sound Property _00E_FS_Phasmalist_EnterWorld_Male Auto
;Sound Property _00E_FS_Phasmalist_EnterWorld_Female Auto ;Sound Property _00E_FS_Phasmalist_EnterWorld_Female Auto
_00E_GUI_ActorHealthBar Property _ActorHealthBarShower Auto
_00E_GUI_ActorHealthBar Property ActorHealthBarShower
_00E_GUI_ActorHealthBar Function Get()
If (_ActorHealthBarShower == None)
_ActorHealthBarShower = Game.GetFormFromFile(0x01024b66, "Enderal - Forgotten Stories.esm") as _00E_GUI_ActorHealthBar
EndIf
return _ActorHealthBarShower
EndFunction
EndProperty
Message Property _00E_BlitzheilungArkanistenfieber_sFeverIncreased Auto Message Property _00E_BlitzheilungArkanistenfieber_sFeverIncreased Auto
GlobalVariable Property _00E_Phasmalist_IsApparationSummoned Auto GlobalVariable Property _00E_Phasmalist_IsApparationSummoned Auto
@ -166,11 +155,11 @@ Endfunction
; utility functions ---------------------------------------------------------------------------------------------------------------------------------------------------------- ; utility functions ----------------------------------------------------------------------------------------------------------------------------------------------------------
Function _RemoveApparationHealthBar() Function _RemoveApparationHealthBar()
ActorHealthBarShower.RemoveActors(self.getActorReference()) HealthBarManager.Hide(self.getActorReference())
EndFunction EndFunction
Function _AddApparationHealthBar() Function _AddApparationHealthBar()
ActorHealthBarShower.AddActors(self.getActorReference()) HealthBarManager.Show(self.getActorReference())
EndFunction EndFunction
; local helper functions --------------------------------------------------------------------------------------------------------------------------------------------------------------- ; local helper functions ---------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -79,8 +79,6 @@ ImageSpaceModifier Property _00E_Phasmalist_ApparitionEnterWorldIMOD Auto
Sound Property _00E_FS_IncreaseArcaneFeverM Auto Sound Property _00E_FS_IncreaseArcaneFeverM Auto
_00E_FS_ForgottenStories_Functions Property ForgottenStoriesMiscDialogue Auto
Message Property _00E_Player_sArcaneFeverIncreased Auto Message Property _00E_Player_sArcaneFeverIncreased Auto
GlobalVariable Property _00E_Phasmalist_IsApparitionSummoned Auto GlobalVariable Property _00E_Phasmalist_IsApparitionSummoned Auto
@ -137,7 +135,7 @@ Function Summon(_00E_Phasmalist_TrinketSC trinket, ObjectReference moveToRef, Bo
akSelf.BlockActivation() akSelf.BlockActivation()
If bPhasmalismTankMode If bPhasmalismTankMode
akSelf.SetAV("Variable01", 1.0) akSelf.SetActorValue("Variable01", 1.0)
akSelf.EnableAI(False) akSelf.EnableAI(False)
Else Else
If moveToRef == PlayerREF If moveToRef == PlayerREF
@ -177,7 +175,7 @@ Function Setup()
SetupBehaviour(akSelf) SetupBehaviour(akSelf)
SetupNotPersistentStats(akSelf) SetupNotPersistentStats(akSelf)
Float fAttributeMult = (fPlayerConjSkillMult * PlayerREF.GetAV("Conjuration") + fPlayerEnchSkillMult * PlayerREF.GetAV("Enchanting")) / 100.0 + 1.0 Float fAttributeMult = (fPlayerConjSkillMult * PlayerREF.GetActorValue("Conjuration") + fPlayerEnchSkillMult * PlayerREF.GetActorValue("Enchanting")) / 100.0 + 1.0
ApplyClassBoost(akSelf, BOOST_CLASS_MAGE, _00E_Class_Phasmalist_P05_A_Shamanism_01, _00E_Class_Phasmalist_P05_A_Shamanism_02, _00E_Class_Phasmalist_P05_A_Shamanism_03) ApplyClassBoost(akSelf, BOOST_CLASS_MAGE, _00E_Class_Phasmalist_P05_A_Shamanism_01, _00E_Class_Phasmalist_P05_A_Shamanism_02, _00E_Class_Phasmalist_P05_A_Shamanism_03)
ApplyClassBoost(akSelf, BOOST_CLASS_RANGER, _00E_Class_Phasmalist_P05_B_Mischief_01, _00E_Class_Phasmalist_P05_B_Mischief_02, _00E_Class_Phasmalist_P05_B_Mischief_03) ApplyClassBoost(akSelf, BOOST_CLASS_RANGER, _00E_Class_Phasmalist_P05_B_Mischief_01, _00E_Class_Phasmalist_P05_B_Mischief_02, _00E_Class_Phasmalist_P05_B_Mischief_03)
@ -193,14 +191,14 @@ Function Setup()
If fPlayerStamina > fMaxAttributeValue If fPlayerStamina > fMaxAttributeValue
fMaxAttributeValue = fPlayerStamina fMaxAttributeValue = fPlayerStamina
EndIf EndIf
akSelf.ForceAV("Health", ((akSelf.GetBaseAV("Health") + fMaxAttributeValue * fPlayerStatsMult) * fAttributeMult) as int) akSelf.ForceActorValue("Health", ((akSelf.GetBaseAV("Health") + fMaxAttributeValue * fPlayerStatsMult) * fAttributeMult) as int)
akSelf.ForceAV("Magicka", (((akSelf.GetBaseAV("Magicka") + fMaxAttributeValue * fPlayerStatsMult) * fAttributeMult) as int) + iCurrentBoostMagicka) akSelf.ForceActorValue("Magicka", (((akSelf.GetBaseAV("Magicka") + fMaxAttributeValue * fPlayerStatsMult) * fAttributeMult) as int) + iCurrentBoostMagicka)
akSelf.ForceAV("Stamina", ((akSelf.GetBaseAV("Stamina") + fMaxAttributeValue * fPlayerStatsMult) * fAttributeMult) as int) akSelf.ForceActorValue("Stamina", ((akSelf.GetBaseAV("Stamina") + fMaxAttributeValue * fPlayerStatsMult) * fAttributeMult) as int)
Else Else
akSelf.ForceAV("Health", ((akSelf.GetBaseAV("Health") + PlayerREF.GetBaseAV("Health") * fPlayerStatsMult) * fAttributeMult) as int) akSelf.ForceActorValue("Health", ((akSelf.GetBaseAV("Health") + PlayerREF.GetBaseAV("Health") * fPlayerStatsMult) * fAttributeMult) as int)
akSelf.ForceAV("Magicka", (((akSelf.GetBaseAV("Magicka") + PlayerREF.GetBaseAV("Magicka") * fPlayerStatsMult) * fAttributeMult) as int) + iCurrentBoostMagicka) akSelf.ForceActorValue("Magicka", (((akSelf.GetBaseAV("Magicka") + PlayerREF.GetBaseAV("Magicka") * fPlayerStatsMult) * fAttributeMult) as int) + iCurrentBoostMagicka)
akSelf.ForceAV("Stamina", ((akSelf.GetBaseAV("Stamina") + PlayerREF.GetBaseAV("Stamina") * fPlayerStatsMult) * fAttributeMult) as int) akSelf.ForceActorValue("Stamina", ((akSelf.GetBaseAV("Stamina") + PlayerREF.GetBaseAV("Stamina") * fPlayerStatsMult) * fAttributeMult) as int)
EndIf EndIf
EndFunction EndFunction
@ -211,10 +209,10 @@ Function SetupBehaviour(Actor akSelf)
EndIf EndIf
akSelf.SetPlayerTeammate() akSelf.SetPlayerTeammate()
akSelf.SetAV("Confidence", 4) ; the apparition should never flee akSelf.SetActorValue("Confidence", 4) ; the apparition should never flee
akSelf.SetAV("Aggression", 0) ; the apparition should not initiate combat (-> stealth playstyle) akSelf.SetActorValue("Aggression", 0) ; the apparition should not initiate combat (-> stealth playstyle)
akSelf.SetAV("Sneak", 100) akSelf.SetActorValue("Sneak", 100)
akSelf.SetAV("Invisibility", 1) ; make the apparition undetectable when sneaking (-> stealth playstyle) akSelf.SetActorValue("Invisibility", 1) ; make the apparition undetectable when sneaking (-> stealth playstyle)
akSelf.IgnoreFriendlyHits() ; make the apparition ignore friendly fire from the PC akSelf.IgnoreFriendlyHits() ; make the apparition ignore friendly fire from the PC
EndFunction EndFunction
@ -222,19 +220,19 @@ Function SetupNotPersistentStats(Actor akSelf)
akSelf.GetActorBase().SetCombatStyle(SummonTrinket.GetUsedCombatStyle()) akSelf.GetActorBase().SetCombatStyle(SummonTrinket.GetUsedCombatStyle())
If bTeleportHealRate == False If bTeleportHealRate == False
akSelf.SetAV("HealRate", DEFAULT_HEAL_RATE) akSelf.SetActorValue("HealRate", DEFAULT_HEAL_RATE)
Else Else
akSelf.SetAV("HealRate", 0.0) akSelf.SetActorValue("HealRate", 0.0)
EndIf EndIf
akSelf.SetAV("MagickaRate", fApparitionManaRate) akSelf.SetActorValue("MagickaRate", fApparitionManaRate)
;failsafe since setav doesn't work sometimes ;failsafe since setav doesn't work sometimes
If bTeleportHealRate == False If bTeleportHealRate == False
akSelf.ForceAV("HealRate", DEFAULT_HEAL_RATE) akSelf.ForceActorValue("HealRate", DEFAULT_HEAL_RATE)
Else Else
akSelf.ForceAV("HealRate", 0.0) akSelf.ForceActorValue("HealRate", 0.0)
EndIf EndIf
akSelf.ForceAV("MagickaRate", fApparitionManaRate) akSelf.ForceActorValue("MagickaRate", fApparitionManaRate)
EndFunction EndFunction
Function ApplyClassBoost(Actor akSelf, Int iBoostClass, Perk boostPerk1, Perk boostPerk2, Perk boostPerk3) Function ApplyClassBoost(Actor akSelf, Int iBoostClass, Perk boostPerk1, Perk boostPerk2, Perk boostPerk3)
@ -262,8 +260,8 @@ Function _AddClassBoost(Actor akSelf, Int iBoostClass, Int iBoostLevel)
iDestructionPowerMod = iGhostlyMageBoostDestructionPowerMod1 iDestructionPowerMod = iGhostlyMageBoostDestructionPowerMod1
iCurrentBoostMagicka = iGhostlyMageBoostMagicka1 iCurrentBoostMagicka = iGhostlyMageBoostMagicka1
EndIf EndIf
;akSelf.ForceAV("DestructionPowerMod", akSelf.GetAV("DestructionPowerMod") + iDestructionPowerMod) ;akSelf.ForceActorValue("DestructionPowerMod", akSelf.GetActorValue("DestructionPowerMod") + iDestructionPowerMod)
akSelf.ModAV("DestructionPowerMod", iDestructionPowerMod) akSelf.ModActorValue("DestructionPowerMod", iDestructionPowerMod)
ElseIf iBoostClass == BOOST_CLASS_RANGER ElseIf iBoostClass == BOOST_CLASS_RANGER
Int iBoostArchery = 0 Int iBoostArchery = 0
Int iBoostCritChance = 0 Int iBoostCritChance = 0
@ -278,10 +276,10 @@ Function _AddClassBoost(Actor akSelf, Int iBoostClass, Int iBoostLevel)
iBoostCritChance = iGhostlyRangerBoostCritChance1 iBoostCritChance = iGhostlyRangerBoostCritChance1
EndIf EndIf
;akSelf.ForceAV("Marksman", akSelf.GetAV("Marksman") + iBoostArchery) ;akSelf.ForceActorValue("Marksman", akSelf.GetActorValue("Marksman") + iBoostArchery)
akSelf.ModAV("Marksman", iBoostArchery) akSelf.ModActorValue("Marksman", iBoostArchery)
;akSelf.ForceAV("CritChance", akSelf.GetAV("CritChance") + iBoostCritChance) ;akSelf.ForceActorValue("CritChance", akSelf.GetActorValue("CritChance") + iBoostCritChance)
akSelf.ModAV("CritChance", iBoostCritChance) akSelf.ModActorValue("CritChance", iBoostCritChance)
ElseIf iBoostClass == BOOST_CLASS_WARRIOR ElseIf iBoostClass == BOOST_CLASS_WARRIOR
Int iBoostMelee = 0 Int iBoostMelee = 0
Int iBoostArmor = 0 Int iBoostArmor = 0
@ -296,15 +294,15 @@ Function _AddClassBoost(Actor akSelf, Int iBoostClass, Int iBoostLevel)
iBoostArmor = iGhostlyWarriorBoostArmorSkill1 iBoostArmor = iGhostlyWarriorBoostArmorSkill1
EndIf EndIf
;akSelf.ForceAV("HeavyArmor", akSelf.GetAV("HeavyArmor") + iBoostArmor) ;akSelf.ForceActorValue("HeavyArmor", akSelf.GetActorValue("HeavyArmor") + iBoostArmor)
akSelf.ModAV("HeavyArmor", iBoostArmor) akSelf.ModActorValue("HeavyArmor", iBoostArmor)
;akSelf.ForceAV("LightArmor", akSelf.GetAV("LightArmor") + iBoostArmor) ;akSelf.ForceActorValue("LightArmor", akSelf.GetActorValue("LightArmor") + iBoostArmor)
akSelf.ModAV("LightArmor", iBoostArmor) akSelf.ModActorValue("LightArmor", iBoostArmor)
; MeleeDamage AV seems to be not working, it's actually always zero ; MeleeDamage AV seems to be not working, it's actually always zero
;akSelf.ForceAV("MeleeDamage", akSelf.GetAV("MeleeDamage") + iBoostMelee) ;akSelf.ForceActorValue("MeleeDamage", akSelf.GetActorValue("MeleeDamage") + iBoostMelee)
;akSelf.ModAV("MeleeDamage", iBoostMelee) ;akSelf.ModActorValue("MeleeDamage", iBoostMelee)
akSelf.ModAV("OneHanded", iBoostMelee) akSelf.ModActorValue("OneHanded", iBoostMelee)
akSelf.ModAV("TwoHanded", iBoostMelee) akSelf.ModActorValue("TwoHanded", iBoostMelee)
Else Else
Debug.Notification("Phasmalist Control Quest has issues: Unsupported boost class " + iBoostClass) Debug.Notification("Phasmalist Control Quest has issues: Unsupported boost class " + iBoostClass)
EndIf EndIf
@ -318,6 +316,8 @@ Endfunction
Function Unsummon(Bool bSilent) Function Unsummon(Bool bSilent)
Actor akSelf = self.GetActorReference() Actor akSelf = self.GetActorReference()
HealthBarManager.Hide(akSelf)
GoToState("") GoToState("")
AliasFailsafeRef = None AliasFailsafeRef = None
@ -334,11 +334,13 @@ Function Unsummon(Bool bSilent)
akSelf.RemoveAllItems((akSelf.GetActorBase() as _00E_Phasmalist_ApparationSC).inventoryContainer, False, True) akSelf.RemoveAllItems((akSelf.GetActorBase() as _00E_Phasmalist_ApparationSC).inventoryContainer, False, True)
akSelf.Disable() akSelf.Disable()
Self.Clear() Self.Clear()
ForgottenStoriesMiscDialogue.hideActorHealthBars(akSelf)
SummonTrinket = None SummonTrinket = None
Utility.wait(1.0)
akSelf.Delete() akSelf.Delete()
SendModEvent("Phasmalist_ApparationUnSummon") SendModEvent("Phasmalist_ApparationUnSummon")
EndFunction EndFunction
Function AddArcaneFever() Function AddArcaneFever()
@ -377,10 +379,10 @@ Function AddArcaneFever()
Float fArcaneFeverAdd = fMaxArcaneFeverAdd * fHealthLostPercentage Float fArcaneFeverAdd = fMaxArcaneFeverAdd * fHealthLostPercentage
If fArcaneFeverAdd > 0 If fArcaneFeverAdd > 0
PlayerREF.ModAV("LastFlattered", -fArcaneFeverAdd) PlayerREF.ModActorValue("LastFlattered", -fArcaneFeverAdd)
_00E_ArkanistenfieberIMOD.ApplyCrossFade() _00E_ArkanistenfieberIMOD.ApplyCrossFade()
_00E_FS_IncreaseArcaneFeverM.Play(PlayerREF) _00E_FS_IncreaseArcaneFeverM.Play(PlayerREF)
_00E_Player_sArcaneFeverIncreased.Show(fArcaneFeverAdd, -1 * PlayerREF.GetAV("LastFlattered")) _00E_Player_sArcaneFeverIncreased.Show(fArcaneFeverAdd, -1 * PlayerREF.GetActorValue("LastFlattered"))
EndIf EndIf
EndFunction EndFunction
@ -409,7 +411,7 @@ Function TeleportToPlayer(Bool bTeleportInFront, Bool bSilent)
; Zero out-of-combat heal rate for teleport and a few seconds after it. ; Zero out-of-combat heal rate for teleport and a few seconds after it.
; This is to prevent the apparition regenerating health IN combat on "Call Apparition" spam. ; This is to prevent the apparition regenerating health IN combat on "Call Apparition" spam.
UnregisterForUpdate() UnregisterForUpdate()
akSelf.ForceAV("HealRate", 0.0) akSelf.ForceActorValue("HealRate", 0.0)
bTeleportHealRate = True bTeleportHealRate = True
akSelf.Disable() akSelf.Disable()
@ -634,7 +636,7 @@ EndFunction
Function _ShowHealthBar() Function _ShowHealthBar()
Actor akSelf = Self.GetActorReference() Actor akSelf = Self.GetActorReference()
If akSelf && akSelf.IsDead() == False If akSelf && akSelf.IsDead() == False
ForgottenStoriesMiscDialogue.showActorHealthBars(akSelf) HealthBarManager.Show(akSelf)
EndIf EndIf
EndFunction EndFunction
@ -777,7 +779,7 @@ State Working
Event OnUpdate() Event OnUpdate()
If bTeleportHealRate If bTeleportHealRate
bTeleportHealRate = False bTeleportHealRate = False
GetActorReference().ForceAV("HealRate", DEFAULT_HEAL_RATE) GetActorReference().ForceActorValue("HealRate", DEFAULT_HEAL_RATE)
EndIf EndIf
EndEvent EndEvent

View File

@ -19,6 +19,7 @@ Event OnInit()
Utility.WaitMenuMode(0.1) Utility.WaitMenuMode(0.1)
EndWhile EndWhile
CheckForgottenStories()
_00E_Func_CheckDependencies.CheckDependencies() _00E_Func_CheckDependencies.CheckDependencies()
If fPatchVersion == 0.00 If fPatchVersion == 0.00
@ -50,6 +51,7 @@ EndEvent
Event OnPlayerLoadGame() Event OnPlayerLoadGame()
If self == (PlayerREF as ObjectReference) ; A check just in case. Most likely this condition is always True If self == (PlayerREF as ObjectReference) ; A check just in case. Most likely this condition is always True
CheckForgottenStories()
_00E_Func_CheckDependencies.CheckDependencies() _00E_Func_CheckDependencies.CheckDependencies()
Maintenance() Maintenance()
If GetState() != "RealPlayer" ; Post-1.2.5.0 version update If GetState() != "RealPlayer" ; Post-1.2.5.0 version update
@ -237,6 +239,16 @@ EndFunction
; MAINTENANCE ; MAINTENANCE
;===================================================================================== ;=====================================================================================
function CheckForgottenStories()
; If Enderal - Forgotten Stories.esm is not loaded, kick the player back to main menu
if (Game.GetForm(0x4320E) as GlobalVariable).GetValue() as Int != 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.")
return
EndIf
endfunction
Function Maintenance() Function Maintenance()
if fPatchVersion <= 1.62 if fPatchVersion <= 1.62

View File

@ -899,19 +899,17 @@ Function SetNPCAsCompanion(Actor akActor, bool bCompanion = True, int iCompanion
;Sets an NPC as companion, showing his health bar, making him friendly, unflagging him as ghost. Does the opposite when bCompanion is set to false. ;Sets an NPC as companion, showing his health bar, making him friendly, unflagging him as ghost. Does the opposite when bCompanion is set to false.
;Additionally sets the AVs Health, Stamina, Magicka for the NPC companion ;Additionally sets the AVs Health, Stamina, Magicka for the NPC companion
_00E_FS_ForgottenStories_Functions ForgottenStoriesMiscDialogue = Game.GetFormFromFile(0x01016E89, "Enderal - Forgotten Stories.esm") as _00E_FS_ForgottenStories_Functions
If bCompanion If bCompanion
akActor.SetRelationshipRank(Game.GetPlayer(), 3) akActor.SetRelationshipRank(Game.GetForm(0x14) as Actor, 3)
akActor.SetGhost(False) akActor.SetGhost(False)
akActor.getActorbase().SetEssential(true) ; just in case, had trouble with FS_NQR05 akActor.getActorbase().SetEssential(true) ; just in case, had trouble with FS_NQR05
akActor.SetPlayerTeammate(True) akActor.SetPlayerTeammate(True)
akActor.IgnoreFriendlyHits() akActor.IgnoreFriendlyHits()
akActor.SetAV("Health", iCompanionHealth) akActor.SetActorValue("Health", iCompanionHealth)
akActor.SetAV("Stamina", iCompanionStamina) akActor.SetActorValue("Stamina", iCompanionStamina)
akActor.SetAV("Magicka", iCompanionMagicka) akActor.SetActorValue("Magicka", iCompanionMagicka)
ForgottenStoriesMiscDialogue.showActorHealthBars(akActor) HealthBarManager.Show(akActor)
Else Else
@ -920,7 +918,7 @@ Function SetNPCAsCompanion(Actor akActor, bool bCompanion = True, int iCompanion
akActor.ResetHealthAndLimbs() akActor.ResetHealthAndLimbs()
akActor.SetPlayerTeammate(False) akActor.SetPlayerTeammate(False)
akActor.IgnoreFriendlyHits(False) akActor.IgnoreFriendlyHits(False)
ForgottenStoriesMiscDialogue.hideActorHealthBars(akActor) HealthBarManager.Hide(akActor)
EndIf EndIf