Welcome to the Builder Academy

Question Mob Extra Descriptions?

More
18 Oct 2017 07:59 #7017 by Papaya Pete
I saw that it looks like there's actually some code in place to put extra descriptions into a mob. It would be cool to put it to use, in my case making an ask chain system that can provide more story to players. Problem is, I'm not exactly sure how to go about making use of what is there.

I'm trying, at first, to just see if I can create the menu I would use for inputting new topics and dialog for each topics. If this is using extra descriptions, I tried plugging in some code used to input object extra descriptions.
Code:
case 'u': case 'U': /* If extra descriptions don't exist. */ if (OLC_MOB(d)->ex_description == NULL) { CREATE(OLC_MOB(d)->ex_description, struct extra_descr_data, 1); OLC_MOB(d)->ex_description->next = NULL; } OLC_DESC(d) = OLC_MOB(d)->ex_description; medit_disp_extradesc_menu(d); break;

This is located in medit.c, in the medit_parse function. It is under the MEDIT_MAIN_MENU case in the OLC_MODE(d) switch. I've added in the #defines for OLC_MODE in a separate function that displays the extra_desc menu.
Code:
/* For extra descriptions. */ static void medit_disp_extradesc_menu(struct descriptor_data *d) { struct extra_descr_data *extra_desc = OLC_DESC(d); clear_screen(d); write_to_output(d, "%s1%s) Keywords: %s%s\r\n" "%s2%s) Dialog:\r\n%s%s\r\n" "%s3%s) Goto next topic: ", grn, nrm, yel, extra_desc->keyword ? extra_desc->keyword : "<NONE>", grn, nrm, yel, extra_desc->description ? extra_desc->description : "<NONE>", grn, nrm ); write_to_output(d, !extra_desc->next ? "Not Set.\r\n" : "Set.\r\n"); write_to_output(d, "Enter choice (0 to quit) : "); OLC_MODE(d) = MEDIT_EXTRADESC_MENU; }

Mind you, all the work so far has, indeed, compiled just fine. I can even boot up the mud and medit a mob. However, when I choose to mess with these ex_descs, this is the result:
Code:
-- Mob Number: [1] 1) Sex: male 2) Keywords: old man 3) S-Desc: an old man 4) L-Desc:- Sitting on a small stool is an old man, who mumbles to himself quietly. 5) D-Desc:- Dressed in old grey robes, this old man has only a few wisps of spindly white hair left on his head. His beard, though it reaches his chest, is thin and can be seen through. Wrinkles form creases on his face, and his eyes look like they are shut at first glance. However, they're just barely open, and he mumbles to himself in an incoherent manner. He slowly rocks back and forth on the stool, as if constantly shifting his weight to get more comfortable. 6) Position : Standing 7) Default : Standing 8) Attack : hit 9) Stats Menu... A) NPC Flags : SENTINEL ISNPC NO_KILL B) AFF Flags : NOBITS S) Script : Set. T) Talk Text... U) Ask Chain : W) Copy mob X) Delete mob Q) Quit Enter choice : u 1) Keywords: <NONE> 2) Dialog: <NONE> 3) Goto next topic: Not Set. Enter choice (0 to quit) : -- Mob Number: [1] 1) Sex: male 2) Keywords: old man 3) S-Desc: an old man 4) L-Desc:- Sitting on a small stool is an old man, who mumbles to himself quietly. 5) D-Desc:- Dressed in old grey robes, this old man has only a few wisps of spindly white hair left on his head. His beard, though it reaches his chest, is thin and can be seen through. Wrinkles form creases on his face, and his eyes look like they are shut at first glance. However, they're just barely open, and he mumbles to himself in an incoherent manner. He slowly rocks back and forth on the stool, as if constantly shifting his weight to get more comfortable. 6) Position : Standing 7) Default : Standing 8) Attack : hit 9) Stats Menu... A) NPC Flags : SENTINEL ISNPC NO_KILL B) AFF Flags : NOBITS S) Script : Set. T) Talk Text... U) Ask Chain : W) Copy mob X) Delete mob Q) Quit Enter choice :

It prints out the display menu, but then kicks me right back out into the medit main menu. It might just be that I'm really tired and haven't had a real chance to take a look at this without having some kind of distraction, but I'm having a hard time seeing why this is happening.

Once I can get this to work, I'll try to figure out how to save those ex_descs to file. Which, at a glance, looks like a whole new headache that I am no where near familiar with to tackle (most likely). Once again, however, I'm pretty tired atm and walking away sometimes helps me approach with a fresh look.

Has anyone else tried implementing ex_descs for mobs? Any pointers or guidance would be greatly appreciated.

Please Log in or Create an account to join the conversation.

More
18 Oct 2017 08:23 #7018 by zusuk
Replied by zusuk on topic Mob Extra Descriptions?
I would look at how it is handled on objects and just copy that...

But if you are looking for an 'ask chain' solution, DG scripts makes that really easy without requiring extra descriptions for the mobile.

Website
www.luminariMUD.com

Main Game Port
luminariMUD.com:4100

Please Log in or Create an account to join the conversation.

More
18 Oct 2017 17:14 #7020 by Papaya Pete
Replied by Papaya Pete on topic Mob Extra Descriptions?
That is what I was thinking. I have even compared/copied how it is done in rooms. I won't be able to take a good look at it until Thursday.

