// This is an example of a mob that has conversation options in it.
inherit ADVERSARY;inherit M_CONVERSATION;
void setup() { set_name("Scruffy Murphy"); set_proper_name("Scruffy Murphy"); set_id("scruffy", "murphy", "scruffy murphy", "shopkeeper", "merchant", "man"); set_gender(1);
set_in_room_desc("Scruffy Murphy stands here, waiting for you to talk to him."); set_long("True to his name, Scruffy Murphy is grubby, scruffy, and filthy. Thin and lanky, the twenty-five year old man stands at about five feet eleven inches tall, with dark brown eyes and a shock of dark brown hair to go with it. Signs of premature aging is all about him, he has strands of silvery hair, and a few wrinkles around his eyes. He wears a dirty off-white t-shirt and has an unbuttoned, collared blue checkered shirt to go with a pair of dark blue, grubby looking jeans. With a bored look on his face, he seems to be minding the store. \n");
set_wearing("/domains/gear/clothes/tshirts/stained_tshirt.c"); set_wearing("/domains/gear/clothes/pants/oldjeans.c");
/*The first thing you should do is have a conversation tree set out. You can write one down manually - ideally this is better.Draw out a flowchart. For example: Player: Hello there.Scruffy says: Hello there. How are you?
Suppose you want the player to have to responses to that.Draw out a tree like this:
GoodHow are you? < Bad
Scruffy says something in response to either of that, and more conversation options mayturn up from there. For example: (The ones in brackets are S's replies)
|-Yes (I like this one)-END |-Good (That's nice. Do you like guns?)-| | |-No (Well you suck)-ENDHow are you?-| | |-No (Fine then)-END |-Bad (Oh, Sorry. Want to talk about it)-| |-Yes (Carry on)-I fell down-(oh)-END
Let's put this into practice, huh.*/
//This is the conversation options that the player is allowed to have. set_options( ([ "hello" : "Hello there.", "good" : "Good.", "bad" : "Bad.", "likeguns": "I like guns.", "noguns" : "I dislike guns.", "talk" : "I fell down this morning.", "notalk" : "Rather not talk about it.", ]) );
/*These actually set out the conversation trees in particular. They HAVE to respond to an option above, otherwise they won't work.This is actually the bulk of the conversation trees.*/ set_responses( ([ "hello" : "Why hello there. How are you? @@good,bad@@hello",
/* Why is it set up this way. @@good, bad in the first part refers to giving new conversation options of GOOD and BAD in the next line. The following part, @@hello, disallows the use of hello as a conversation option. Normally this is not needed, but I placed it there just in case. There is to be NO space inbetween the options.*/
"good" : "That's nice. What do you think about guns?@@likeguns,noguns@@bad",
/* This way, I disallow the "bad" conversation from continuing, keeping the discussionsweet and simple. */ "bad" : "That's bad. Do you want to talk about it?@@talk,notalk@@good",
/* Similarly, here I disallow the "good" conversation from continuing, keeping the discussionsimple. */
"likeguns" : "!emote pulls out a gun. 'I like this one', he says.@@-@@noguns",
/* Here, I made it so that he actually doesn't SAY it, but EMOTES the action. Also, I disallowedfurther conversation options, and made it so that the noguns option is removed. */
"noguns" : "Well you suck.@@-@@likeguns", "talk" : "Ah. I sympathise.@@-@@notalk", "notalk" : "Fine then.@@-@@talk",
]) );
/*This part is important as it tells the code which option to direct the player toat the start of the conversation.*/ set_start( ({ "hello" }) );
}