4
Fork 0

Reworked lockpicking and pickpocketing bonuses to work without SKSE

development
Eddoursul 2 months ago
parent b533356da8
commit 99503f69b7
  1. BIN
      Lockpicking perk update.esp
  2. BIN
      scripts/PRKF__00E_LockpickingBonusPe_030020DA.pex
  3. BIN
      scripts/PRKF__00E_LockpickingReqPerk_030039BA.pex
  4. BIN
      scripts/_00E_ContainerBonusControl.pex
  5. BIN
      scripts/_00E_ContainerController.pex
  6. BIN
      scripts/_00E_HiddenSlotContainer.pex
  7. 5
      scripts/scriptarchiveorder.txt
  8. 15
      source/scripts/PRKF__00E_LockpickingBonusPe_030020DA.psc
  9. 19
      source/scripts/PRKF__00E_LockpickingReqPerk_030039BA.psc
  10. 163
      source/scripts/_00E_ContainerBonusControl.psc
  11. 16
      source/scripts/_00E_HiddenSlotContainer.psc

Binary file not shown.

@ -413,7 +413,10 @@ scripts\_00e_complexscenetriggerscript.pex
scripts\_00e_complexsermontriggerbox.pex
scripts\_00e_complexsetstageonaliasdeath.pex
scripts\_00e_complexstartscenescript.pex
scripts\_00E_ContainerController.pex
scripts\_00E_ContainerBonusControl.pex
scripts\_00E_HiddenSlotContainer.pex
scripts\PRKF__00E_LockpickingBonusPe_030020DA.pex
scripts\PRKF__00E_LockpickingReqPerk_030039BA.pex
scripts\_00e_cq_d_01_functions.pex
scripts\_00e_cqc01_functions.pex
scripts\_00e_cqc02_caliascuilasc.pex

@ -0,0 +1,15 @@
;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 3
Scriptname PRKF__00E_LockpickingBonusPe_030020DA Extends Perk Hidden
;BEGIN FRAGMENT Fragment_0
Function Fragment_0(ObjectReference akTargetRef, Actor akActor)
;BEGIN CODE
ContainerBonusControl.OnOpenContainer(akTargetRef)
;END CODE
EndFunction
;END FRAGMENT
;END FRAGMENT CODE - Do not edit anything between this and the begin comment
_00E_ContainerBonusControl Property ContainerBonusControl Auto

@ -12,7 +12,11 @@ endif
Key refKey = akTargetRef.GetKey()
if refKey && akActor.GetItemCount(refKey) > 0
bool bLocked = akTargetRef.IsLocked()
akTargetRef.Activate(akActor, True)
if bLocked
ContainerBonusControl.OnOpenContainer(akTargetRef)
endif
return
endif
@ -31,11 +35,16 @@ Else
bPlayerCanActivate = True
EndIf
If bPlayerCanActivate
akTargetRef.Activate(akActor, True)
Else
if ! bPlayerCanActivate
_00E_Game_UnlockNeedsSkill.Show()
EndIf
return
endif
akTargetRef.Activate(akActor, True)
if akTargetRef.GetBaseObject() as Container
ContainerBonusControl.OnOpenContainer(akTargetRef)
endif
;END CODE
EndFunction
;END FRAGMENT
@ -54,4 +63,4 @@ Perk Property _00E_Class_Trickster_P09_MasterThief Auto
Message Property _00E_Game_UnlockNeedsSkill Auto
Message Property _00E_sDoorLocked Auto
_00E_ContainerBonusControl Property ContainerBonusControl Auto

