Skyrim/Fallout-style Lockpicking Mini-Game

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
User avatar
JessicleCat
Newbie
Posts: 7
Joined: Sun Jan 19, 2020 4:48 am
Contact:

Skyrim/Fallout-style Lockpicking Mini-Game

#1 Post by JessicleCat »

I made a lock-picking mini-game based on the Skyrim and Fallout style. If you ever wanted to recreate the entirety of Skyrim in Ren'Py (Ren'Sky??) then here's a necessary component!

Image

All you need is an empty room graphic, and one or more locked objects (1-5 per screen) with associated images following the file name convention described in lockpicking.rpy (look at the included graphics for examples):

Code: Select all

images/yourobject_closed.png
images/yourobject_hover.png
images/yourobject_open.png
images/yourobject_open_hover.png
You also need to create/set a couple of variables, most notably the Lock() object (still using the same naming convention):

Code: Select all

default yourobject_have_key = False #unless the player DOES HAVE THE KEY for that object
default yourobject_opened = False #until the player has opened it successfully

default yourobject_lock = Lock(##, ##) #the first number is the difficulty 1-29, lower numbers are more difficult,
the second is the "loot" which is not really used in this script,
but if you want to give the player something, that's where you'd put it.
Then you call it in a screen, on layer "master":

Code: Select all

show screen click_chest("yourobject", _layer="master")
or for multiple objects:
show screen click_chest("yourobject", "yourotherobject", _layer="master")
Oh, and for use in an actual game, you'll want to get rid of the "Get the Key" textbutton in the lockpicking screen, and the "Reset" textbutton in the click_chest screen! Those are there for testing purposes. :shock:

I tried to comment the code pretty clearly, so I hope everything makes sense! This code is based HEAVILY on trooper6's Analogue Clock code, which is probably the first place to look to do the sound effects better than I did. All code, images, and sound effects in this demo are licensed under a Creative Commons 0 Public Domain license, so take them, modify them, use them however you want.

PLEASE DO improve upon this code, and post it here. I'm pretty new to coding, and there's always a better way (than what I did). :lol:
Attachments
Lockpicking Test.zip
(10.6 MiB) Downloaded 645 times

Uy27
Regular
Posts: 29
Joined: Wed Apr 04, 2018 2:07 am
Contact:

Re: Skyrim/Fallout-style Lockpicking Mini-Game

#2 Post by Uy27 »

Awesome stuff.
Could definitelysee how this could work in my own game!

User avatar
badanni
Newbie
Posts: 9
Joined: Fri Jan 24, 2020 11:57 am
itch: badanni
Location: Quito, Ecuador
Contact:

Re: Skyrim/Fallout-style Lockpicking Mini-Game

#3 Post by badanni »

Really nice!!!

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Skyrim/Fallout-style Lockpicking Mini-Game

#4 Post by Alex »

Thanks for sharing this ;)

Post Reply

Who is online

Users browsing this forum: No registered users