Simple Lock Pick tutorial...

This forum is meant for people to share their knowledge by writing their own tutorials for Adventure Maker.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Simple Lock Pick tutorial...

Postby Bort » Fri Jul 13, 2007 9:27 am

just made this for my own game so thought it would sit well as a mini tutorial also..

ok..

first of all you need to create 3 global variables...click the variables tag on the AM menu and add 3 new integrer variables thus

Lock1
Lock2
Lock3

then

create a new empty frame

add one large hot spot
and set the unpicked lock as the picture for the spot..
see attached image A

then create 3 smaller hotspots
and place then on top of the "teeth" of the lock

one for each "tooth"

open the hotspot properties and set the first smaller hotspot variables options to

"variables the value of which must be inverted"
then add the

Lock1

variable to this spot..

then open the "advanced" window and add this code

Code: Select all
Action.LoadAPicture Hotspot(1), "lock1a.jpg"


this changes the main lock image on the first Hotspot to show this "tooth" raised...etc (see attached image)

do this for the other two lock teeth
setting the options on the second spot to

"variables the value of which must be inverted"
add the

Lock2

variable to this spot..

then open the "advanced" window and add this code

Code: Select all
Action.LoadAPicture Hotspot(1), "lock1b.jpg"


and the third

"variables the value of which must be inverted"
then add the

Lock3

variable to this spot..

then open the "advanced" window and add this code

Code: Select all
Action.LoadAPicture Hotspot(1), "lock1c.jpg"





then create a new hotspot to one side..this is the spot the player will click to check the door to see if he has suceeded in opening the lock..
open the advanced window on the hotspot porperties..and add this

Code: Select all
If Lock1 = 1 And Lock2 = 0 And Lock3 = 1 Then
Text(2).Caption = " yes that's got it.."
ElseIf Lock1 = 0 And Lock2 = 0 And Lock3 = 0 Then
Text(2).Caption = " no..i'll try again.."
Lock1 = 0 
Lock2 = 1 
Lock3 = 0 
Else
Text(2).Caption = "test the pick.. "
Lock1 = 0 
Lock2 = 1 
Lock3 = 0 
End If


if you want to automatically go to a new room when the lock is "picked"
you then need to add an additional line of code to the above to send the player to the next "frame" as he picks the lock-- so it now looks like this

Code: Select all
If Lock1 = 1 And Lock2 = 0 And Lock3 = 1 Then
Text(2).Caption = " yes that's got it.."
Action.GoToFrame "OPEN_DOOR"
ElseIf Lock1 = 0 And Lock2 = 0 And Lock3 = 0 Then
Text(2).Caption = " no..i'll try again.."
Lock1 = 0 
Lock2 = 1 
Lock3 = 0 
Else
Text(2).Caption = "test the pick.. "
Lock1 = 0 
Lock2 = 1 
Lock3 = 0 
End If



note the addition of the

Action.GoToFrame "DOOR_OPEN"

this is what tells the game to take the player to a new "room" if the puzzle is solved

include a couple of textboxes (right click on screen add text)
so you can keep the player informed of his progress (see my example)
or use your favourite method

the first line of the code lists the correct settings for opening the lock
using the variables to represent the lock teeth being picked by the player.
this way the whole lock is reset to the incorrect settings after each wrong attempt....
note the inclusion/resetting of the variables in the above code thus

Lock1 = 0
Lock2 = 1
Lock3 = 0

this sets the lock (variables) to a locked position after each failed attempt

with some sort of provisional clue (??) this might be a mid level puzzle for some minor door or desk drawer..if you are told the soloution is "this way/that way/this way" you will be able to suss out that the best way to crack the lock...
with the soloution being

1 0 1

if you are given a clue to the on off on nature of the answer..
and you know the lock resets to an entirely wrong setting ie

0 1 0

then you can crack the lock in a vaguely logical fashion...and it's also do-able by sheer trail and error if all else fails...so it won't dead end you

hope this is usefull...
add some sound effects to the hotspots and it works very nicely without too much heavy coded spade work..
Attachments
lockscreen1.jpg
here's how this looks in game...with these graphics
lockscreen1.jpg (65.51 KiB) Viewed 6356 times
lock1c.jpg
the third "tooth" raised when clicked
lock1c.jpg (30.66 KiB) Viewed 6356 times
lock1b.jpg
the second "tooth" raised when clicked
lock1b.jpg (30.79 KiB) Viewed 6356 times
lock1a.jpg
the first lock "tooth" raised when clicked
lock1a.jpg (30.4 KiB) Viewed 6356 times
lock1.jpg
image A
lock1.jpg (30.89 KiB) Viewed 6356 times
User avatar
Bort
Active Member
 
Posts: 65
Joined: Sun Jul 08, 2007 9:02 pm

Postby Bort » Sat Jul 14, 2007 12:22 pm

:D i've attached the project folder containing the lockpick screen etc so you can root about under the hood and experiment test it all out...contains all the neccesary graphics (which you are welcome to use if you so wish...)

this is as simple as i can make it with my level of experience...tho of course it can be elaborated upon and made more complex...even if you simply require the player to have found a lockpick item in order to be able to attempt the pick...if you see my point..

randomising the soloution as you enter the frame
in the frame properties advanced section try this..

Code: Select all
randomize
i = int( RND * 3 ) + 1
If i = 1 then Lock1 = 1 
If i = 2 then Lock2 = 0 
If i = 3 then Lock3 = 1 


would allso elaborate on the difficulty involved and or increasing the number of lock "teeth" would also greatly increase the difficulty etc...