@ -1,4 +1,4 @@
Scriptname _00E_ContainerController extends ReferenceAlias Hidden
Scriptname _00E_ContainerBonusControl extends Quest Hidden
; This script sets up the sleight of hand loot of a chest upon activating it
int function _GetScriptVersion() Global
@ -6,140 +6,51 @@ int function _GetScriptVersion() Global
endFunction
;=====================================================================================
; EVENTS
; FUNCTIONS
;=====================================================================================
event OnInit()
RegisterForMenu("ContainerMenu")
RegisterForMenu("LootMenu")
PlayerREF.AddPerk(_00E_LockpickingReqPerk)
endevent
event OnPlayerLoadGame()
lastContainer = None
bLmHasGold = false
bLmHasSlot = false
RegisterForMenu("ContainerMenu")
RegisterForMenu("LootMenu")
if ! PlayerREF.HasPerk(_00E_LockpickingReqPerk)
PlayerREF.AddPerk(_00E_LockpickingReqPerk)
endif
endevent
function OnOpenContainer(ObjectReference targetContainer)
event OnUpdate()
ObjectReference currentContainer = lastContainer
lastContainer = None
if ! currentContainer
return
endif
if UI.IsMenuOpen("LootMenu") && currentContainer == Game.GetCurrentCrosshairRef()
if bLmHasGold
IncrementGold(currentContainer)
endif
if bLmHasSlot
OpenHiddenSlot(currentContainer, true)
endif
endif
endevent
; Lockpicking menu
while targetContainer.IsLocked() && Utility.IsInMenuMode()
Utility.WaitMenuMode(1.0)
endwhile
event OnMenuOpen(String MenuName)
if MenuName == "LootMenu"
; Even when QuickLoot RE does not show up, it still sends open and close menu events
; To determine if QuickLoot is open, we check it 0.1 seconds later
lastContainer = None
UnregisterForUpdate()
ObjectReference lootMenuRef = Game.GetCurrentCrosshairRef()
if ! lootMenuRef
return
endif
if ! ( lootMenuRef.GetBaseObject() as Container ) || lootMenuRef.IsLocked() || lootMenuRef.IsActivationBlocked() || lootMenuRef.GetActorOwner() == Player
return
endif
bLmHasGold = lootMenuRef.GetItemCount(Gold001) >= 5
bLmHasSlot = false
if bLmHasGold || _00E_ChestsWithHiddenSlots.HasForm(lootMenuRef.GetBaseObject())
if ! bLmHasGold
bLmHasSlot = true
endif
if ! IsProcessed(lootMenuRef)
lastContainer = lootMenuRef
; Clears previous request automatically
RegisterForSingleUpdate(0.1)
endif
endif
; Game mode and still locked
if targetContainer.IsLocked()
return
endif
if MenuName == "ContainerMenu"
ObjectReference currentContainer = EnderalFunctions.GetCurrentContainer()
if ! currentContainer || currentContainer as Actor || currentContainer.GetActorOwner() == Player || currentContainer.GetParentCell() != PlayerREF.GetParentCell()
return
endif
if currentContainer == containerToFill
; Opened hidden container
Utility.Wait(0.1)
; Move unclaimed items to the original container
containerToFill.RemoveAllItems(lastContainer, true, true)
lastContainer = None
containerToFill = None
return
endif
bool bDoGold = currentContainer.GetItemCount(Gold001) >= 5
bool bDoSlot = _00E_ChestsWithHiddenSlots.HasForm(currentContainer.GetBaseObject())
; Wait for it to open
int i
while i < 20 && targetContainer.GetOpenState() == 2
Utility.WaitMenuMode(0.1)
i += 1
endwhile
if ! bDoGold && ! bDoSlot
return
endif
if IsProcessed(currentContainer)
; Leave if we are not in the container menu yet
if SKSE.GetVersion()
if ! UI.IsMenuOpen("ContainerMenu")
return
endif
if bDoGold
IncrementGold(currentContainer)
endif
if bDoSlot
OpenHiddenSlot(currentContainer)
endif
elseif ! Utility.IsInMenuMode()
return
endif
endevent
event OnMenuClose(String MenuName)
if MenuName == "LootMenu"
UnregisterForUpdate()
lastContainer = None
bLmHasGold = false
bLmHasSlot = false
if targetContainer.GetItemCount(_00E_HiddenSlotChecked)
return
endif
endevent
targetContainer.AddItem(_00E_HiddenSlotChecked, 1, true)
;=====================================================================================
; FUNCTIONS
;=====================================================================================
if targetContainer.GetItemCount(Gold001) >= 5
IncrementGold(targetContainer)
endif
bool function IsProcessed(ObjectReference targetContainer)
if targetContainer.GetItemCount(_00E_HiddenSlotChecked)
return true
if _00E_ChestsWithHiddenSlots.HasForm(targetContainer.GetBaseObject())
OpenHiddenSlot(targetContainer)
endif
targetContainer.AddItem(_00E_HiddenSlotChecked, 1, true)
return false
endfunction
Function IncrementGold(ObjectReference targetContainer)
@ -186,8 +97,8 @@ function OpenHiddenSlot(ObjectReference currentContainer, bool bLootMenu = false
containerToFill.SetFactionOwner(none)
Endif
lastContainer = currentContainer
containerToFill.Activate(PlayerREF, True)
containerToFill.lastContainer = currentContainer
containerToFill.Activate(PlayerREF, false)
endif
If containerToFill == _00E_FS_SleightOfHand_HiddenSlot_BigSlotREF
@ -215,17 +126,17 @@ bool function SetUpHiddenSlot(ObjectReference aContainer)
if messageToShow == _00E_FS_SleightOfHand_HiddenSlot_sSmallSlotFound
containerToFill = _00E_FS_SleightOfHand_HiddenSlot_SmallSlotREF
containerToFill = _00E_FS_SleightOfHand_HiddenSlot_SmallSlotREF as _00E_HiddenSlotContainer
iFormlistIndex = Utility.RandomInt(0, 2) + iFormlistIndexOffset
Elseif messageToShow == _00E_FS_SleightOfHand_HiddenSlot_sMediumSlotFound
containerToFill = _00E_FS_SleightOfHand_HiddenSlot_MediumSlotREF
containerToFill = _00E_FS_SleightOfHand_HiddenSlot_MediumSlotREF as _00E_HiddenSlotContainer
iFormlistIndex = Utility.RandomInt(3, 5) + iFormlistIndexOffset
Elseif messageToShow == _00E_FS_SleightOfHand_HiddenSlot_sBigSlotFound
containerToFill = _00E_FS_SleightOfHand_HiddenSlot_BigSlotREF
containerToFill = _00E_FS_SleightOfHand_HiddenSlot_BigSlotREF as _00E_HiddenSlotContainer
iFormlistIndex = Utility.RandomInt(6, 7) + iFormlistIndexOffset
EndIf
@ -356,11 +267,7 @@ int iBigSlotChance = 15
; This formlist will be filled with the formlist containing the items that will actually be added into the container
Message messageToShow
ObjectReference lastContainer
ObjectReference containerToFill
bool bLmHasGold
bool bLmHasSlot
_00E_HiddenSlotContainer containerToFill
Actor Property PlayerRef Auto
ActorBase Property Player Auto
@ -396,5 +303,3 @@ FormList Property _00E_ChestsWithHiddenSlots Auto
Faction Property SleightOfHandOwnerFaction Auto
Message Property _00E_FS_LockpickingGoldBuffMSG Auto
Perk Property _00E_LockpickingReqPerk Auto

@ -0,0 +1,16 @@
Scriptname _00E_HiddenSlotContainer extends ObjectReference
Event OnActivate(ObjectReference akActionRef)
if ! lastContainer
return
endif
Utility.Wait(0.1)
RemoveAllItems(lastContainer, true, true)
lastContainer = None
EndEvent
ObjectReference Property lastContainer Auto
Loading…
Cancel
Save