/* * Version 1.0 (06/01/01) * * This help file contains information on how to add special features * to a class for a dystopian mud. Things like mastery item, regenerate powers, * and creating class eq. * * By Jobo, coder for the Godwars Mud Dystopia. */ First how to add a mastery item for a class. For this we need to actually make the item with olc, I'm rather bad at using olc, so I'll presume you actually know how to use it. (a vnum is the unique number an item of a specific type gets so the mud knows how to handle each item, and what item to load/save/etc). Make the item, get the vnum for the item (we will use the vnum 32120 in this example), now we need to make sure that only that class (Titans) can use it. Open the file handler.c and edit the function equip_char(). You'll notice that it contains a long list of checks of this type : if ((obj->pIndexData->vnum >= 33040 && obj->pIndexData->vnum <= 33059) && (IS_NPC(ch) || !IS_CLASS(ch, CLASS_VAMPIRE))) { act( "You are zapped by $p and drop it.", ch, obj, NULL, TO_CHAR); act( "$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM); obj_from_char(obj); obj_to_room(obj, ch->in_room); do_autosave(ch, ""); return; } The above function makes sure that only vampires can use items in the range 33040 to 33059, which is vampire class eq in Dystopia. We need to add a similar check for our Mastery item. /* * First we check whether the item the player tries to wear is our mastery item (32120), * then should it be our mastery item, it checks to see if the player is actually a Titan, * remember the IS_NPC(ch) check, or mobs will be able to wear the item. */ if (obj->pIndexData->vnum == 32120 && (IS_NPC(ch) || !IS_CLASS(ch, CLASS_TITAN)) { /* * Plain and simple, zap the char and drop the item to the room. * Then save the player to avoid people using this to dub items, * it shouldn't be needed unless you run an unstable code. */ act( "You are zapped by $p and drop it.", ch, obj, NULL, TO_CHAR); act( "$n is zapped by $p and drops it.", ch, obj, NULL, TO_ROOM); obj_from_char(obj); obj_to_room(obj, ch->in_room); do_autosave(ch, ""); return; } You may want to give a range of vnums for your class, should you decide to make class equipment, ie. using 32120 to 32140 for Titans. Now that we have our mastery item created (in olc), and made sure only Titans can wear it, we should add the item to the do_mastery() command. Open jobo.c (yaya I know, just couldn't come up with a better name...) and edit the function do_mastery(). The function first checks if the player has the reqs for mastery, and then it decides what item the player get's depending on his class. Just add an extra line for your class in this list : if (IS_CLASS(ch, CLASS_MAGE)) vnum = 33014; else if (IS_CLASS(ch, CLASS_WEREWOLF)) vnum = 33112; else if (IS_CLASS(ch, CLASS_NINJA)) vnum = 33094; else if (IS_CLASS(ch, CLASS_MONK)) vnum = 33032; else if (IS_CLASS(ch, CLASS_DROW)) vnum = 33074; else if (IS_CLASS(ch, CLASS_DEMON)) vnum = 33134; else if (IS_CLASS(ch, CLASS_VAMPIRE)) vnum = 33054; .... cut .... /* * and the line for our Titans mastery item. */ else if (IS_CLASS(ch, CLASS_TITAN)) vnum = 32120; Simple as that. Now we only need to give the item a 'relic' flag. This is done in db.c, so open that file, and edit the function create_object(). When an item is created, a series of flags is set on the item, depending on it's vnum, so we should add the relic flag for the vnum 32120. In the function, you will find a series of checks for vnums, that looks like this : else if (obj->pIndexData->vnum >= 33180 && obj->pIndexData->vnum <= 33199) /* Angels */ { obj->condition = 100; obj->toughness = 100; obj->resistance = 1; SET_BIT(obj->quest, QUEST_RELIC); } The above is for angel eq, the CLASS_ANGEL isn't mentioned here, since handler.c takes care of that. We add a line for our mastery item (we could use a full range of vnums for a set of class equipment). /* * We give the item good resistance and the relic flag. */ else if (obj->pIndexData->vnum == 32120) /* Titan Mastery */ { obj->condition = 100; obj->toughness = 100; obj->resistance = 1; SET_BIT(obj->quest, QUEST_RELIC); } The Titans can now get a mastery item, that only they can use, and it gets the relic flag, everything works, and our job here is done. A full set of class equipment can be made in much the same way, you just need to make a command that the player can use to create the items (ie. do_titanarmor). Heres an example for Titan class equipment, we use the vnum range 32120-32140 (you should make the changes to the above code for this to work, consider it practice). void do_titanarmor(CHAR_DATA *ch, char *argument) { /* * We need two pointers, one to the index of the object and the object itself. * Then ofcourse a buffer to take a one-word argument (arg) as well as the vnum * of the item we want to create. */ OBJ_INDEX_DATA *pObjIndex; OBJ_DATA *obj; char arg[MAX_INPUT_LENGTH]; int vnum; /* * Get the first word in the argument. */ one_argument( argument, arg ); /* * Titans only. */ if (IS_NPC(ch)) return; if (!IS_CLASS(ch, CLASS_TITAN)) { send_to_char("Huh?\n\r",ch); return; } /* * Should the player not give an argument, we will list the possibly items the player can make. */ if (arg[0] == '\0') { send_to_char("You can make : Claymore, Breastplate, Helmet and Boots.\n\r", ch); return; } /* * We want the Titan to pay 60 points of primal for the equipment, let's see if he can pay. */ if (ch->practice < 60) { send_to_char("It costs 60 points of primal to create titan equipment.\n\r",ch); return; } /* * Let's see if the Titan gave an argument we can use, if not, we should list the possibly options. * If it's one of the items we can make, we should set the vnum value to the correct item. * Remember to make the actual items in olc first, or the mud *WILL* crash... maybe. */ if (!str_cmp(arg, "claymore"")) vnum = 33121; else if (!str_cmp(arg, "breastplate")) vnum = 33122; else if (!str_cmp(arg, "helmet")) vnum = 33123; else if (!str_cmp(arg, "boots")) vnum = 33124; else { /* * this a little trick, we call do_titanarmor() again, without an argument, causing the function * to list the possibly options. This way we only need to list the items once in the code, and * should we decide to change the list of items, we only need to change it one place. */ do_titanarmor(ch, ""); return; } /* * Let's get the index of the item. Should it not exist, we should give an error. */ if ((pObjIndex = get_obj_index( vnum )) == NULL) { send_to_char("Missing item, please inform a god.\n\r", ch); return; } /* * Create the object. (50 is the level of the item, it decides the power of the * spells the object has. Has little to none effect in godwars, just use 50. */ obj = create_object(pObjIndex, 50); /* * We automaticly let the Titan own the item, saves the trouble of claiming it. * Whenever we copy a string, we use the function str_dup() which makes sure the * string is actually copied. */ obj->questowner = str_dup(ch->pcdata->switchname); /* * Give the item to the player, take the primal and make a fancy message with act(). */ obj_to_char(obj, ch); ch->practice -= 60; act("$p appears in your hands.",ch,obj,NULL,TO_CHAR); act("$p appears in $n's hands.",ch,obj,NULL,TO_ROOM); /* * Return from the function, */ return; } Now let's make sure our Titans can actually regenerate. We need to decide whether to put the regen affect on one of the items that the player can get, or simply add it as an automatic thing. We will use the automatic regen for Titans, you can take a look at the code for one of the classes that uses a regen item to figure out how this works. Since Dystopia uses a slightly different system for regenning than the stock godwars, I doubt this information will be of much use to those running non-dystopia godwars. Sorry people. Everything that updates a player (like regenerate) is located in the file update.c, so you should open that. First thing to do, is define a local function to regenerate titans. Theres a long list in the beginning for the other classes, just add the line : void update_titan args ((CHAR_DATA *ch)); This function should update everything we need about titans, including regen. We'll add the function to a list of functions that's called each round, this list is located in the function mobile_update(), so let's edit that. A few lines down in the function, we see the following bit of code : if (IS_HERO(ch) && ch->hit > 0) { if (ch->level < 7) update_safe_powers(ch); if (IS_CLASS(ch, CLASS_VAMPIRE)) { if (ch->rage >0) update_vampire_regen(ch); else if (IS_ITEMAFF(ch, ITEMA_REGENERATE)) update_arti_regen(ch); update_vampire(ch); } this is followed by a list of if's each checking whether the player is of a certain class. We should add a check for titans, and add the functions we want to get called for that class (namely update_titan). if (IS_CLASS(ch, CLASS_TITAN)) { /* * we could require that the Titans needs a certain power or something to get the regen, but we don't. */ update_titan(); } Now somewhere in the update.c file, we should put the code for update_titan(). Find a good spot, just make sure it isn't inside another function :-) void update_titan(CHAR_DATA *ch) { /* * First we check if the player needs mana, move or hitpoints, and call the regen function, * which is poorly named werewolf_regen() even though all classes use it. The number 2 is * the regenfactor... the higher, the faster the player regens. 2 is what most classes use. */ if ( ch->hit < ch->max_hit || ch->mana < ch->max_mana || ch->move < ch->max_move) werewolf_regen(ch, 2); /* * regen_limb() simply regenerates lost limbs like arms, legs, toes, etc. */ regen_limb(ch); /* * Done, so let's leave. */ return; } If we where to rely on regen items, we should make a check much like the one vampires use for regen items. if (IS_ITEMAFF(ch, ITEMA_REGENERATE)) update_arti_regen(ch); This calls the function update_arti_regen() which basicly gives a factor 2 regen affect. Have fun. Jobo