Alternative way to unlock the chest? #1478
Replies: 2 comments
-
Hello. There are quite a few ways to approach this... Here's one of them (perhaps not the best, but it works, haha): EDIT The next comment has a much better version of this example. Click here if you (for some odd reason) wish to view my first attempt at an example game.You could create a dummy object to act as a key (just to appease Quest). Then, script things something like this: <!--Saved by Quest 5.9.9166.36226-->
<asl version="580">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Locked Chest">
<gameid>b6685904-9e98-4a9a-89e3-64e76c8436bc</gameid>
<version>1.0</version>
<firstpublished>2025</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="chest">
<inherit name="editor_object" />
<inherit name="container_closed" />
<inherit name="container_lockable" />
<feature_container />
<close />
<hidechildren />
<listchildren />
<keycount type="int">1</keycount>
<key type="object">dummy_key</key>
<nokeymessage>{=WriteVerb(game.pov, "have")} not entered the password.</nokeymessage>
<feature_startscript />
<attr name="_initialise_" type="script">
this.password = GetRandomInt(0,9) + "" + GetRandomInt(0,9) + "" + GetRandomInt(0,9) + "" + GetRandomInt(0,9)
</attr>
<look><![CDATA[An ordinary chest, currently {if chest.isopen:open}{if not chest.isopen:closed}.<br/><br/>It has a {object:keypad}.]]></look>
<object name="present">
<inherit name="editor_object" />
<take />
</object>
</object>
<object name="keypad">
<inherit name="editor_object" />
<scenery />
<takemsg>It's part of the chest.</takemsg>
<not_all />
<feature_usegive />
<use type="script">
msg ("Please enter the password.")
get input {
if (result = chest.password) {
msg ("Password accepted.")
chest.locked = false
}
else {
msg ("Incorrect password.")
}
}
</use>
<displayverbs type="stringlist">
<value>Look at</value>
<value>Use</value>
</displayverbs>
</object>
</object>
<object name="dummy_key">
<inherit name="editor_object" />
</object>
</asl> You'll have to get the 4-digit code opening the debugger and looking at the "password" attribute on the You could also add a Any questions, just ask! =) Happy gaming! |
Beta Was this translation helpful? Give feedback.
-
UPDATE You don't even need a key object. And Quest has a spot to put a script to call after unlocking something. (If you want the password, you want the value <!--Saved by Quest 5.9.9166.36226-->
<asl version="580">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Locked Chest">
<gameid>b6685904-9e98-4a9a-89e3-64e76c8436bc</gameid>
<version>0.0.1</version>
<firstpublished>2025</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="chest">
<inherit name="editor_object" />
<inherit name="container_closed" />
<inherit name="container_lockable" />
<feature_container />
<close />
<hidechildren />
<listchildren />
<keycount type="int">0</keycount>
<nokeymessage>{=WriteVerb(game.pov, "have")} not entered the password.</nokeymessage>
<feature_startscript />
<look><![CDATA[An ordinary chest, currently {if chest.isopen:open}{if not chest.isopen:closed}.<br/><br/>It has a {object:keypad}.]]></look>
<attr name="_initialise_" type="script">
this.password = GetRandomInt(0,9) + "" + GetRandomInt(0,9) + "" + GetRandomInt(0,9) + "" + GetRandomInt(0,9)
</attr>
<onunlock type="script">
msg ("The chest is now unlocked.")
</onunlock>
<object name="present">
<inherit name="editor_object" />
<take />
</object>
</object>
<object name="keypad">
<inherit name="editor_object" />
<scenery />
<takemsg>It's part of the chest.</takemsg>
<not_all />
<feature_usegive />
<displayverbs type="stringlist">
<value>Look at</value>
<value>Use</value>
</displayverbs>
<use type="script">
msg ("Please enter the password.")
get input {
if (result = chest.password) {
msg ("Password accepted.")
chest.locked = false
}
else {
msg ("Incorrect password.")
}
}
</use>
</object>
</object>
</asl> |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I've set up a locked chest, and I want to make it unlockable only upon typing a randomized 4-digit code, though using the GUI I can only unlock it with an object instead, and I couldn't find an if statement that checks whether or not the player typed a number or a variable or anything during the "unlock" verb.
Is there a solution to this?
Beta Was this translation helpful? Give feedback.
All reactions