enderalse/source/scripts/_00e_fs_spectralchestsc.psc

68 lines
1.9 KiB
Plaintext

Scriptname _00E_FS_SpectralChestSC extends ActiveMagicEffect
;=====================================================================================
; EVENTS
;=====================================================================================
Event OnEffectStart(Actor akTarget, Actor akCaster)
If PlayerREF.GetParentCell() == MQ05Jail
_00E_FS_SpectralChestNotHere.Show()
ElseIf PlayerREF.IsInCombat()
_00E_FS_SpectralChestNotInCombat.Show()
Else
Float newCarryWeight = Self.GetMagnitude() + PlayerREF.GetActorValue("Alteration")
_00E_FS_SpectralChestActorREF.SetActorValue("CarryWeight", newCarryWeight)
_00E_FS_SpectralChestActorREF.SetPlayerTeammate(True, True)
Utility.Wait(0.1)
_00E_FS_SpectralChestCapacity.Show(_00E_FS_SpectralChestActorREF.GetTotalItemWeight(), newCarryWeight)
_00E_FS_SpectralChestActorREF.OpenInventory()
DRScTreasureOpen.Play(PlayerREF)
EndIf
EndEvent
Float Function GetCurrentWeight(Actor akActor)
Int NumItems = akActor.GetNumItems()
Int i = 0
Float fCurrentWeight
While (i < NumItems)
Form Entry = akActor.GetNthForm(i)
Float fEntryItemCount = akActor.GetItemCount(Entry) as Float
; iCurrentWeight += math.Ceiling(Entry.GetWeight() * iEntryItemCount)
fCurrentWeight += Entry.GetWeight() * fEntryItemCount
i += 1
EndWhile
Return fCurrentWeight
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
Actor Property PlayerREF Auto
Actor Property _00E_FS_SpectralChestActorREF Auto
Sound Property DRScTreasureOpen Auto
Message Property _00E_FS_SpectralChestNotHere Auto
Message Property _00E_FS_SpectralChestNotInCombat Auto
Message Property _00E_FS_SpectralChestCapacity Auto
Cell Property MQ05Jail Auto