Reworked _00E_ChestAndDoorLockScript to a quest+perk implementation for better compatibility with QuickLoot RE
This commit is contained in:
parent
6e1bf5a6e9
commit
4805a55db5
Binary file not shown.
BIN
scripts/PRKF__00E_LockpickingReqPerk_030039BA.pex
Normal file
BIN
scripts/PRKF__00E_LockpickingReqPerk_030039BA.pex
Normal file
Binary file not shown.
BIN
scripts/_00E_ClosedChestAlias.pex
Normal file
BIN
scripts/_00E_ClosedChestAlias.pex
Normal file
Binary file not shown.
Binary file not shown.
BIN
scripts/_00E_ScrollUnlockAlias.pex
Normal file
BIN
scripts/_00E_ScrollUnlockAlias.pex
Normal file
Binary file not shown.
Binary file not shown.
65
source/scripts/PRKF__00E_LockpickingReqPerk_030039BA.psc
Normal file
65
source/scripts/PRKF__00E_LockpickingReqPerk_030039BA.psc
Normal file
@ -0,0 +1,65 @@
|
||||
;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
|
||||
;NEXT FRAGMENT INDEX 2
|
||||
Scriptname PRKF__00E_LockpickingReqPerk_030039BA Extends Perk Hidden
|
||||
|
||||
;BEGIN FRAGMENT Fragment_1
|
||||
Function Fragment_1(ObjectReference akTargetRef, Actor akActor)
|
||||
;BEGIN CODE
|
||||
_00E_sDoorLocked.Show()
|
||||
;END CODE
|
||||
EndFunction
|
||||
;END FRAGMENT
|
||||
|
||||
;BEGIN FRAGMENT Fragment_0
|
||||
Function Fragment_0(ObjectReference akTargetRef, Actor akActor)
|
||||
;BEGIN CODE
|
||||
if akTargetRef.IsActivationBlocked()
|
||||
akTargetRef.Activate(akActor, false)
|
||||
return
|
||||
endif
|
||||
|
||||
Key refKey = akTargetRef.GetKey()
|
||||
if refKey && akActor.GetItemCount(refKey) > 0
|
||||
akTargetRef.Activate(akActor, True)
|
||||
return
|
||||
endif
|
||||
|
||||
Bool bPlayerCanActivate = False
|
||||
Int iLockLevel = akTargetRef.GetLockLevel()
|
||||
|
||||
If iLockLevel <= LOCK_LEVEL_APPRENTICE
|
||||
bPlayerCanActivate = True
|
||||
ElseIf iLockLevel <= LOCK_LEVEL_ADEPT
|
||||
bPlayerCanActivate = (akActor.HasPerk(_00E_Class_Trickster_P04_ThiefApprentice) || akActor.GetActorValue("Lockpicking") >= 25)
|
||||
ElseIf iLockLevel <= LOCK_LEVEL_EXPERT
|
||||
bPlayerCanActivate = (akActor.HasPerk(_00E_Class_Trickster_P06_ExpertLocksmith) || akActor.GetActorValue("Lockpicking") >= 50)
|
||||
ElseIf iLockLevel <= LOCK_LEVEL_MASTER
|
||||
bPlayerCanActivate = (akActor.HasPerk(_00E_Class_Trickster_P09_MasterThief) || akActor.GetActorValue("Lockpicking") >= 75)
|
||||
Else
|
||||
bPlayerCanActivate = True
|
||||
EndIf
|
||||
|
||||
If bPlayerCanActivate
|
||||
akTargetRef.Activate(akActor, True)
|
||||
Else
|
||||
_00E_Game_UnlockNeedsSkill.Show()
|
||||
EndIf
|
||||
;END CODE
|
||||
EndFunction
|
||||
;END FRAGMENT
|
||||
|
||||
;END FRAGMENT CODE - Do not edit anything between this and the begin comment
|
||||
|
||||
Int Property LOCK_LEVEL_NOVICE = 1 AutoReadOnly
|
||||
Int Property LOCK_LEVEL_APPRENTICE = 25 AutoReadOnly
|
||||
Int Property LOCK_LEVEL_ADEPT = 50 AutoReadOnly
|
||||
Int Property LOCK_LEVEL_EXPERT = 75 AutoReadOnly
|
||||
Int Property LOCK_LEVEL_MASTER = 254 AutoReadOnly
|
||||
|
||||
Perk Property _00E_Class_Trickster_P04_ThiefApprentice Auto
|
||||
Perk Property _00E_Class_Trickster_P06_ExpertLocksmith Auto
|
||||
Perk Property _00E_Class_Trickster_P09_MasterThief Auto
|
||||
|
||||
Message Property _00E_Game_UnlockNeedsSkill Auto
|
||||
|
||||
Message Property _00E_sDoorLocked Auto
|
77
source/scripts/_00E_ClosedChestAlias.psc
Normal file
77
source/scripts/_00E_ClosedChestAlias.psc
Normal file
@ -0,0 +1,77 @@
|
||||
Scriptname _00E_ClosedChestAlias extends ReferenceAlias
|
||||
|
||||
Int Property LOCK_LEVEL_NOVICE = 1 AutoReadOnly
|
||||
Int Property LOCK_LEVEL_APPRENTICE = 25 AutoReadOnly
|
||||
Int Property LOCK_LEVEL_ADEPT = 50 AutoReadOnly
|
||||
Int Property LOCK_LEVEL_EXPERT = 75 AutoReadOnly
|
||||
Int Property LOCK_LEVEL_MASTER = 254 AutoReadOnly
|
||||
|
||||
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
|
||||
|
||||
ObjectReference hitRef = GetReference()
|
||||
|
||||
If akAggressor != PlayerREF || hitRef.IsLocked() == False
|
||||
Return
|
||||
EndIf
|
||||
|
||||
Int projectileLevel = 0
|
||||
|
||||
If akProjectile == _00E_UnlockProjectile_Novice
|
||||
projectileLevel = LOCK_LEVEL_NOVICE
|
||||
ElseIf akProjectile == _00E_UnlockProjectile_Apprentice
|
||||
projectileLevel = LOCK_LEVEL_APPRENTICE
|
||||
ElseIf akProjectile == _00E_UnlockProjectile_Adept
|
||||
projectileLevel = LOCK_LEVEL_ADEPT
|
||||
ElseIf akProjectile == _00E_UnlockProjectile_Expert
|
||||
projectileLevel = LOCK_LEVEL_EXPERT
|
||||
ElseIf akProjectile == _00E_UnlockProjectile_Master
|
||||
projectileLevel = LOCK_LEVEL_MASTER
|
||||
ElseIf akSource
|
||||
Formlist unlockSpells = _00E_ChestAndDoorUnlockScript_UnlockSpells
|
||||
If unlockSpells.HasForm(akSource)
|
||||
If akSource == unlockSpells.GetAt(0) as Explosion
|
||||
projectileLevel = LOCK_LEVEL_APPRENTICE
|
||||
ElseIf akSource == unlockSpells.GetAt(1) as Explosion
|
||||
projectileLevel = LOCK_LEVEL_ADEPT
|
||||
ElseIf akSource == unlockSpells.GetAt(2) as Explosion
|
||||
projectileLevel = LOCK_LEVEL_EXPERT
|
||||
ElseIf akSource == unlockSpells.GetAt(3) as Explosion
|
||||
projectileLevel = LOCK_LEVEL_MASTER
|
||||
EndIf
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
If projectileLevel > 0
|
||||
Int lockLevel = hitRef.GetLockLevel()
|
||||
If lockLevel > LOCK_LEVEL_MASTER
|
||||
_00E_sDoorLocked.Show()
|
||||
WPNTG06ControlStaffShootFailM.Play(hitRef)
|
||||
ElseIf projectileLevel >= lockLevel
|
||||
; Unlock
|
||||
hitRef.Lock(False)
|
||||
_00E_UILockpickingUnlockM.Play(hitRef)
|
||||
_00E_Ability_Antimagic_FXSShader.Play(hitRef)
|
||||
hitRef.PlaceAtMe(_00E_UnlockLockExplosion, 1)
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
EndEvent
|
||||
|
||||
Projectile Property _00E_UnlockProjectile_Novice Auto
|
||||
Projectile Property _00E_UnlockProjectile_Apprentice Auto
|
||||
Projectile Property _00E_UnlockProjectile_Adept Auto
|
||||
Projectile Property _00E_UnlockProjectile_Expert Auto
|
||||
Projectile Property _00E_UnlockProjectile_Master Auto
|
||||
|
||||
Message Property _00E_sDoorLocked Auto
|
||||
|
||||
Sound Property _00E_UILockpickingUnlockM Auto
|
||||
Sound Property WPNTG06ControlStaffShootFailM Auto
|
||||
|
||||
EffectShader Property _00E_Ability_Antimagic_FXSShader Auto
|
||||
Explosion Property _00E_UnlockLockExplosion Auto
|
||||
|
||||
FormList Property _00E_UnlockScrolls Auto
|
||||
FormList Property _00E_ChestAndDoorUnlockScript_UnlockSpells Auto
|
||||
|
||||
Actor Property PlayerREF Auto
|
@ -8,6 +8,7 @@ Scriptname _00E_ContainerController extends ReferenceAlias Hidden
|
||||
event OnInit()
|
||||
RegisterForMenu("ContainerMenu")
|
||||
RegisterForMenu("LootMenu")
|
||||
PlayerREF.AddPerk(_00E_LockpickingReqPerk)
|
||||
endevent
|
||||
|
||||
event OnPlayerLoadGame()
|
||||
@ -16,6 +17,9 @@ event OnPlayerLoadGame()
|
||||
bLmHasSlot = false
|
||||
RegisterForMenu("ContainerMenu")
|
||||
RegisterForMenu("LootMenu")
|
||||
if ! PlayerREF.HasPerk(_00E_LockpickingReqPerk)
|
||||
PlayerREF.AddPerk(_00E_LockpickingReqPerk)
|
||||
endif
|
||||
endevent
|
||||
|
||||
event OnUpdate()
|
||||
@ -50,14 +54,14 @@ event OnMenuOpen(String MenuName)
|
||||
return
|
||||
endif
|
||||
|
||||
if ! ( lootMenuRef.GetBaseObject() as Container ) || lootMenuRef.IsActivationBlocked()
|
||||
if ! ( lootMenuRef.GetBaseObject() as Container ) || lootMenuRef.IsLocked() || lootMenuRef.IsActivationBlocked()
|
||||
return
|
||||
endif
|
||||
|
||||
bLmHasGold = lootMenuRef.GetItemCount(Gold001) >= 5
|
||||
bLmHasSlot = false
|
||||
|
||||
if bLmHasGold || _00E_ChestsWithHiddenSlots.Find(lootMenuRef.GetBaseObject()) > -1
|
||||
if bLmHasGold || _00E_ChestsWithHiddenSlots.HasForm(lootMenuRef.GetBaseObject())
|
||||
if ! bLmHasGold
|
||||
bLmHasSlot = true
|
||||
endif
|
||||
@ -89,7 +93,7 @@ event OnMenuOpen(String MenuName)
|
||||
endif
|
||||
|
||||
bool bDoGold = currentContainer.GetItemCount(Gold001) >= 5
|
||||
bool bDoSlot = _00E_ChestsWithHiddenSlots.Find(currentContainer.GetBaseObject()) > -1
|
||||
bool bDoSlot = _00E_ChestsWithHiddenSlots.HasForm(currentContainer.GetBaseObject())
|
||||
|
||||
if ! bDoGold && ! bDoSlot
|
||||
return
|
||||
@ -388,3 +392,5 @@ FormList Property _00E_ChestsWithHiddenSlots Auto
|
||||
Faction Property SleightOfHandOwnerFaction Auto
|
||||
|
||||
Message Property _00E_FS_LockpickingGoldBuffMSG Auto
|
||||
|
||||
Perk Property _00E_LockpickingReqPerk Auto
|
||||
|
97
source/scripts/_00E_ScrollUnlockAlias.psc
Normal file
97
source/scripts/_00E_ScrollUnlockAlias.psc
Normal file
@ -0,0 +1,97 @@
|
||||
Scriptname _00E_ScrollUnlockAlias extends ReferenceAlias Hidden
|
||||
|
||||
event OnPlayerLoadGame()
|
||||
if UnlockScrollEquipped()
|
||||
GotoState("Equipped")
|
||||
endif
|
||||
endevent
|
||||
|
||||
Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
|
||||
if akBaseObject as Scroll && _00E_UnlockScrolls.HasForm(akBaseObject)
|
||||
GotoState("Equipped")
|
||||
endif
|
||||
endEvent
|
||||
|
||||
bool function UnlockScrollEquipped()
|
||||
Actor PlayerREF = GetReference() as Actor
|
||||
if PlayerREF.IsEquipped(_00E_UnlockScrolls)
|
||||
return true
|
||||
endif
|
||||
Form leftHand = PlayerREF.GetEquippedObject(0)
|
||||
return leftHand && _00E_UnlockScrolls.HasForm(leftHand)
|
||||
endfunction
|
||||
|
||||
Event OnUpdate()
|
||||
if UnlockScrollController.IsStopped()
|
||||
if ! UnlockScrollController.Start()
|
||||
RegisterForSingleUpdate(0.1)
|
||||
endif
|
||||
elseif UnlockScrollController.IsStopping()
|
||||
RegisterForSingleUpdate(0.01)
|
||||
elseif UnlockScrollController.IsStarting()
|
||||
RegisterForSingleUpdate(0.01)
|
||||
endif
|
||||
EndEvent
|
||||
|
||||
state Equipped
|
||||
event OnPlayerLoadGame()
|
||||
if ! UnlockScrollEquipped()
|
||||
GotoState("")
|
||||
endif
|
||||
endevent
|
||||
|
||||
event OnBeginState()
|
||||
ObjectReference actorRef = GetReference()
|
||||
RegisterForAnimationEvent(actorRef, "MRh_SpellFire_Event")
|
||||
RegisterForAnimationEvent(actorRef, "MLh_SpellFire_Event")
|
||||
endevent
|
||||
|
||||
event OnEndState()
|
||||
ObjectReference actorRef = GetReference()
|
||||
UnregisterForAnimationEvent(actorRef, "MRh_SpellFire_Event")
|
||||
UnregisterForAnimationEvent(actorRef, "MLh_SpellFire_Event")
|
||||
endevent
|
||||
|
||||
Event OnUpdate()
|
||||
if UnlockScrollController.IsStopped()
|
||||
if ! UnlockScrollController.Start()
|
||||
RegisterForSingleUpdate(0.1)
|
||||
endif
|
||||
elseif UnlockScrollController.IsStopping()
|
||||
RegisterForSingleUpdate(0.01)
|
||||
elseif UnlockScrollController.IsStarting()
|
||||
RegisterForSingleUpdate(0.01)
|
||||
endif
|
||||
EndEvent
|
||||
|
||||
Event OnObjectEquipped(Form akBaseObject, ObjectReference akReference)
|
||||
; do nothing
|
||||
endEvent
|
||||
|
||||
Event OnObjectUnequipped(Form akBaseObject, ObjectReference akReference)
|
||||
if ! UnlockScrollEquipped()
|
||||
GotoState("")
|
||||
endif
|
||||
endEvent
|
||||
|
||||
Event OnAnimationEvent(ObjectReference akSource, string asEventName)
|
||||
ObjectReference crosshairRef = Game.GetCurrentCrosshairRef()
|
||||
|
||||
if crosshairRef
|
||||
Form baseObject = crosshairRef.GetBaseObject()
|
||||
if baseObject as Container || baseObject as Door
|
||||
ScrollTarget.ForceRefTo(crosshairRef)
|
||||
UnlockScrollController.Stop()
|
||||
return
|
||||
endif
|
||||
endif
|
||||
|
||||
UnlockScrollController.Stop()
|
||||
RegisterForSingleUpdate(0.01)
|
||||
ScrollTarget.Clear()
|
||||
endEvent
|
||||
endstate
|
||||
|
||||
Quest Property UnlockScrollController Auto
|
||||
FormList Property _00E_UnlockScrolls Auto
|
||||
ReferenceAlias Property ScrollTarget Auto
|
@ -1,143 +0,0 @@
|
||||
Scriptname _00E_ChestAndDoorLockScript extends ObjectReference
|
||||
|
||||
Event OnLoad()
|
||||
BlockActivation(True)
|
||||
EndEvent
|
||||
|
||||
Int Property LOCK_LEVEL_NOVICE = 1 AutoReadOnly
|
||||
Int Property LOCK_LEVEL_APPRENTICE = 25 AutoReadOnly
|
||||
Int Property LOCK_LEVEL_ADEPT = 50 AutoReadOnly
|
||||
Int Property LOCK_LEVEL_EXPERT = 75 AutoReadOnly
|
||||
Int Property LOCK_LEVEL_MASTER = 254 AutoReadOnly
|
||||
|
||||
Event OnHit(ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked)
|
||||
|
||||
If akAggressor != PlayerREF || IsLocked() == False
|
||||
Return
|
||||
EndIf
|
||||
|
||||
Int projectileLevel = 0
|
||||
|
||||
If akProjectile == _00E_UnlockProjectile_Novice
|
||||
projectileLevel = LOCK_LEVEL_NOVICE
|
||||
ElseIf akProjectile == _00E_UnlockProjectile_Apprentice
|
||||
projectileLevel = LOCK_LEVEL_APPRENTICE
|
||||
ElseIf akProjectile == _00E_UnlockProjectile_Adept
|
||||
projectileLevel = LOCK_LEVEL_ADEPT
|
||||
ElseIf akProjectile == _00E_UnlockProjectile_Expert
|
||||
projectileLevel = LOCK_LEVEL_EXPERT
|
||||
ElseIf akProjectile == _00E_UnlockProjectile_Master
|
||||
projectileLevel = LOCK_LEVEL_MASTER
|
||||
ElseIf akSource
|
||||
Formlist unlockSpells = Game.GetFormFromFile(0x00044EE4, "Skyrim.esm") as Formlist
|
||||
If unlockSpells.HasForm(akSource)
|
||||
If akSource == unlockSpells.GetAt(0) as Explosion
|
||||
projectileLevel = LOCK_LEVEL_APPRENTICE
|
||||
ElseIf akSource == unlockSpells.GetAt(1) as Explosion
|
||||
projectileLevel = LOCK_LEVEL_ADEPT
|
||||
ElseIf akSource == unlockSpells.GetAt(2) as Explosion
|
||||
projectileLevel = LOCK_LEVEL_EXPERT
|
||||
ElseIf akSource == unlockSpells.GetAt(3) as Explosion
|
||||
projectileLevel = LOCK_LEVEL_MASTER
|
||||
EndIf
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
If projectileLevel > 0
|
||||
Int lockLevel = self.GetLockLevel()
|
||||
If lockLevel > LOCK_LEVEL_MASTER
|
||||
_00E_sDoorLocked.Show()
|
||||
WPNTG06ControlStaffShootFailM.Play(Self)
|
||||
ElseIf projectileLevel >= lockLevel
|
||||
; Unlock
|
||||
Self.Lock(False)
|
||||
_00E_UILockpickingUnlockM.Play(Self)
|
||||
_00E_Ability_Antimagic_FXSShader.Play(Self)
|
||||
self.PlaceAtMe(_00E_UnlockLockExplosion, 1)
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
EndEvent
|
||||
|
||||
Bool Function _IsInSuntemple()
|
||||
If _00E_SuntempleLocations
|
||||
Location curLoc = GetCurrentLocation()
|
||||
If curLoc && _00E_SuntempleLocations.HasForm(curLoc)
|
||||
Return True
|
||||
EndIf
|
||||
EndIf
|
||||
|
||||
Return False
|
||||
EndFunction
|
||||
|
||||
Bool Function _IsInSiege()
|
||||
Quest qSiegeQuest = Game.GetForm(0x0002EBAD) as Quest
|
||||
Int siegeStage = qSiegeQuest.GetCurrentStageID()
|
||||
Return (siegeStage >= 5 && siegeStage <= 125)
|
||||
EndFunction
|
||||
|
||||
Bool Function _PlayerHasKey()
|
||||
Key myKey = GetKey()
|
||||
Return (myKey && PlayerREF.GetItemCount(myKey) > 0)
|
||||
EndFunction
|
||||
|
||||
Event OnActivate(ObjectReference akActionRef)
|
||||
|
||||
If akActionRef == PlayerREF
|
||||
If _IsInSiege() && (Self.GetBaseObject().GetType() != 29 || _IsInSuntemple() == False)
|
||||
_00E_sDoorLocked.Show()
|
||||
ElseIf IsActivationBlocked()
|
||||
If IsLocked() && _PlayerHasKey() == False
|
||||
Bool bPlayerCanActivate = False
|
||||
Int iLockLevel = GetLockLevel()
|
||||
If iLockLevel <= LOCK_LEVEL_APPRENTICE
|
||||
bPlayerCanActivate = True
|
||||
ElseIf iLockLevel <= LOCK_LEVEL_ADEPT
|
||||
bPlayerCanActivate = (PlayerREF.HasPerk(_00E_Class_Trickery_P04b_) || PlayerREF.GetActorValue("Lockpicking") >= 25)
|
||||
ElseIf iLockLevel <= LOCK_LEVEL_EXPERT
|
||||
bPlayerCanActivate = (PlayerREF.HasPerk(_00E_Class_Trickery_P07_) || PlayerREF.GetActorValue("Lockpicking") >= 50)
|
||||
ElseIf iLockLevel <= LOCK_LEVEL_MASTER
|
||||
bPlayerCanActivate = (PlayerREF.HasPerk(_00E_Class_Trickery_P10_) || PlayerREF.GetActorValue("Lockpicking") >= 75)
|
||||
Else
|
||||
bPlayerCanActivate = True
|
||||
EndIf
|
||||
|
||||
If bPlayerCanActivate
|
||||
Activate(PlayerREF, True)
|
||||
Else
|
||||
_00E_Game_UnlockNeedsSkill.Show()
|
||||
EndIf
|
||||
Else
|
||||
BlockActivation(False)
|
||||
Activate(PlayerREF, True)
|
||||
EndIf
|
||||
EndIf
|
||||
Else
|
||||
Activate(akActionRef, True)
|
||||
EndIf
|
||||
|
||||
EndEvent
|
||||
|
||||
Formlist Property _00E_SuntempleLocations Auto
|
||||
|
||||
Projectile Property _00E_UnlockProjectile_Novice Auto
|
||||
Projectile Property _00E_UnlockProjectile_Apprentice Auto
|
||||
Projectile Property _00E_UnlockProjectile_Adept Auto
|
||||
Projectile Property _00E_UnlockProjectile_Expert Auto
|
||||
Projectile Property _00E_UnlockProjectile_Master Auto
|
||||
|
||||
Message Property _00E_sDoorLocked Auto
|
||||
|
||||
Perk Property _00E_Class_Trickery_P04b_ Auto ; Unlock adept locks perk
|
||||
Perk Property _00E_Class_Trickery_P07_ Auto ; Unlock expert locks
|
||||
Perk Property _00E_Class_Trickery_P10_ Auto ; Unlock master locks
|
||||
|
||||
Sound Property _00E_UILockpickingUnlockM Auto
|
||||
Sound Property WPNTG06ControlStaffShootFailM Auto
|
||||
|
||||
EffectShader Property _00E_Ability_Antimagic_FXSShader Auto
|
||||
Explosion Property _00E_UnlockLockExplosion Auto
|
||||
|
||||
Actor Property PlayerREF Auto
|
||||
|
||||
Message Property _00E_Game_UnlockNeedsSkill Auto
|
Loading…
Reference in New Issue
Block a user