of course it doesn't have to be a lockpick puzzle...
graphicaly this could just as easily be 3 stone flag stones in a hall way...which the player has to stand on in certain order to open a door or "hidden" hole in the wall ..or 3 levers/buttons/switches/fuses/food items/etc etc, each one in a different room, one in the cellar..one in the kitchen ..one in the bedroom.....or those 3 mysterious gemstone items you picked up a way back...placing them in 3 slots in a marble pillar in a certain order opens the hidden room...use item on hotspot changes variable instead of simply clicking on the hotspot if you see what i mean here...and on and on "this is not my beautiful house...etc"
very simple yet very flexible as an interesting fun yet not overly challenging puzzle for use virtualy any way and any where in a game story-line..without ruining your appetite! :)
Attachments
LOCKPICK.zip
the AM project folder for the puzzle..
(926.72 KiB) Downloaded 518 times
"I've had a wonderful evening...but this wasn't it.." GM
"This is not my beautiful house..." DB
User avatar
Bort
Active Member
 
Posts: 65
Joined: Sun Jul 08, 2007 9:02 pm

Postby Mystery » Sat Jul 14, 2007 1:43 pm

Thanks for that tutorial, Bort, looks great.
Might give it a try :)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Bort » Sun Jul 15, 2007 1:12 pm

Cheers Mystery...tho i doubt if you personaly need any such tutorial! :lol:

one of the main things that makes working on a game any longer than a demo size traumatic for me..is the huge amount of code variables etc etc you need to keep in your mind in order to remember what you need to do next..(and why)..you try to avoid using the advanced options..yet the temptation to do a bit of coding allmost allways wins out...(and it's frequently the only way to do what you need to do)
i reckon this same bit of code and the graphics also can be re-used time and time again thru-out a game...depending on how you use it..
if you place a hot spot on the key-hole of the door you wish to open..
which takes you to the lockpick screen
then on solving the lockpick "puzzle" you go to a new door screen which is open..this way you can use the exact same lockpick screen and varables for any door you want over and over again
with some care taken over resetting the variables to locked as you enter the door screen so it doesn't open ALL the pickable locks in the game at once..as they all rely on the same 3 variables for their soloution
(Bit boring maybe but i've definitely seen far FAR worse in professional adventure games!! 8) )

hopefully this sort of example/tutorial might not only help me but others who suffer the same fate :D
"I've had a wonderful evening...but this wasn't it.." GM
"This is not my beautiful house..." DB
User avatar
Bort
Active Member
 
Posts: 65
Joined: Sun Jul 08, 2007 9:02 pm

Postby Mystery » Sun Jul 15, 2007 10:37 pm

Well, yes, personally I don't need this tutorial in that detail, but it's a very welcome idea :)
And I'm sure that beginners are always happy to have some great instructions! Keep up good work, and thanks for your contributions :)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby Bort » Mon Jul 16, 2007 12:48 am

Cheers Mystery! :D
"I've had a wonderful evening...but this wasn't it.." GM
"This is not my beautiful house..." DB
User avatar
Bort
Active Member
 
Posts: 65
Joined: Sun Jul 08, 2007 9:02 pm

Postby cpkspikyhair » Fri Jul 20, 2007 9:42 pm

Do you have to have the full version to do advanced scripting?
PSPPC GameMaker!! Where you can find PSP and PC games up for download!
User avatar
cpkspikyhair
Games Page Administrator
 
Posts: 425
Joined: Thu Jun 28, 2007 1:49 pm
Location: On Mars (Yes There Is Water :) )

Postby Bort » Fri Jul 20, 2007 10:04 pm

unfortunately yes it has to be the full AM version...there may be a way to do some-thing similar without scripting tho i dunno..those three levers to unlock the door in one of the example "games" that come with AM might be a way of approaching it...three levers...open door....three lockpick teeth..open door....not entirely disimilar!!
"I've had a wonderful evening...but this wasn't it.." GM
"This is not my beautiful house..." DB
User avatar
Bort
Active Member
 
Posts: 65
Joined: Sun Jul 08, 2007 9:02 pm

Postby cpkspikyhair » Sat Jul 21, 2007 2:12 pm

guess what?

I did it w/o scripting! here, take a look:
Attachments
STlv12fr2(1+3).GIF
Lock (2).
STlv12fr2(1+3).GIF (5.4 KiB) Viewed 6210 times
STlv12fr2(0).GIF
Lock.
STlv12fr2(0).GIF (5.56 KiB) Viewed 6210 times
STdoor1.GIF
Door.
STdoor1.GIF (4.17 KiB) Viewed 6210 times
PSPPC GameMaker!! Where you can find PSP and PC games up for download!
User avatar
cpkspikyhair
Games Page Administrator
 
Posts: 425
Joined: Thu Jun 28, 2007 1:49 pm
Location: On Mars (Yes There Is Water :) )

Postby Bort » Sat Jul 21, 2007 3:16 pm

:D excellent stuff...looks good too
"I've had a wonderful evening...but this wasn't it.." GM
"This is not my beautiful house..." DB
User avatar
Bort
Active Member
 
Posts: 65
Joined: Sun Jul 08, 2007 9:02 pm

Postby cpkspikyhair » Sat Jul 21, 2007 4:31 pm

thanks Bort :D
PSPPC GameMaker!! Where you can find PSP and PC games up for download!
User avatar
cpkspikyhair
Games Page Administrator
 
Posts: 425
Joined: Thu Jun 28, 2007 1:49 pm
Location: On Mars (Yes There Is Water :) )


Return to Post Your Own Tutorials

Who is online

Users browsing this forum: No registered users and 3 guests

cron