enderalse/source/scripts/_00e_phasmalist_soul.psc

97 lines
2.7 KiB
Plaintext

Scriptname _00E_Phasmalist_Soul extends ObjectReference
bool Property enabled = true Auto
bool Property bPerkUpdate Auto Hidden
_00E_FS_NQ09_Functions Property FS_NQ09 Auto
ImageSpaceModifier Property _00E_Phasmalist_PickUpSoulIMOD Auto
GlobalVariable Property _00E_Phasmalist_CanSeeSoulsLevel auto
Formlist Property _00E_Phasmalist_LoadedSouls auto
int Property soulLevel auto
{should be in range [1;5]}
Keyword Property _00E_Phasmalist_LinkedSoul auto
Keyword Property _00E_Phasmalist_LinkedSoulSound auto
Explosion Property _00E_Phasmalist_SoulBecomeVisibleExp auto
Sound Property MAGConjureFire Auto
MiscObject Property BaseObject Auto
Message Property _00E_FS_Phasmalist_TierTooLowMSG Auto
_FS_Phasmalist_ControlQuest Property controlQuest auto
; necessary to prevent the player activate the soul twice in fast succession and getting two,
; because of concurrent execution of OnActivate
bool taken = False
Event OnCellAttach()
updateCanSee(false)
_00E_Phasmalist_LoadedSouls.addform(self)
Endevent
Event OnCellDetach()
_00E_Phasmalist_LoadedSouls.removeaddedform(self)
Endevent
Event OnLoad()
BaseObject = self.getBaseObject() as MiscObject
;getLinkedRef(_00E_Phasmalist_LinkedSoul).moveto(self);unnecessary
Endevent
Event OnActivate(ObjectReference akActivator)
If !taken
taken = true
If !FS_NQ09.IsRunning()
FS_NQ09.SetStage(5)
EndIf
FS_NQ09.UpdateSoulCount()
_00E_Phasmalist_LoadedSouls.removeaddedform(self)
controlQuest.OnPlayerSoulCollected()
If getLinkedRef(_00E_Phasmalist_LinkedSoulSound) != None
getLinkedRef(_00E_Phasmalist_LinkedSoulSound).disable()
EndIf
_00E_Phasmalist_PickUpSoulIMOD.Apply()
MAGConjureFire.Play(Game.GetPlayer())
self.Activate(akActivator, true)
EndIf
Endevent
function updateCanSee(bool playExp = true)
If _00E_Phasmalist_CanSeeSoulsLevel.getValue() >= soulLevel && bPerkUpdate && enabled
parent.enable()
If playExp
self.placeatme(_00E_Phasmalist_SoulBecomeVisibleExp)
EndIf
Else
If _00E_Phasmalist_CanSeeSoulsLevel.getValue() < soulLevel && bPerkUpdate
_00E_FS_Phasmalist_TierTooLowMSG.Show()
EndIf
parent.disable()
;getLinkedRef(_00E_Phasmalist_LinkedSoul).disable();unnecessary
EndIf
self.blockActivation()
Endfunction
Function enable(bool abFadeIn = false) ; unused
enabled = true
If getLinkedRef(_00E_Phasmalist_LinkedSoulSound) != None
getLinkedRef(_00E_Phasmalist_LinkedSoulSound).enable()
EndIf
updateCanSee(true)
Endfunction
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
If akOldContainer == Game.getPlayer()
If akNewContainer == None
akOldContainer.Additem(self)
Else
akOldContainer.Additem(BaseObject)
akNewContainer.RemoveItem(BaseObject)
EndIf
EndIf
EndEvent