diff --git a/Enderal - Forgotten Stories.esm b/Enderal - Forgotten Stories.esm index c413306a..ef312f38 100644 Binary files a/Enderal - Forgotten Stories.esm and b/Enderal - Forgotten Stories.esm differ diff --git a/Skyrim.esm b/Skyrim.esm index 52cc6a13..0adbe419 100644 Binary files a/Skyrim.esm and b/Skyrim.esm differ diff --git a/scripts/_00e_lootcontainer.pex b/scripts/_00e_lootcontainer.pex index 9b67c8a6..bbc9fc56 100644 Binary files a/scripts/_00e_lootcontainer.pex and b/scripts/_00e_lootcontainer.pex differ diff --git a/source/scripts/_00e_lootcontainer.psc b/source/scripts/_00e_lootcontainer.psc index 6acc9358..0997d6c1 100644 --- a/source/scripts/_00e_lootcontainer.psc +++ b/source/scripts/_00e_lootcontainer.psc @@ -5,25 +5,29 @@ Scriptname _00E_LootContainer extends ObjectReference ;===================================================================================== Event OnInit() - - Self.BlockActivation(True) - + BlockActivation() EndEvent Event OnActivate(ObjectReference akActionRef) - if AkActionRef == Game.GetPlayer() && Self.GetItemCount(Gold001) > 0 + Actor PlayerREF = Game.GetForm(0x14) as Actor + + if AkActionRef != PlayerREF + return + endif + + int iCurrentGoldCount = GetItemCount(Gold001) + + if iCurrentGoldCount == 0 + return + endif - if !bDone - CheckForGoldIncrementation() - EndIf + DisableNoWait() - ;RemoveAllItems(Game.GetPlayer(), abKeepOwnership = true) - ITMGoldUp.Play(PlayerREF) - Game.GetPlayer().AddItem(Gold001, Self.GetItemCount(Gold001)) - DisableNoWait() - - endif + iCurrentGoldCount += GetGoldBonus(PlayerREF.GetActorValue("Lockpicking"), iCurrentGoldCount) + PlayerREF.AddItem(Gold001, iCurrentGoldCount) + + RemoveAllItems() EndEvent @@ -31,24 +35,21 @@ EndEvent ; FUNCTIONS ;===================================================================================== -Function CheckForGoldIncrementation() +int Function GetGoldBonus(float fPlayerLockpicking, int iCurrentGoldCount) - bDone = True - - iCurrentGoldCount = Self.GetItemCount(Gold001) - fPlayerLockpicking = PlayerREF.GetActorValue("Lockpicking") - - if fPlayerLockpicking >= 15 - IncrementGold() - EndIf - -EndFunction + if fPlayerLockpicking as int < 15 + return 0 + endif -Function IncrementGold() + int iGoldMultiplicator = _00E_GoldMult.GetValue() as int + + if iGoldMultiplicator <= 0 + iGoldMultiplicator = 5 + endif - float fIncrementPercentage = (fPlayerLockpicking/iGoldMultiplicator)/100 + float fIncrementPercentage = (fPlayerLockpicking / iGoldMultiplicator) / 100 - Self.AddItem(Gold001, (iCurrentGoldCount*fIncrementPercentage) as Int) + return (iCurrentGoldCount * fIncrementPercentage) as Int EndFunction @@ -56,15 +57,5 @@ 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 - -Actor Property PlayerREF Auto -Sound Property ITMGoldUp Auto -MiscObject Property Gold001 Auto \ No newline at end of file +MiscObject Property Gold001 Auto +GlobalVariable Property _00E_GoldMult Auto