How do I make a NPC lock and close a cabinet after you finish the side quest that requires you to give him something from the cabinet.

Here is what happens:
You are in a Sick Bay.
You can see an Iris's Sickbed, a Medicine Cabinet (containing an O-type Blood Pack, a Bottle of red pills, a Bottle of small white tablets, a Bottle of bluish liquid and a Bottle of white and yellow pills), Iris, Dr Awapapwab, a Jamie's Sickbed and Jamie.
You can go north.

speak to Dr Awapapwab
Well, hello. Nice to see a new person. Nobody really comes around here unless they're sick, and sick people don't talk much.
ask Dr Awapapwab about Iris
Iris will be fine. She's had a liver transplant. On second thought, I can't find my immunosuppressants. I forgot the name, though. I think it starts with a C, and has a Y somewhere? Here's the key to the medicine cabinet. Please give it back after, and don't touch things.

(Player's inventory now contains "Key to the Medicine Cabinet". This allows them to unlock the cabinet.)

unlock cabinet
Unlocked.
You open it.

take Bottle of red pills
You pick it up.

take Bottle of small white tablets
You pick it up.

look at Bottle of red pills
The label says "Cyclosporine"

look at Bottle of small white tablets
The label says "Salicin"

take Bottle of bluish liquid
You pick it up.

look at Bottle of bluish liquid
The label reads "Streptomycin Liquid Emulsion"

take Bottle of white and yellow pills
You pick it up.

look at Bottle of white and yellow pills
The label says "Citalopram"

give bottle of white and yellow pills to Dr Awapapwab
No, that's not it.

(The bottle of pills is now in the cabinet.)

give bottle of red pills to Dr Awapapwab
Yes, that's it. You could make a great doctor.

(He now should take all the bottles and put them back in the cabinet, and then close and lock it.)

(But, you are still able to do this.)

open Medicine Cabinet
You open it.

use Bottle of small white tablets
You can't use it.

How do I fix this?

Code view here:
msg ("Yes, that's it. You could make a great doctor.")
SetObjectFlagOff (Dr Awapapwab, "irisquest")
SetObjectFlagOn (Iris, "cured")
MoveObject (Medicine Cabinetkey, Dr Awapapwab)
MoveObject (Bottle of Immunosuppressants, Medicine Cabinet)
MoveObject (bottle of antidepressants, Medicine Cabinet)
MoveObject (bottle of antibiotics, Medicine Cabinet)
MoveObject (Bottle of Aspirin, Medicine Cabinet)
HelperCloseObject (Medicine Cabinet)

What it shows up as to the player:

give bottle of red pills to Dr Awapapwab
Yes, that's it. You could make a great doctor.

Then the bottles disappear from their inventory.


I think you want to add:

Medicine Cabinet.locked = true
Medicine Cabinet.isopen = false

I don't own my own computer, so I can't access code view. I guess I could mail the game file to my dad, then download it on his computer, but that's a little annoying and Dad doesn't like me touching his accounting.


To lock a container, you can use Set object's attribute. Just add the name and write locked for it's Attribute and a Value of True. Capitalization does matter.
Unfortunately you can't do this with exits and need to use Set variable or attribute and writing exit.locked with expression True. (Extra tip, you can change an exit's name so you can more easily reference it in code/script block.)


Log in to post a reply.

Support

Forums