enderalse/source/scripts/_00e_fs_mysticalspellbooksc.psc

55 lines
1.8 KiB
Plaintext
Raw Normal View History

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
Game.UnlockAchievement("END_MYTHICAL_SPELL_01")
_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