Jump to content
Sign in to follow this  
RedEagle_P1.

Password to open chest, how can it be done?

Recommended Posts

Hey Red,

First of all you need to get the item that you want to interact with and set it to unpickable. Due to this you need to create a new interaction in that object's script and say what you would like to happen once the player does interact with it, in this case you want to ask a question.

Ylands_181125_004320.thumb.png.8ed725f5c008d841e50687ebafb2a2e0.png

In the "Ask Player" script you want to specify what the password is and if it is right then you spawn whatever item you want (stored in an "Entity Template") . The player's inventory is the container container.

Ylands_181125_004335.thumb.png.e1a2bb2904952b54d94f06cd78e667d6.png

Seems that I have misread the question at first so here was my initial response (it felt like a waste to delete it :P):

If you want a chest to only unlock when a player gives the right password then similar principles apply.

First you need to create an "Ask Player" feature where you create a password variable and an if statement that checks if the password is correct. Create a chest and set it to "Locked". Within the chest script you need to create a new interaction otherwise your character will constantly get an error message for not being able to open the chest. Then once the character interacts with it, you should turn the interaction off so that once you do type in the correct password, you are able to open the chest.

If you want the chest to be constantly open after you have written the correct password then you can delete the stuff under the "On Close" section in the chest script since that serves as a reset mechanism.

 Ylands_181124_233305.thumb.png.210d29f17974b4327dc0e2088a72601c.png

Ylands_181124_233251_LI.thumb.jpg.f7d9804c831cc8890f11be162a64139a.jpg

Hope that helped! :P

Edited by Fompster_P1
  • Like 1
  • Upvote 1

Share this post


Link to post
Share on other sites

I would have made the code in a different way :V

You can set up "Enable interaction" with an object, in this case opening a dialogue

You can set up 9 options (numbers 1 to 9)

And set up the string for the dialogue prompt to be the inputted code.

If String = Code, then the chest will open.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×