Addclass.doc

From: Brett C Helgeson (bhelgeson@csc.Cornell-Iowa.edu)
Date: 01/28/94


	Here you go, the one email you have been waiting for! How to add 
a class to CircleMUD source code! It is long task, but one that might be
worth the effort. First off, unless you want to add a ton of new skills 
and spells,(mainly spells, skills are another matter) magic-using classes
are a bit harder to put in, but the general principle is the same for non
magic using and magic using character classes. Without further ado....
	Things you will need to add a class to Circle:
 * Lots of time (about 2 hours for your first class, less with each one)
 * Patience, the more the better.
Thats about it, other than the code itself. Note: These changes were done
on Circle 2.2, so some small changes *might* be in order for your version,
but more likely things will just plug right in.
 (one last thing: try to install everything at one time, its much easier to
find mistakes now rather than later..)
These are the files that we will be adding to:
 * act.wizard.c
 * constants.c
 * interpreter.c
 * spec_procs.c
 * spell_parser.c
 * limits.c
(That should be it, although I might have missed one)
	Step one: Changing the act.wizard.c
1. Add to the ch->abilities; 
   case CLASS_NEW:
      ch->abilities.str = table[0]; 
      ch->abilities.intel = table[1];
      ch->abilities.wis = table[2];
      etc.
  /*Put these in any order you want. The first attribute will be 4d6, 3 highest
    the next 4 will be 3d6. Mages with intel first, Thieves with Dex, etc. */
 Follow the format of the big '4' and all will be fine.
2. Add to the SET_SKILL tables;
   case CLASS_NEW :
      SET_SKILL(ch, SKILL_ANYTHING, 0);
      SET_SKILL(ch, SKILL_ANYTHING, 0);
      etc.
   Skills can be set to anything <100. As many skills can be assigned as wanted
	Step two: Changing the interpreter.c
1. Add to the Opening Class lists;
   SEND_TO_Q("\n\rSelect a class:\n\r (C)leric (T)hief (M)age (W)arrior (N)ew", d);
2. Add to the *arg
   if (*arg !='m' && *arg !='c' && *arg !='w' && *arg !='t' && *arg !='n') {
 Note: The *arg needs to be a different letter than m-c-t-w
3. Add to switch (*arg) {
          case 'm' : GET_CLASS(d->character) = CLASS_MAGIC_USER;break;
Example:  case 'n' :GET_CLASS(d->character) = CLASS_NEW; break;
	Step three: Change the constants.c
1. Add to the const char    *class_abbrevs[] = {
  "--";
  "Mu",
  "Cl",
  "Ne", <---New class abbreviations.
   etc.
Note: the "--" shoud look like this "--", not as shown above.
2. Add to const struct title_type titles [4] [35] = {
   change the [4] [35] to [5] [35] or however many classes you add.
  The first number in brackets is the amount of classes; 6 classes would be [6] [35]
3. Add 35 titles and exp values
  "the Man", "the Woman", 0},
   etc.
4. Add to const char *pc_class_types[] = {
   "UNDEFINED",
   "Magic User",
   "New Class",
    etc.
5. Add to const int      thaco[4] [35] = {
   Change first number in brackets to total classes, same as above for 2
6. Add to the thaco lists, a total of 35 added
   Remeber to order them as they are listed in const char *pc_class_types, or 
   mages might get warrior's attack percentages.
	Step four: Change the spec_procs.c
1. Add to static char *class_skills[] = {
   static char   *n_skills[] = {
    "anyskill",
    "anyskill",
     etc. 
 Order doesnt matter here. In example above *n_skills, n is new class *arg !='n' so
 a bard(example) would be *b_skills[] = {
2. Add to case CLASS_NEW:
   Follow the format for the other classes.
  This is where the main difference comes into play between non spell using
  characters and spell using characters. New skills need to be coded also.
 (Thats coming along with how to make new spells =)
	Step five: Adding to spell_parser.c
1. Add to const byte saving_throws [4][5] [35] = {
 Note: The above                ^^^^^^^^^^^^^
    Might be reversed: By already having stuck in a
  fifth class, I don't remember which was at [4] and [5]. Just add to the one with
  four.
	Step six: Adding to limits.c 
1. If you are adding a spell using class, then add to all of the places where 
   (GET_CLASS (ch) ==CLASS_MAGIC_USER /or/ CLASS_CLERIC) are. 
   If your not, ignore this step.
2. Add to case CLASS_WHATEVER
Example   case CLASS_NEW :
             add_hp +=number(1, 5); /*char gains 1 to 5 hits per level*/
             add_mana = number(GET_LEVEL(ch), (int)(1.5 *GET_LEVEL(ch)));
            /* add the above only if a spell using class*/
             add_mana = MIN(add_mana, 1);
            /*add the above only if a spell using class*/
             add_mana = 0;
            /add above only if a non-spell using class/
             break;
 
  Well that *should* be it. Just remember, if you want to add a spell using class, 
there is alot more work to be done. Go back to spell_parser.c.
1. #define MANA_NEWCLASSABBREV 1       /Just the class Abbreviation/
2. Add to #define SPELLO(nr, beat, pos, mlev, clev, newclasslev, mana, tar, finc) { \
3. Add a new spell_info line like this:
     spell_info[nr].min_level_newclass = (newclasslev); \
    Add this after the spell_info[nr].min_level_magic = (mlev); \
4. Add to the line below #define SPELL_LEVEL(ch, sn )
    spell_info[sn].min_level_cleric : spell_info[sn].min_level_magic :
    spell_info[sn].min_level_newclass)
5. Go through ALL of the SPELLO's and add to each one the newclass level of
  when they can cast it.

	Well thats it. If any problems come up let me know. I would appreciate it 
if you do add a class to tell me what you added, how it works and any other things
that relate to it. I would like to set up a "Class" exchange if anyone would be 
interested. Once you get the hang of things, it goes pretty quickly, although each
time a new spell using class is added, you *have* to go through all the SPELLO's
and change it again. 
	One last thing, for the very last step, step 5, make sure that you add the
newclass AFTER the mlev, clev, then the newclasslev. Otherwise you may get the spells
mixed up with each other...
	I hope this is clear and easy to understand, and also that I didn't 
scroll the screen to much =). If you want to add this to the doc directory, please
do, but feed my ego and put in a little "Addclass.doc provided by Brett@Legends"
Thanks =)         Brett@Legends



This archive was generated by hypermail 2b30 : 12/07/00 PST