Jump to content

(Original)Mod Research: Script driven magical lockpicking


AvelonHellfyre

Recommended Posts

I'm currently doing some research for a mod idea I have.

 

Looking around at the mods which address lockpicking, I do not see any that fit with my concept. I've been unable to find any useful information about whether or not my idea is even possible. So, here goes.

 

I like Concentration spells. I think they're quite neat. I have an Extract Ore spell for my mage, and have made various concentration spells for personal use. After becoming frustrated with Unlock spells variously not working at all or being hard-coded to be 'you either can or can't open this', it occurred to me that what I really wanted to do was stand there for 30 seconds holding LMB. So here is my vision:

 

You're a Nightblade (Stealth-based magic & dagger type for newcomers to the series). And you're out of picks. You really, really need to get through that door though. So you look around carefully, memorize the guard's patrol pattern, and set to work magically scrying the lock and using your will to push the tumblers past the shear point. Counting down silently in your head, you start to become worried. The guard is going to walk by any moment and you're not done! Sweat beading your brow, you pray that the faint light doesn't attract attention. . . Success! The last tumbler clicks into place and you spin the cylinder just as the guard walks from behind the building you are inconspicuously plastered against. With the magical hum and light gone, he has no reason to look in your direction, and nothing to see if he does. You slip inside.

 

--

 

What I want to do is this: Give the player an Apprentice or Adept level concentration spell in the Alteration school which is a Concentration type spell. When cast on a locked object in front of an NPC, it is exactly the same as if you were trying to pick the lock in front of that NPC. That is - it isn't illegal if you cast it on the ground or on an NPC.

 

You will have to maintain the spell to continue picking the lock - it resets to its full difficulty value when you release. Higher difficulty level means greater time is needed, and that time is reduced by your skill level. At 100 Alteration, a level 99 Master lock takes 10-15 seconds to pick. At 50 Alteration, it takes 30-45 seconds to pick. At 25, it takes 1:30-2:00 (which you likely won't have the magicka for). So like with the current system, it is technically possible to pick an exceptionally high level lock with a relatively low level of skill, but you had better be safe, unseen, or both.

 

From what I can tell, this is possible by adding a script to every door and container in the game which detects if that spell is being cast on it, but that means lower compatibility and a lot of time. I'm also not sure if Papyrus can get its host object's lock level.

 

There is a second part I'd like to add. I'd really like to have the lock from the lockpick minigame show up (possible with a custom texture) without pausing the game or interrupting the spell, and animate on its own based on cues from the script. When the lockstrength variable is reduced by 1, it shakes as though you were trying to spin the lock in the wrong position. After a few shakes it will start to turn and then snap back into default position and shake again. The amount that it turns is based on the lock reaching 75%, 50%, 25%, 10%, 5%, and 0% health, with it spinning all the way to the right, clicking with the lockpick success sound effect, and then the script terminates.

 

If it isn't possible to pull up the lockpicking minigame window and manipulate it in such a way, then I'm thinking it may be possible as a workaround to freeze the camera in third person view while you have the spell going and automate your character, then place a custom item which looks about the same as the lockpicking menu and has its own light source behind the camera between the player and his or her character. Each time the script then checks to see if the player is still casting, it will delete this custom item, restore camera movement, and return you to your normal perspective.

 

--

 

So, any thoughts? Even if you don't know anything about scripting or modding, feel free to throw out ideas. Who knows, maybe I'll end up making a mod for you because of it!

 

For those who are more experienced with Papyrus (I sadly only recently became able to play Skyrim despite owning it since release), any guidance would be appreciated, even if it is a flat 'Your idea is not even remotely possible and everything you think you know about Papyrus is wrong AND stupid AND has cancer'. Well, I might not appreciate that very much, actually. But you know.

 

Thanks in advance!

Link to comment
Share on other sites

  • 6 months later...

Since you never got any feedback on this, I'll provide a bit.

 

This is a really neat idea. I don't know of any way to bring up the lockpick menu without pausing time or interrupting the spell, but with enough scripting and a bit of mesh and texture, you can probably make a replica like you mentioned.

 

One thing to keep in mind is that Skyrim, for some reason known only to the developers, doesn't have an easy way to tell what the spell is hitting. There are methods of working around this, but they're... convoluted.

 

Anyway, as far as the differing times for differing lock levels, once you figure out what the spell hit, you can use that as an ObjectReference in the script and use GetLockLevel(). That much should be fairly easy. I'd say the hardest parts would be these: figuring out what was hit, making a scripted concentration spell work properly, and modifying the vanilla lock and lockpick into a usable form. Since you've got the scripted concentration spells down (something I tried earlier today but gave up on), and figuring out what was hit has been done by others who you could ask (Arod's Better Containers uses a few of those spells), that means you just need the retextures.

Link to comment
Share on other sites

What you want to do is semi possible, meaning it won't work for custom doors added by other mods.

First of all you need a form list of every door or chest in the game. Next, you need a quest with two reference aliases, one for the player and one for the door or chest we want to unlock.

Using OnSpellCast() we can track when the player starts casting the spell.

Upon casting, we can use FindClosestReferenceOfAnyTypeInListFromRef() to find the nearest door or chest. Set this object to be the the reference used in the quest.

We can then attach a script that uses OnHit() to the Door/chest alias which allows us to do the unlocking script without modifying every door and chest in the game.

 

Although it's limited, it does what you want it to do.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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