[SOLVED] Make a child object visible after using a verb to "search" an object.

I was looking around but couldn't find a specific answer to this question. I want to be able to make a object visible after a certain verb is used.

For example there is a couch and the verb I added was "search" there is a USB set as a child object under the couch which I have set to be invisible.
I have added the make object visible script so that once the "search" verb is used it would make the USB visible but the USB isn't listed at all, I just get "> search couch".

So does any one know how I can have the USB be listed once the search verb is used?


I did something a little bit like this once, so I know it is possible.

I remember creating a game where I put the description of a room, and when creating the objects in the room, I kept one of them hidden. Instead of creating a new verb, I just used the "Look at" command, but it will add just a single extra step.

I believe what you need doing is adding the "search" verb to the object you want to be searched, be it visible or not.

Anyway, you dont need to make it visible if you dont want. You may just create the USB at the spot or you may create it and store it in a room not accessible during game and then move it to the player or to the room where the couch is.

I will run a test and post results.


Ok. I tested it here and it depends about how your game is running, so you will have t take different approaches.

In my test game, I created a " Vault room" to store the USB drive in question, because I suppose it would be good have it created beforehand for description and specific verbs sake. So, I created the couch object, added the "search" verb and made it Scenery, so it does not show in objects' list.

If you want the other way arround, lets say it has the "Look at" and even the "Take" verbs but dont want the player knowing there is a "search" verb, create the "search" verb in the verbs tab, and under the tab "Object" check the box named "Disable automatically generated display verbs for ths object". If you do so you will have the "Couch", the usual verbs and the "search" verb will be hidden.

Dont forget going to the "verbs tab" and scriping the "move object" code for the "search" verb. It will move the USB to whetever you want.


If the USB is a child object is the couch, the player can only see it if the couch is open.

The normal way to do this would be to make the couch a 'surface' (essentially a container that's always open) on the 'Container' tab. Then you search it and the USB becomes visible.

However, this still won't say anything in the output. "Make object visible" will cause it to appear in the "Places and objects" pane in the sidebar, and it will be shown with all the other objects if the player looks around the room, but it doesn't print any output directly. You probably want to tell the player that they've found an object as well. So your verb will do two things: make the object visible, and print a message. You would probably want the message to be something like You look down the back of the couch and find a {object:usb}. (using the actual name of the object), so that it is a clickable link in the messge.


Thanks for the replies mrangel and Deckrect, I just got up and tested a few things out. And mrangel your method did what I needed for the couch, but I didn't make the couch a surface I just added a verb "search" to the couch with your code.

MakeObjectVisible (Black USB)
if (not Got(Black USB)) {
  msg ("You look down the back of the couch and find a {object:Black USB}")
}
else {
  msg ("There is nothing hidden in the couch")
}

And Deckrect thanks for your response because your solution may help in another area I was having issues with. I'm going to test it out soon to make sure it works.

Again thanks for the response, hope you have a good day :)


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

Support

Forums