make container unable to be opened without it counting as "locked"

To preface: I am an absolute beginner at Quest -- if there's a very obvious solution I'm missing, that's the reason
In my game, I have a crate that the player needs to pry open with a crowbar, but the only way I've found to prevent the player from opening a container is the "Lockable" attribute. This would be fine, but it requires the player to type "unlock crate" once they have the crowbar, which certainly isn't how I'd phrase it, and it classifies "unlocking" and "opening" the crate to be 2 separate actions, which seems unintuitive. I'd rather the player say "use crowbar on crate" or even just "open crate" while carrying the crowbar. How can I do this?


You could try giving the crowbar the Use/Give option. Then in the Use/Give tab choose 'Handle objects individually' under the 'Use this on (other object) option. The object will be the crate and then the script will be

crate.locked = false

(make sure you give it the locked attribute first, in the crate's attributes tab and set it to true)

if you want it to open at the same time you could do

crate.locked = false
crate.isopen = true

You could also use 'if' to make sure that the player is actually holding the crowbar.

  crate.locked = false
  crate.isopen = true
}
else {
  msg ("Gotta pick it up first.")
}```

They should then be able to just say 'use crowbar on crate'. That said, I'm fairly new myself so someone else may have a more elegant solution.

Best of luck!

thanks, this worked!


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums