Rewrote _00E_LootContainer, fixed double sound on picking up gold stacks
This commit is contained in:
parent
cd2f15bdf6
commit
755f068713
Binary file not shown.
BIN
Skyrim.esm
BIN
Skyrim.esm
Binary file not shown.
Binary file not shown.
@ -5,50 +5,51 @@ Scriptname _00E_LootContainer extends ObjectReference
|
||||
;=====================================================================================
|
||||
|
||||
Event OnInit()
|
||||
|
||||
Self.BlockActivation(True)
|
||||
|
||||
BlockActivation()
|
||||
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()
|
||||
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
|
||||
;=====================================================================================
|
||||
|
||||
Function CheckForGoldIncrementation()
|
||||
int Function GetGoldBonus(float fPlayerLockpicking, int iCurrentGoldCount)
|
||||
|
||||
bDone = True
|
||||
if fPlayerLockpicking as int < 15
|
||||
return 0
|
||||
endif
|
||||
|
||||
iCurrentGoldCount = Self.GetItemCount(Gold001)
|
||||
fPlayerLockpicking = PlayerREF.GetActorValue("Lockpicking")
|
||||
int iGoldMultiplicator = _00E_GoldMult.GetValue() as int
|
||||
|
||||
if fPlayerLockpicking >= 15
|
||||
IncrementGold()
|
||||
EndIf
|
||||
if iGoldMultiplicator <= 0
|
||||
iGoldMultiplicator = 5
|
||||
endif
|
||||
|
||||
EndFunction
|
||||
float fIncrementPercentage = (fPlayerLockpicking / iGoldMultiplicator) / 100
|
||||
|
||||
Function IncrementGold()
|
||||
|
||||
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
|
||||
GlobalVariable Property _00E_GoldMult Auto
|
||||
|
Loading…
Reference in New Issue
Block a user