Moved armor set listener to a separate quest

This commit is contained in:
Eddoursul 2024-01-05 21:06:45 +01:00
parent cc4c637b52
commit d66445da5b
6 changed files with 27 additions and 11 deletions

BIN
Armor set listener.esp Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,22 @@
Scriptname _00E_ArmorSetListener extends Quest Hidden
Function OnArmorSetBonusAdded(Bool bFullSet)
Sound.SetInstanceVolume(MAGIllusionCharm.Play(PlayerREF), 0.4) ; Play MAGIllusionCharm at lower volume
If bFullSet && ! bSetAchievementUnlocked
Steam.UnlockAchievement("END_SET_01")
bSetAchievementUnlocked = True
EndIf
EndFunction
Function OnArmorSetBonusRemoved()
_00E_ArmorSetScript_sSetBonusRemoved.Show()
EndFunction
bool bSetAchievementUnlocked = false
Sound Property MAGIllusionCharm Auto
Actor Property PlayerRef Auto
Message Property _00E_ArmorSetScript_sSetBonusRemoved Auto

View File

@ -7,7 +7,7 @@ Scriptname _00E_ArmorSetScript extends ObjectReference
Event OnEquipped(Actor akActor) Event OnEquipped(Actor akActor)
If akActor == PlayerREF If akActor == PlayerREF
;this event won't be sent by SKSE / SkyUI when using he Equip Mode of SkyUI to directly equip an item from another container. ;this event won't be sent by SKSE / SkyUI when using the Equip Mode of SkyUI to directly equip an item from another container.
;the same goes for the OnObjectEquipped event, hence we need the work around in OnContainerChanged ;the same goes for the OnObjectEquipped event, hence we need the work around in OnContainerChanged
UpdateSpells() UpdateSpells()
EndIf EndIf
@ -43,15 +43,9 @@ EndEvent
Function UpdateSpells() Function UpdateSpells()
Int iIndex Int iIndex = 0
If Levelsystem == None
Levelsystem = Game.GetFormFromFile(0x00010AA2, "Skyrim.esm") As _00E_Questfunctions
EndIf
Int nEquippedPieces = 0 Int nEquippedPieces = 0
Form[] setPieces = __Config_SetList.ToArray() Form[] setPieces = __Config_SetList.ToArray()
iIndex = 0
While iIndex < setPieces.Length While iIndex < setPieces.Length
If PlayerREF.IsEquipped(setPieces[iIndex] as Armor) If PlayerREF.IsEquipped(setPieces[iIndex] as Armor)
nEquippedPieces += 1 nEquippedPieces += 1
@ -86,9 +80,9 @@ Function UpdateSpells()
EndWhile EndWhile
If bSpellAdded If bSpellAdded
Levelsystem.OnArmorSetBonusAdded(nEquippedPieces >= setPieces.Length) ArmorSetListener.OnArmorSetBonusAdded(nEquippedPieces >= setPieces.Length)
ElseIf bSpellRemoved ElseIf bSpellRemoved
Levelsystem.OnArmorSetBonusRemoved() ArmorSetListener.OnArmorSetBonusRemoved()
EndIf EndIf
EndFunction EndFunction
@ -101,7 +95,7 @@ EndFunction
Bool Property __Config_5Pieces Auto Bool Property __Config_5Pieces Auto
{Does this set have five pieces? Default: False} {Does this set have five pieces? Default: False}
_00E_Questfunctions Property Levelsystem Auto _00E_ArmorSetListener Property ArmorSetListener Auto
GlobalVariable Property __Config_SetGlobal Auto GlobalVariable Property __Config_SetGlobal Auto
{The global associated with this set. Example _25E_HSet_FallenOneGlobal.} {The global associated with this set. Example _25E_HSet_FallenOneGlobal.}