2021-10-05 22:15:58 +00:00
|
|
|
Scriptname _00E_FS_MysticalSpellBookSC extends ObjectReference
|
|
|
|
|
|
|
|
;=====================================================================================
|
|
|
|
; EVENTS
|
|
|
|
;=====================================================================================
|
|
|
|
|
|
|
|
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
|
|
|
|
|
|
|
|
If akNewContainer == PlayerREF
|
|
|
|
bIsInInventory = True
|
|
|
|
Else
|
|
|
|
bIsInInventory = False
|
|
|
|
EndIf
|
|
|
|
|
|
|
|
EndEvent
|
|
|
|
|
|
|
|
Event OnRead()
|
|
|
|
|
|
|
|
If bIsInInventory
|
|
|
|
|
|
|
|
If !PlayerREF.HasPerk(requiredPerk) || PlayerREF.GetActorValue(sSchool) < 90
|
|
|
|
_00E_FS_MysticalSpellBookMSG.Show()
|
|
|
|
ElseIf PlayerREF.HasSpell(spellToTeach)
|
|
|
|
_00E_FS_AlreadyKnowMysticalSpellMSG.Show()
|
|
|
|
Else
|
|
|
|
PlayerREF.RemoveItem(selfRef, 1)
|
|
|
|
PlayerREF.AddSpell(spellToTeach, true)
|
|
|
|
UISpellLearnedM.Play(PlayerREF)
|
|
|
|
|
|
|
|
If _00E_AchievementsEnabled.GetValueInt() == 1 && _00E_MysticalSpellAchievementUnlocked.GetValueInt() == 0
|
2022-08-03 21:19:58 +00:00
|
|
|
Steam.UnlockAchievement("END_MYTHICAL_SPELL_01")
|
2021-10-05 22:15:58 +00:00
|
|
|
_00E_MysticalSpellAchievementUnlocked.SetValueInt(1)
|
|
|
|
EndIf
|
|
|
|
|
|
|
|
EndIf
|
|
|
|
|
|
|
|
EndIf
|
|
|
|
|
|
|
|
EndEvent
|
|
|
|
|
|
|
|
;=====================================================================================
|
|
|
|
; PROPERTIES
|
|
|
|
;=====================================================================================
|
|
|
|
|
|
|
|
bool bIsInInventory
|
|
|
|
String Property sSchool Auto
|
|
|
|
Perk Property requiredPerk Auto
|
|
|
|
Actor Property PlayerREF Auto
|
|
|
|
Message Property _00E_FS_MysticalSpellBookMSG Auto
|
|
|
|
Message Property _00E_FS_AlreadyKnowMysticalSpellMSG Auto
|
|
|
|
Sound Property UISpellLearnedM Auto
|
|
|
|
Book Property selfRef Auto ;needs property because the objectreference can't be obtained and removed in the inventory
|
|
|
|
Spell Property spellToTeach Auto
|
|
|
|
GlobalVariable Property _00E_AchievementsEnabled Auto
|
|
|
|
GlobalVariable Property _00E_MysticalSpellAchievementUnlocked Auto
|