I worked briefly on a mud with a friend a long time ago, and he actually hard codes in talk, ask, and tell chains. At the time I was much younger and much more impatient, and didn't appreciate the potential. I like to hard code things in if possible, as in most cases (for me) it makes creating stuff a little faster. I used to use scripts to shoot out a blurb of text mobs will say, but added in the "talk" command that essentially adds a description of dialog. In cases in which I want some kind of exceptional case (like an npc changes what he says once you complete action a) I plan on using scripts then.

Please Log in or Create an account to join the conversation.

More
18 Oct 2017 17:19 #7021 by zusuk
Replied by zusuk on topic Mob Extra Descriptions?
Yeah I totally forgot, a lot of builders do not want to get involved in learning how to script, but would really appreciate a sort of easy menu-selection based system for ask-chains or even simply give-item-based quest lines. Ironically we do have such a system built in, but only because our former head builder came from a previous MUD and asked that I bring in that particular set of code for her :)

Website
www.luminariMUD.com

Main Game Port
luminariMUD.com:4100

Please Log in or Create an account to join the conversation.

More
19 Oct 2017 00:04 #7022 by Papaya Pete
Replied by Papaya Pete on topic Mob Extra Descriptions?
So I think I'm starting to get a little closer to figuring out what is happening. I threw in a single write_to_output to just test and see if a specific case related to the extra_desc is even being pulled up.
Code:
case MEDIT_EXTRADESC_MENU: write_to_output(d, "Hi hi.\r\n"); switch ((number = atoi(arg))) { case 0: if (!OLC_DESC(d)->keyword || !OLC_DESC(d)->description) { struct extra_descr_data *temp; if (OLC_DESC(d)->keyword) free(OLC_DESC(d)->keyword); if (OLC_DESC(d)->description) free(OLC_DESC(d)->description); /* Clean up pointers */ REMOVE_FROM_LIST(OLC_DESC(d), OLC_MOB(d)->ex_description, next); free(OLC_DESC(d)); OLC_DESC(d) = NULL; } break; case 1: OLC_MODE(d) = MEDIT_EXTRADESC_KEY; write_to_output(d, "Enter keywords, separated by spaces :-\r\n| "); return; case 2: OLC_MODE(d) = MEDIT_EXTRADESC_DESCRIPTION; send_editor_help(d); write_to_output(d, "Enter the dialog:\r\n\r\n"); if (OLC_DESC(d)->description) { write_to_output(d, "%s", OLC_DESC(d)->description); oldtext = strdup(OLC_DESC(d)->description); } string_write(d, &OLC_DESC(d)->description, MAX_MESSAGE_LENGTH, 0, oldtext); OLC_VAL(d) = 1; return; case 3: /* Only go to the next description if this one is finished. */ if (OLC_DESC(d)->keyword && OLC_DESC(d)->description) { struct extra_descr_data *new_extra; if (OLC_DESC(d)->next) OLC_DESC(d) = OLC_DESC(d)->next; else { /* Make new extra description and attach at end. */ CREATE(new_extra, struct extra_descr_data, 1); OLC_DESC(d)->next = new_extra; OLC_DESC(d) = OLC_DESC(d)->next; } } /* No break - drop into default case. */ default: medit_disp_extradesc_menu(d); return; } break;

That single write_to_output, which is supposed to just print "Hi hi" as a test, is never reached. This is despite the OLC_MODE(d) = MEDIT_EXTRADESC_MENU at the end of the extradesc sub menu.
Code:
/* For extra descriptions. */ static void medit_disp_extradesc_menu(struct descriptor_data *d) { struct extra_descr_data *extra_desc = OLC_DESC(d); clear_screen(d); write_to_output(d, "%s1%s) Keywords: %s%s\r\n" "%s2%s) Dialog:\r\n%s%s\r\n" "%s3%s) Goto next topic: ", grn, nrm, yel, extra_desc->keyword ? extra_desc->keyword : "<NONE>", grn, nrm, yel, extra_desc->description ? extra_desc->description : "<NONE>", grn, nrm ); write_to_output(d, !extra_desc->next ? "Not Set.\r\n" : "Set.\r\n"); write_to_output(d, "Enter choice (0 to quit) : "); OLC_MODE(d) = MEDIT_EXTRADESC_MENU; }

I thought that the problem might be I threw the case MEDIT_EXTRADESC_MENU into another switch statement found within the Main Menu case. No go. I've tried to copy it as best as I can from oedit (even double checking from redit, which I will triple check now).

Please Log in or Create an account to join the conversation.

More
19 Oct 2017 06:32 #7023 by Papaya Pete
Replied by Papaya Pete on topic Mob Extra Descriptions?
Ooooookay! Well, I finally figured out what was going on. Check it out.
Code:
case 'u': case 'U': /* If the extra description doesn't exist. */ if (!OLC_MOB(d)->ex_description) CREATE(OLC_MOB(d)->ex_description, struct extra_descr_data, 1); OLC_DESC(d) = OLC_MOB(d)->ex_description; medit_disp_extradesc_menu(d); return; // <<-------- this used to be a break;

Ugh, at least it was very simple. The next part is not so simple, as trying to save data to a file and read it is much harder. Menu works fine, data is actually saved. Now, however, it's crashing because I have to figure out how to read that info off of the file. I'll take a look tomorrow and see what I can do.

Please Log in or Create an account to join the conversation.

Time to create page: 0.268 seconds