enderalse/scripts/source/_00e_lootcontainer.psc

76 lines
2.1 KiB
Plaintext

Scriptname _00E_LootContainer extends ObjectReference
;=====================================================================================
; EVENTS
;=====================================================================================
Event OnInit()
Self.BlockActivation(True)
EndEvent
Event OnActivate(ObjectReference akActionRef)
if AkActionRef == Game.GetPlayer() && Self.GetItemCount(Gold001) > 0
if !bDone
CheckForGoldIncrementation()
EndIf
;RemoveAllItems(Game.GetPlayer(), abKeepOwnership = true)
ITMGoldUp.Play(PlayerREF)
Game.GetPlayer().AddItem(Gold001, Self.GetItemCount(Gold001))
DisableNoWait()
endif
EndEvent
;=====================================================================================
; FUNCTIONS
;=====================================================================================
Function CheckForGoldIncrementation()
if _00E_FS_IsForgottenStoriesActivated.GetValueInt() == 1
bDone = True
iCurrentGoldCount = Self.GetItemCount(Gold001)
fPlayerLockpicking = PlayerREF.GetActorValue("Lockpicking")
if fPlayerLockpicking >= 15
IncrementGold()
EndIf
EndIf
EndFunction
Function IncrementGold()
float fIncrementPercentage = (fPlayerLockpicking/iGoldMultiplicator)/100
Self.AddItem(Gold001, (iCurrentGoldCount*fIncrementPercentage) as Int)
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
bool bDone
; Use this to control how much the lockpicking skill increments the gold found in chest. When changing, remember to change in _00E_ChestAndDoorLockScript.psc as well!
; Current calculation: Gold in chest*((Lockpicking/iGoldMultiplicator)/100)
int iGoldMultiplicator = 5
float fPlayerLockpicking
int iCurrentGoldCount
GlobalVariable Property _00E_FS_IsForgottenStoriesActivated Auto
Actor Property PlayerREF Auto
Sound Property ITMGoldUp Auto
MiscObject Property Gold001 Auto