Making a safe locked with a keycode

This forum is the place to learn about and discuss ADRIFT 5. Feel free to mention any bugs you find here, but please also add these to the Bugs & Enhancements list.

Please also refer to the ADRIFT 5 Wiki for more information.
Post Reply
Nickelpede
Posts: 3
Joined: Wed Apr 28, 2021 5:17 pm
Points: 10

Making a safe locked with a keycode

Post by Nickelpede »

Completely new to this...

Have been making puzzles on google forms for friends during lockdown and came up with the idea to write a short text game as part of my latest puzzle. Came across this excellent program...

I've would like to add a safe with a key code entry. I have worked out how to make a keyed safe but unsure of a keycode.

Can you please help.

Thank you in advance...

Nickel

PS I have searched in vain for a way of doing it and see it can be done... if I've missed a post please point me in the right direction!
User avatar
Lumin
Posts: 2344
Joined: Fri Aug 06, 2004 6:48 pm
Points: 59

Re: Making a safe locked with a keycode

Post by Lumin »

Welcome! Glad you're liking the program so far.

As with most things with Adrift there's multiple ways to do pretty much everything, but using tasks and actions/restrictions is the most flexible and usually the easiest.

Just set a task command with something like 'enter 1234567' (or whatever the code is, and you might try having a few aliases for other ways of phrasing that they may come up with), with the restriction that they have to be in the presence of the safe, and an action to unlock it.

That's the easiest method. You could also let them enter one number at a time if you had a series of tasks, each set with the restriction that the one for the previous number just be completed.

I'm going to be at work awhile yet so I can't access Adrift, but I'm sure someone could whip up a demo for you if you need more help.
Nickelpede
Posts: 3
Joined: Wed Apr 28, 2021 5:17 pm
Points: 10

Re: Making a safe locked with a keycode

Post by Nickelpede »

Appreciate the greetings and reply.

This will be my first time setting up a task.

I've created an object, a large safe, static, in a single location.

I've also created a specific task, Enter 1234#, the task runs before, open objects, with the restriction that the safe must be visible to the player.

Where this all breaks down for me... is that when I lock the safe. I can only unlock it with a key I've made for an earlier door, not with the task.

I imagine when I've done it once it will all click into place, forever more.

Thanks again.

Nickel
User avatar
Denk
Posts: 855
Joined: Mon Feb 22, 2016 6:21 pm
Points: 346
Location: Hjørring, Denmark

Re: Making a safe locked with a keycode

Post by Denk »

Nickelpede wrote: Thu Apr 29, 2021 10:04 pm I've created an object, a large safe, static, in a single location.
Great, that's a good start.
Nickelpede wrote: Thu Apr 29, 2021 10:04 pm I've also created a specific task, Enter 1234#, the task runs before, open objects, with the restriction that the safe must be visible to the player.
Here it seems that you have misunderstood specific tasks, which is common for people new to ADRIFT. Firstly, the title of the task "Enter 1234#" has no effect - it is just a name so you more easily can remember what the task does. If you have made a specific task that overrides "open objects", it will override all commands whenever the player tries to OPEN an object as long as the restrictions of both the parent task (the general "open objects"-task in the Standard Library) and the specific task are fulfilled.

Good to know when using specific tasks:
* They only run if the restrictions of the parent task are also fulfilled, which usually ensures that the object is visible so you do not need that restriction.
* They only run when the player types the commands given in the parent task, in your case e.g. "open safe".
* Click on the highlighted word "object" and select the object "safe". Thus, the task only runs when the object is the safe.
Nickelpede wrote: Thu Apr 29, 2021 10:04 pm Where this all breaks down for me... is that when I lock the safe. I can only unlock it with a key I've made for an earlier door, not with the task.
Keys must be created and be dynamic objects, even if it is never present in the game. So just make a dynamic object, e.g. "dummykey" and put it in "hidden". Now you can set the safe to "locked" in the properties and the key to be the Dummykey, which is never used in the game as you have to enter a code.

You can create a general task with the command e.g. "Enter 12345" or something just as Lumin proposed to open the safe. However, you might also want to take into account when the player types a wrong number. This can be done with yet another general task with the command "Enter %number%". This task could say e.g.: You type the number %number% but nothing happens. The task with the right code just has to have higher priority (i.e. smaller priority number).

This small game you are making is actually a very good exercise in using ADRIFT.

Here are some links for useful information for people new to ADRIFT:
Thread with newbie info: https://forum.adrift.co/viewtopic.php?f=14&t=12082
ADRIFT Wiki (currently a bit bugged): http://wiki.adrift.co/ADRIFT_5_Wiki_Manual

Also note the help (question mark) within ADRIFT Developer. And come again if something isn't clear. :)
----------------------------------------------------------------------
The Bash Saga:
1. The Dragon Diamond 2. The Way Home 3. Stone of Wisdom
----------------------------------------------------------------------
User avatar
Lumin
Posts: 2344
Joined: Fri Aug 06, 2004 6:48 pm
Points: 59

Re: Making a safe locked with a keycode

Post by Lumin »

I put together a tiny game demonstrating one way setting up an unlockable safe might work. (The code is on the painting.)

Although as I said before, there's multiple ways to do this. If you want to get really elaborate for your friends you could even do something like randomize the combination code and where/how to find the clues every time.

Edit: just realized I didn't include the catch all for entering the wrong command, whoops. It was very past my bed time.
Attachments
unlock safe demo.taf
(17.82 KiB) Downloaded 7 times
Nickelpede
Posts: 3
Joined: Wed Apr 28, 2021 5:17 pm
Points: 10

Re: Making a safe locked with a keycode

Post by Nickelpede »

Lumin wrote: Fri Apr 30, 2021 4:59 am I put together a tiny game demonstrating one way setting up an unlockable safe might work. (The code is on the painting.)

Although as I said before, there's multiple ways to do this. If you want to get really elaborate for your friends you could even do something like randomize the combination code and where/how to find the clues every time.

Edit: just realized I didn't include the catch all for entering the wrong command, whoops. It was very past my bed time.
Thank you so much for this. Can see where i'd gone wrong and understand tasks a little better.

Apprecate the link to the wiki guides.
User avatar
Lumin
Posts: 2344
Joined: Fri Aug 06, 2004 6:48 pm
Points: 59

Re: Making a safe locked with a keycode

Post by Lumin »

Nickelpede wrote: Sat May 01, 2021 9:57 am Thank you so much for this. Can see where i'd gone wrong and understand tasks a little better.

Apprecate the link to the wiki guides.
Great, glad it helped! Let us know if you have any other questions, or if it's something you don't want to make an entire thread for feel free to message me.
Post Reply