A Few Quick Questions
LadySnowflake
17 Aug 2016, 04:50I've gone through the Quest tutorial, and I have successfully created the simple game as instructed. Now, I have a few quick questions that weren't covered, or else were only touched upon, in the tutorial. Any input on any of these questions would be greatly appreciated.
-
Is it possible to have the player converse with an NPC about a particular subject while in one specific room, then later have that same NPC appear in another specific room, where the player can converse with him/her on a different subject?
-
If there is a door in the room that has writing on it or some other distinguishing marks/characteristics, and I want the player to see them, should I create both an exit and a door object? Or would it be better to simply include a description of the door in the room description, and skip making a door object?
The Pixie
17 Aug 2016, 07:32- Yes. Set the "parent" attribute of the NPC to move her to a different room. Check it to see which room she is in:
if (npc.parent = lounge) {
msg("'I love the curtains in here, don't you?' says Mary.")
}
else {
msg("'What is this room?' asks Mary.")
}
- It is generally best to make an object for anything mentioned in a room description, just in case the player decides to look at it. If the description says there is a door with writing on it, some players will type X DOOR or READ DOOR. And OPEN DOOR etc. It is a pain in the neck but makes for a better game.
LadySnowflake
17 Aug 2016, 09:25Thank you, Pixie. I appreciate the plain English, as well as the example in code.
However, what if the player were to type "open door?" It's not actually openable, since it's not a container.
The Pixie
17 Aug 2016, 10:25You can set a door to be a container - there is an option Openable/Closeable for just this sort of situation.
That is easy enough, but then you need to consider how that interacts with your game. Does the player need to open the door to use the exit? Or does the door open automatically when the exit is used? Does the room description state whether the door is open or closed?
The simplest way is to just have a message for the Script to run when opening object that says something like "No need to open and close doors in this game; just indicate a direction to go".
LadySnowflake
17 Aug 2016, 11:01I see. Thank you again. You've been most helpful.
LadySnowflake
23 Aug 2016, 05:41To The Pixie or anyone else who may have an answer,
Can I please get some help with setting a door up as an openable/closable container? I did this once before with a window, but this time I want to do something a little bit different, and I'm not sure what the best way to go about it is. Here is what I'd like to do, and I would appreciate any advice on what scripts to add and in what order:
I would like the player to type "open door," and for a message to print to tell him/her what's happening, as well as the sound of a door opening to play. Same for closing the door.
Also, is it possible to only allow the player to use the exit after opening the door? That may be an unnecessarily complicated step, but I'd at least like to know how to do it, if it can in fact be done.
The Pixie
23 Aug 2016, 07:26Give the exit a name, say "exit_with_door", and untick the visible box.
Set up the door to be an "Openable/Closable" object. Set the "Script to run when opening" to be something like:
msg("You open it")
this.isopen = true
exit_with_door.visible = true
play sound ("door_creak.mp3", false,false)
And the close script to:
msg("You close it")
this.isopen = false
exit_with_door.visible = false
play sound ("door_creak.mp3", false,false)
If you want the player to be able to open and close it from the destination room, it gets rather more complicated. By the way, I have no experience of sound, so I hope that works.
hegemonkhan
23 Aug 2016, 08:01also, you may (or may not) want to move them into the exit's destination room, as a part of the scripting of the 'opening of the door' action, though this requires you to know in advance what is the Exit's destination room or to be able to determine it (and this method somewhat makes having the Exit moot/un-necessary to begin with, but meh, I'm digressing, lol). As most people probably don't want to do un-necessary extra actions, of course barring any reasons you might have/need/require for them in having to do such extra steps.
also note from Pixie's post:
the built-in 'isopen' Boolean Attribute is what actually determines whether the door is (or gets) open/opened or closed. Unfortunately, the built-in stuff (such as 'open' and 'close' actions and etc other related stuff) causes a lot of frustrations/difficulties/confusions/etc... I still to this day have difficulty with doors and Exits... laughs.
also, for making something be openable/closeable (quest will set up everything for you if you do this - you just select in whether it starts open or closed, and whether it is lockable and locked or not), you select for the Object's container type to be: openable/closeable
LadySnowflake
23 Aug 2016, 08:25open door
You open it
The door is open.
Error running script: Error compiling expression 'exit_with_door': Unknown object or variable 'exit_with_door'
The Pixie
23 Aug 2016, 15:58Did you do this bit:
Give the exit a name, say "exit_with_door", and untick the visible box.
LadySnowflake
23 Aug 2016, 17:40Yes, I did. It all works now, except for the closing sound. I'm not sure why it isn't playing, but hopefully I'll be able to figure it out eventually. Thank you for your help, Pixie.