Rewrote _00E_LootContainer, fixed double sound on picking up gold stacks

This commit is contained in:
Eddoursul 2024-02-05 14:15:49 +01:00
parent cd2f15bdf6
commit 755f068713
4 changed files with 32 additions and 41 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -5,25 +5,29 @@ Scriptname _00E_LootContainer extends ObjectReference
;===================================================================================== ;=====================================================================================
Event OnInit() Event OnInit()
BlockActivation()
Self.BlockActivation(True)
EndEvent EndEvent
Event OnActivate(ObjectReference akActionRef) Event OnActivate(ObjectReference akActionRef)
if AkActionRef == Game.GetPlayer() && Self.GetItemCount(Gold001) > 0 Actor PlayerREF = Game.GetForm(0x14) as Actor
if !bDone if AkActionRef != PlayerREF
CheckForGoldIncrementation() return
EndIf
;RemoveAllItems(Game.GetPlayer(), abKeepOwnership = true)
ITMGoldUp.Play(PlayerREF)
Game.GetPlayer().AddItem(Gold001, Self.GetItemCount(Gold001))
DisableNoWait()
endif endif
int iCurrentGoldCount = GetItemCount(Gold001)
if iCurrentGoldCount == 0
return
endif
DisableNoWait()
iCurrentGoldCount += GetGoldBonus(PlayerREF.GetActorValue("Lockpicking"), iCurrentGoldCount)
PlayerREF.AddItem(Gold001, iCurrentGoldCount)
RemoveAllItems()
EndEvent EndEvent
@ -31,24 +35,21 @@ EndEvent
; FUNCTIONS ; FUNCTIONS
;===================================================================================== ;=====================================================================================
Function CheckForGoldIncrementation() int Function GetGoldBonus(float fPlayerLockpicking, int iCurrentGoldCount)
bDone = True if fPlayerLockpicking as int < 15
return 0
iCurrentGoldCount = Self.GetItemCount(Gold001) endif
fPlayerLockpicking = PlayerREF.GetActorValue("Lockpicking")
if fPlayerLockpicking >= 15
IncrementGold()
EndIf
EndFunction
Function IncrementGold() int iGoldMultiplicator = _00E_GoldMult.GetValue() as int
float fIncrementPercentage = (fPlayerLockpicking/iGoldMultiplicator)/100
Self.AddItem(Gold001, (iCurrentGoldCount*fIncrementPercentage) as Int) if iGoldMultiplicator <= 0
iGoldMultiplicator = 5
endif
float fIncrementPercentage = (fPlayerLockpicking / iGoldMultiplicator) / 100
return (iCurrentGoldCount * fIncrementPercentage) as Int
EndFunction EndFunction
@ -56,15 +57,5 @@ EndFunction
; PROPERTIES ; PROPERTIES
;===================================================================================== ;=====================================================================================
bool bDone MiscObject Property Gold001 Auto
GlobalVariable Property _00E_GoldMult Auto
; 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
Actor Property PlayerREF Auto
Sound Property ITMGoldUp Auto
MiscObject Property Gold001 Auto