62 lines
1.7 KiB
Plaintext
62 lines
1.7 KiB
Plaintext
Scriptname _00E_LootContainer extends ObjectReference
|
|
|
|
;=====================================================================================
|
|
; EVENTS
|
|
;=====================================================================================
|
|
|
|
Event OnInit()
|
|
BlockActivation()
|
|
EndEvent
|
|
|
|
Event OnActivate(ObjectReference akActionRef)
|
|
|
|
Actor PlayerREF = Game.GetForm(0x14) as Actor
|
|
|
|
if AkActionRef != PlayerREF
|
|
return
|
|
endif
|
|
|
|
int iCurrentGoldCount = GetItemCount(Gold001)
|
|
|
|
if iCurrentGoldCount == 0
|
|
return
|
|
endif
|
|
|
|
DisableNoWait()
|
|
|
|
iCurrentGoldCount += GetGoldBonus(PlayerREF.GetActorValue("Lockpicking"), iCurrentGoldCount)
|
|
PlayerREF.AddItem(Gold001, iCurrentGoldCount)
|
|
|
|
RemoveAllItems()
|
|
|
|
EndEvent
|
|
|
|
;=====================================================================================
|
|
; FUNCTIONS
|
|
;=====================================================================================
|
|
|
|
int Function GetGoldBonus(float fPlayerLockpicking, int iCurrentGoldCount)
|
|
|
|
if fPlayerLockpicking as int < 15
|
|
return 0
|
|
endif
|
|
|
|
int iGoldMultiplicator = _00E_GoldMult.GetValue() as int
|
|
|
|
if iGoldMultiplicator <= 0
|
|
iGoldMultiplicator = 5
|
|
endif
|
|
|
|
float fIncrementPercentage = (fPlayerLockpicking / iGoldMultiplicator) / 100
|
|
|
|
return (iCurrentGoldCount * fIncrementPercentage) as Int
|
|
|
|
EndFunction
|
|
|
|
;=====================================================================================
|
|
; PROPERTIES
|
|
;=====================================================================================
|
|
|
|
MiscObject Property Gold001 Auto
|
|
GlobalVariable Property _00E_GoldMult Auto
|