How do I make a safe-deposit box locked with a password?

Jump to navigation Jump to search

This requires some advanced plotscripting. There are two parts to this question, and it is best to deal with each of them separately.

Item Storage[edit]

If the player can only take items out of the box, this is easy, and you can skip this section. If you want the player to be able to put things in the box, then this is complex. See the following articles.

Requiring a Password[edit]

To prompt the player to input a password before they can open a box (or to require a password to open a door, or talk to a person), you need to use strings. You can use the input string command to let the player type in a string. Then you can use the string compare command to see if the player typed in the correct password. For example

plotscript, passworded chest, begin
  suspend box advance
  show textbox (11)  #"What is the password"?
  input string(1)
  advance textbox
  resume box advance
  if (string compare(1, $2="open sesame")) then (
    # Success; show a textbox which gives you some items
    show textbox (12)
  ) else (
    # Wrong password
    show textbox (13)