Reworked _00E_ChestAndDoorLockScript to a quest+perk implementation for better compatibility with QuickLoot RE
parent
6e1bf5a6e9
commit
4805a55db5
11 changed files with 248 additions and 146 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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 |
@ -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 |
@ -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