Jump to content

Papyrus: Lockpicking scripts


adzscott

Recommended Posts

So I've recently decided to jump head-first into papyrus..

 

 

Does anybody know the name/id of the default script that runs when a player activates a locked object?

 

I'm trying to piece together in my head an idea for a lock picking skill-based script, and thinking it would be a lot less work to extend of the normal script that runs.

 

Also, how would I go about preventing the normal lock-picking animation from playing?

 

What I'm trying to achieve is essentially:

Can this lock be picked?:

NO: Player does not have the required locksmith perk
Yes: Player has required perk

If yes:

Activate [skillbasedlockpicking script]


Many thanks,

 

Adzscott

Link to comment
Share on other sites

There isn't one. It's a hardcoded thing. When the player activates a locked door the game immediately calls up the lockpicking screen.

I don't buy it. The game has to check if the player has the required perk to pick the lock, so there must be a script of sort that runs to verify this.

Link to comment
Share on other sites

There is no Papyrus script that runs when the player activates a locked object. Each door / container reference has a Lock tab that corresponds to each of the Locksmith perk levels. If you don't have the requisite perk that corresponds to that door's lock level, the game won't let you pick that lock. So, again, no Papyrus / 'default' script is involved. It's all done through perks and perk entry points. And the perk entry points themselves are hardcoded.

Edited by Reneer
Link to comment
Share on other sites

There is no Papyrus script that runs when the player activates a locked object. Each door / container reference has a Lock tab that corresponds to each of the Locksmith perk levels. If you don't have the requisite perk that corresponds to that door's lock level, the game won't let you pick that lock. So, again, no Papyrus / 'default' script is involved. It's all done through perks and perk entry points. And the perk entry points themselves are hardcoded.

Damn :/ I was hoping this would be simpler than it looked. Any advice on how to approach this?

 

Thanks for your help so far.

Link to comment
Share on other sites

Actually, I do have an idea. There is a baseline perk for lockpicking in the CK. I'm pretty sure (though I have never tried this myself) you could modify that perk's entry point parameters to run a Papyrus script.

 

And if that doesn't work, there are other methods that would suffice, though they are much more complicated.

Edited by Reneer
Link to comment
Share on other sites

Actually, I do have an idea. There is a baseline perk for lockpicking in the CK. I'm pretty sure (though I have never tried this myself) you could modify that perk's entry point parameters to run a Papyrus script.

 

And if that doesn't work, there are other methods that would suffice, though they are much more complicated.

You can

Link to comment
Share on other sites

Alright so, progress!

 

I've set up a perk that comes into effect whenever a locked container or door is activated. The next step (I think?!) is to create a script that runs whenever this occurs. Unfortunately I can't get it compile :sad:

Scriptname LazyLocks extends ReferenceAlias
{Attached script **should** work out if the force-lock attempt is successful or not.}

ActorValue Property Perception Auto Const
ActorValue Property Luck Auto Const

int P = Game.GetPlayer().ActorValue Function GetPerceptionAV()
; Returns players perception skill as an integer value
    
int L = Game.GetPlayer().ActorValue Function GetLuckAV()
    ; Returns players luck skill as an integer value
    
Int Function GetLockLevel() native
;Returns lock level of target lock as an integer

Event OnActivate(ObjectReference akActionRef)

If locklevel == 25
Int RI = Utility.RandomInt(0, 25)
elseif locklevel == 50
Int RI = Utility.RandomInt(0, 50)
elseif locklevel == 75
Int RI = Utility.RandomInt(0, 75)
elseif locklevel == 100
Int RI = Utility.RandomInt(0, 100)
else Debug.Notification(This lock cannot be forced.)
end if
;Generates random number, with the available range based on lock-level.

End event
int PlayerSkill = L*P
;Defines playerSKill as the product of a players luck and perception.

Event OnActivate(ObjectReference akActionRef)
If PlayerSKill > RI
akTargetRef.Unlock()
Else
Debug.Notification(You fail to force the lock...)
end if
End event

The following errors were produced:

 

  1. C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\LAZYLOCKS.psc(7, :cool:: no viable alternative at input 'Game'
  2. C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\LAZYLOCKS.psc(7,12): required (...)+ loop did not match anything at input '.'
  3. C:\Program Files (x86)\Steam\steamapps\common\Fallout 4\Data\Scripts\Source\LAZYLOCKS.psc(7,4): Unknown user flag game

 

I'm guessing this is to do with not declaring something correctly, no?

Edited by adzscott
Link to comment
Share on other sites

  • 2 months later...

any luck with further progress on this??

I am VERY interested

I am trying to do something quite similar.

This thread has already helped a lot

 

**UPDATE**

 

I've done it! I made the mod that bypasses the stupid lockpicking mini game and just unlocks things if you have high enough skill!

 

https://mods.bethesda.net/#en/workshop/fallout4/mod-detail/2606638

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...