Changing NPC speech options in different rooms

As the title suggests, I'm currently a bit stuck. I've got a character, let's call her Marie, who the player first meets in a room called 'Farmhouse'. After interacting with a stack of plates, the player & Marie are moved over to a new room named 'Dining room'. I'm not entirely sure how I can alter her speech options so that the player doesn't have access to the same options they had in 'Farmhouse'.

To clarify, the player has 3 speech options when they interact with Marie in the 'Farmhouse' room. I want to give her entirely new/different speech options when in 'Dining room', then have them return to normal once the player returns to the Farmhouse (with Marie moving back to the Farmhouse too).

Anyone know how to do this, or am I delving into uncharted territory so to speak?


Are you using ConvLib?

If not, give it a try.
Using that, it is easy to show/hide the various options.


ConvLib has room specific topics built-in, se the documentation here:
https://github.com/ThePix/quest/wiki/Library:-Conversations


J_J

If you are doing this manually you can just add an "if player is in room" to the criteria of the conversation, and then specify "else player is in other room." You can also make a second Marie object with the same name in the new room.


Or... if only a few of the topics change and most stay the same, you could either
A. Copy the NPC, paste them in the room you want, and delete/add topics as needed.
B. Put all topics on one NPC and use a flag to determine what room the NPC is in.

And I guess that pretty much what J_J said, huh? :)


Hm. So, I'm using ConvLib now and I've come across another issue. I want the player to be able to choose a starting topic, which opens up a following line of dialogue/topic (whilst hiding the original starting topic in the process). After the player completes the conversation (through the terminate conversation tickbox at the final dialogue option) I want to be able to repeat the conversation again. I feel like I'm missing something painfully obvious and it's frustrating the heck outta me; I also get the feeling I'm jumping into the deep end a bit since I only very recently started playing around with this text-adventure business.

EDIT: Using the manual route of Split ("Question;Question;Question",";") I've managed to use J_J's method and simply added a 'If player is in room' function to change the topics available. I'm still curious as to whether I could hide topics after choosing them once, then replace them with a new topic upon choosing 'Speak To' again? Manually, that is.


you're working with 'list' VARIABLE (the 'Split' ONLY works for/with creating+returning a 'stringlist' VARIABLE, you can also use the normal 'NewList + list add' method, which also works for objectlists too, and its the same with dictionaries too), which allows you to 'add/remove' items from the list (or dictionary):

http://docs.textadventures.co.uk/quest/using_lists.html

you can also use dictionaries too, instead of lists, or along with lists, too:

http://docs.textadventures.co.uk/quest/using_dictionaries.html


using 'variable' VARIABLES for this example, but usually you want to use 'Attribute' VARIABLES instead

// 'Variable' VARIABLES:
NAME_OF_Variable = VALUE_OR_EXPRESSION

// 'Attribute' VARIABLES:
NAME_OF_OBJECT.NAME_OF_ATTRIBUTE = VALUE_OR_EXPRESSION

stringlist_variable = Split ("red;blue;yellow", ";")

// or

stringlist_variable = NewStringList ()

// note that strings DO have double quotes (anything within double quotes is a string):

list add (stringlist_variable, "red")
list add (stringlist_variable, "blue")
list add (stringlist_variable, "yellow")

// --------------------

// to use Objects, they have to exist, so we need to create them:
create ("red")
create ("blue")
create ("yellow")

objectlist_variable = NewObjectList ()

// note that Objects do NOT have the double quotes:

list add (objectlist_variable, red)
list add (objectlist_variable, blue)
list add (objectlist_variable, yellow)

// ------------------------

stringdictionary_variable = NewStringDictionary ()
dictionary add (stringdictionary_variable, "red", "color: red")
dictionary add (stringdictionary_variable, "blue", "color: blue")
dictionary add (stringdictionary_variable, "yellow", "color: yellow")

dictionary add (DICTIONARY, KEY, VALUE)

a stringdictionary item:
-> key (input): "STRING"
-> value (output): "STRING"

// -----------

// to use Objects, they have to exist, so we need to create them:
create ("red")
create ("blue")
create ("yellow")

objectdictionary_variable = NewObjectDictionary ()
dictionary add (stringdictionary_variable, "red", red)
dictionary add (stringdictionary_variable, "blue", blue)
dictionary add (stringdictionary_variable, "yellow", yellow)

dictionary add (DICTIONARY, KEY, VALUE)

an objectdictionary item:
-> key (input): "STRING"
-> value (output): OBJECT

// ---------------------

scriptdictionaries (not showing them here):

dictionary add (DICTIONARY, KEY, VALUE)

a scriptdictionary item:
-> key (input): "STRING"
-> value (output): SCRIPT

P.S.

here's an example of adding/removing items from a list/dictionary, my old 'explore and travel' code:

(WARNING: this code was back when I was first learning this stuff, so there's some errors with some parts of the code and is also sloppy/bad coding)

http://textadventures.co.uk/forum/samples/topic/5138/explore-and-travel-code-sample-by-hk

if you can follow it... if not, feel free to ask for help in understanding it... (try studying it, generally, from the bottom up, to follow it. More specifically, I hope, too lazy to read my own code, lol: look at in this order: 'explore command/script/function' -> 'event/explore discovery dictionary/list' -> 'travel location dictionary/list' -> 'travel script/command/function')

(you first 'explore' in the starting location, which will randomly have events, though I only got discover new location events as this is only a sample/demo of this stuff, and it'll also add those the list of 'travel' locations, which you can now 'travel' to and back from, and again, since this is a sample/demo, I haven't created any random events for any of these new locations, only the starting location can you 'explore' and the only events I created are the 'discover location' events for the starting location)


here's my own extensive guide on using lists and dictionaries:

http://textadventures.co.uk/forum/samples/topic/5137/list-and-dictionary-extensive-guide-by-hk


Log in to post a reply.

Support

Forums