Fixed Chymicum Vitality bonus getting stuck after expiration

This commit is contained in:
Eddoursul 2024-08-07 03:18:27 +02:00
parent bcf2bcd41b
commit ef2a9fc681
2 changed files with 7 additions and 9 deletions

View File

@ -152,11 +152,7 @@ Function TransformBack()
;MagicEffect _00E_FS_Affinity_ScourgeOfTheWilds_TitanME = Game.GetFormFromFile(0x0102F19F, "Enderal - Forgotten Stories.esm") as MagicEffect ;MagicEffect _00E_FS_Affinity_ScourgeOfTheWilds_TitanME = Game.GetFormFromFile(0x0102F19F, "Enderal - Forgotten Stories.esm") as MagicEffect
Actor PlayerREF = self.getActorReference() Actor PlayerREF = Game.GetForm(0x14) as Actor
if ! PlayerREF
PlayerREF = Game.GetForm(0x14) as Actor
endif
If PlayerREF.dispelSpell(_00E_FS_Affinity_ScourgeOfTheWilds_TitanSP) If PlayerREF.dispelSpell(_00E_FS_Affinity_ScourgeOfTheWilds_TitanSP)
while PlayerREF.getscale() > fPlayerScale while PlayerREF.getscale() > fPlayerScale
@ -179,9 +175,10 @@ Function OnWolfFormSpellEnd()
self.clear() self.clear()
wolf.removeSpell(_00E_Theriantrophist_DetectLifeBaseSP) wolf.removeSpell(_00E_Theriantrophist_DetectLifeBaseSP)
wolf.removeItem(_00E_Theriantrophist_Claws, 100, abSilent = true) wolf.removeItem(_00E_Theriantrophist_Claws, 100, abSilent = true)
; Dispel chymicum effects before all other effects to properly restore values
_DispelAllChymikums()
WolfAttributes.SetInWolfForm(false) WolfAttributes.SetInWolfForm(false)
EquipementStorage.equipeItems() EquipementStorage.equipeItems()
_DispelAllChymikums()
EndFunction EndFunction
Function TransformBackIfTransformed() Function TransformBackIfTransformed()
@ -191,7 +188,7 @@ Function TransformBackIfTransformed()
Endfunction Endfunction
Bool Function IsTransformed() Bool Function IsTransformed()
return self.getActorReference() != None return _00E_Theriantrophist_IsTransformed.GetValueInt() == 1
Endfunction Endfunction
Function _TeachTransformBackTalent() Function _TeachTransformBackTalent()
@ -453,12 +450,13 @@ Endfunction
State Transfomed State Transfomed
Event OnBeginState() Event OnBeginState()
_00E_Theriantrophist_IsTransformed.setValue(1)
_UpdateChymikumTransformed() _UpdateChymikumTransformed()
RegisterForControl("Sneak") RegisterForControl("Sneak")
SendModEvent("Theriantrophist_Transformed") SendModEvent("Theriantrophist_Transformed")
Sneaking = false Sneaking = false
AddInventoryEventFilter(_00E_Theriantrophist_Claws) AddInventoryEventFilter(_00E_Theriantrophist_Claws)
; Change _00E_Theriantrophist_IsTransformed after applying chymicum effects in order to properly restire values
_00E_Theriantrophist_IsTransformed.setValue(1)
Endevent Endevent
Event OnEndState() Event OnEndState()
@ -468,7 +466,7 @@ State Transfomed
Sneaking = false Sneaking = false
ControlQuest.GetAffinityControl().OnSneak(false) ControlQuest.GetAffinityControl().OnSneak(false)
Endif Endif
_UpdateChymikumTransformedBack() _DispelAllChymikums()
_00E_Theriantrophist_IsTransformed.setValue(0) _00E_Theriantrophist_IsTransformed.setValue(0)
SendModEvent("Theriantrophist_TransformedBack") SendModEvent("Theriantrophist_TransformedBack")
UnRegisterForControl("Sneak") UnRegisterForControl("Sneak")