Extreme Help

Posted by Saint on Tue 05 Apr 2005 12:08 AM — 4 posts, 19,347 views.

#0
Alright folks. Running rom24b6 in Cygwin. Most of you have heard from me before. Im getting nothing at all but grief when I try to add questing to my mud. *Growls and pulls hair out* I find the documentation and installation directions on it very very poorly done, and cannot understand half of it.
I send my plea to you all. If you can so kindly take a look at the code below, and please alter it with correct directions on where things go and what file they go in and where I would eternally be in your debt. Thanks.

----------------------------------------------------

------------------------------------------------------------------
/* Automated quest code originall written by Vassago (Who i'm giving
credit to despite the fact he gives no credit to the people who's code he
copies (aka the rom consortium).
Revamped by Kharas (mud@fading.tcimet.net) */

/* You need to add the following to pc_data:
sh_int quest_curr; /* current number of quest points */
int quest_accum; /* quest points accumulated in players life */
CHAR_DATA * questgiver; /* who gave the quest quest */
int questpoints;
int nextquest;
int countdown;
int questobj;
int questmob;

You need to #define PLR_QUESTING (??) in merc.h

Add a new spec_fun in special.c:
At the top add: DECLARE_SPEC_FUN( spec_questmaster );

In: const struct spec_type spec_table[] =
Add: { "spec_questmaster", spec_questmaster },

Add the following anywhere in special.c:
bool spec_questmaster( CHAR_DATA *ch )
{
return TRUE;
}
In fight.c, in the function group_gain, after all the stuff about
getting zapped by equipment, add the following:
if (!IS_NPC(gch) && IS_SET(gch->act,PLR_QUESTING )
&& IS_NPC(victim))
{
if (gch->pcdata->questmob == victim->pIndexData->vnum)
{
send_to_char("You have almost completed your quest!\n\r",gch);
send_to_char(
"Return to the questmaster before your time runs of time.\n\r",gch);
ch->pcdata->questmob = -1;
}
}
....
In save.c you need add the following in fwrite_char:
fprintf( fp, "Quest_Curr %d\n", ch->pcdata->quest_curr );
fprintf( fp, "Quest_Accum %d\n", ch->pcdata->quest_accum );
if (ch->pcdata->nextquest != 0)
fprintf( fp, "QuestNext %d\n", ch->pcdata->nextquest );
else if (ch->pcdata->countdown != 0)
fprintf( fp, "QuestNext %d\n", 10 );
in fread_char, under case 'Q': you need to add:
KEY( "Quest_Curr", ch->pcdata->quest_curr, fread_number( fp ) );
KEY( "Quest_Accum", ch->pcdata->quest_accum, fread_number( fp ) );
KEY( "QuestNext", ch->pcdata->nextquest, fread_number( fp ));
You will also need to add quest_update(); in update.c right before/after
area_update();.

This was originally modified for my smaug mud, but I think i've changed
everything so it will work with rom. Go ahead and write me if ya have
problems (mud@fading.tcimet.net)
*/

----------------------------------------------------------

Thats the installation stuff. I find this very confusing for some reason. The rest of the code is quest.c and that I can install. Simple as adding quest.c to the src directory and adding the file in make I believe? Anyhow I'll post the code below. Beware, its long.

------------------------------------------------------
/* Real quest.c stuff.. above is just installation crud :) */
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include "mud.h"

struct reward_type
{
char *name;
char *keyword;
int cost;
bool object;
int value;
void * where;
};

/* Descriptions of quest items go here:
Format is: "keywords", "Short description", "Long description" */
const struct quest_desc_type quest_desc[] =
{
{"quest sceptre", "the Sceptre of Courage",
"The Sceptre of Courage is lieing here, waiting to be returned to its owner."},

{"quest crown", "the Crown of Wisdom",
"The Crown of Wisdom is lieing here, waiting to be returned to its owner."},

{"quest gauntlet", "the Gauntlets of Strength",
"The Gauntlets of Strength are lieing here, waiting to be returned to its owner."},

{NULL, NULL, NULL}
};

/* Local functions */
void generate_quest args(( CHAR_DATA *ch, CHAR_DATA *questman ));
void quest_update args(( void ));
bool quest_level_diff args(( int clevel, int mlevel));

------------------------------------

If you need to see the actual quest.c file please let me know.
Australia #1
Whats not to understamd, this is all pretty much self explanitory, /* You need to add the following to pc_data:
so grep for pc_data, you will get a lot of responces, but its talking about the structure pc_data, which is located in merc.h.

You need to #define PLR_QUESTING (??) in merc.h, again grep for PLR_ and add that to th list, the ?? is so you can add in the correct bit, they are all leters, you will see a pattern, just add the next on in the pattern.

The spec_fun is the easiest, open up special.c and put the bits of code in with the others that look like it.

As for the rest, just do what it says, open the file, find the function and put the code in where it says to.

In fight.c, in the function group_gain, after all the stuff about getting zapped by equipment, add the following:

So open fight.c find the group_gain function and then read it till you find bits about getting zapped. Its not brain surgery, just follow the directions, and use find in your editor or grep from the command line to find where stuff is.
#2
Yea I do all the installation crud. The part im having trouble with is Quest.C itself. I get TONS of errors when I try to compile. I'd post the errors here but I cant scroll up all the way in cygwin.
Australia #3
Ok, without the errors its hard to pinpoint the problem, but i can tell you a few of the most common ones that i know of.

Some of the vassago quest snips(earlier versions) are just all bugs and not worth the trouble of using. If you are getting 100's of errors its most likely due to the snippet txt being saved in a windows editor and the formating stuff is being lost.

Look at some of the send_to_char calls and you will find that those have been split over 2 lines with a carrage return, instead of being just 1 long line. Most likely there will only be 3 or 4 actuall errors, the rest is because the compliler gets confused.