*************************************************************** D R A G O N B A L L Z D I M E N S I O N Snippet- Race Spells *************************************************************** Dragonball Z Dimension Snippet Version 1.0 Author: David Piner Email: Dapiner@yahoo.com <---Not that long http://newpinerorder.hypermart.net Date: June 26, 2001 Circle Version: Beta Patch Level 17 Version 3 Requirements: Race Code, and knowledge of C ^ Uses GET_RACE(ch) Introduction Hello, this is the first contrib snippet. I run a windows mud and have a theme of the television show- Dragonball Z (well actually it is Dragonball/Dragonball Z/Dragonball GT but Z sounds the coolest) We have mobprogs/olc/and race spells/skills. What it Does It gives your muds races the ability to cast spells only assigned to races. I tried to put a RACE_HUMAN(or whatever) in the spell listing in class.c. What happened was it only assigned it sometimes. I figured it was not a good way to go. So I went and used the current assigns and created new ones. The reason you will have to have some C knowledge is you will need to edit it to your taste. I belive no snippet can be put in with out you editing it. Credit You do not have to put my name on your login screen or create a shrine in my honor. All you have to do is put my name in your credit file or email me. You don't have to give me a whole line, maybe just like 'we also would like to thank ...' and put me somewhere. I worked hard on this and would like just a little bit of credit, wouldn't you? Auto-Patch I can not stand autopatch. The only good auto patch is OLC on stock code. After that you have to look through + and - and try to get an idea where they go. So these is a manual patch (and not that big). Disclaimer Not responible for what it does to your mud REMEMBER ALWAYS BACKUP. Thanks. Code We will edit the *.h files first, so we can compile as we go (if you can do that) Spells.h In struct spell_info_type add: int min_level_race[NUM_RACES]; at the bottem in other prototype: Remove void spell_level(int spell, in chclass, int level); add void spell_level(int spell, int race, int level); void spell_level_class(int spell, int chclass, int level); Spell_parser.c There is two ways to go about allowing a player to cast: 1. Use Cast 2. Copy cast, change that ones name to like do_cast_r and change the referances to CLASS to RACE, then edit interperter. I thought like a player and used the old do_cast In ACMD(do_cast) Change the if ((get_level(ch) < (blah blah) [(int} GET_CLASS(ch)])){ blah blah blah with /* This is Donated by DBZ Dimension, here the function now see if the min_level_race is included */ if ((GET_LEVEL(ch) < SINFO.min_level[(int) GET_CLASS(ch)]) && (GET_LEVEL(ch) < SINFO.min_level_race[(int) GET_RACE(ch)])) { send_to_char("You do not know that attack!\r\n", ch); return; } Remove the old spell_level (or comment it out in case you have to revert back) and then add: If you assign more to class, then switch them around to spell_level beging for class, void spell_level(int spell, int race, int level) { int bad = 0; if (spell < 0 || spell > TOP_SPELL_DEFINE) { log("SYSERR: attempting assign to illegal spellnum %d/%d", spell, TOP_SPELL_DEFINE); return; } if (race < 0 || race >= NUM_RACES) { log("SYSERR: assigning '%s' to illegal race %d/%d.", skill_name(spell), race, NUM_RACES -1); /* If you have a good compiler, this should not happen*/ bad = 1; } if (level < 1 || level > LVL_IMPL) { log("SYSERR: assigning '%s' to illegal level %d/%d.", skill_name(spell), level, LVL_IMPL); bad = 1; } if (!bad) /* Right there \ is the new race stuff to */ spell_info[spell].min_level_race[race] = level; } /* This is the old class one, if you don't use races that much switch the names */ void spell_level_class(int spell, int chclass, int level) { int bad = 0; if (spell < 0 || spell > TOP_SPELL_DEFINE) { log("SYSERR: attempting assign to illegal spellnum %d/%d", spell, TOP_SPELL_DEFINE); return; } if (chclass < 0 || chclass >= NUM_CLASSES) { log("SYSERR: assigning '%s' to illegal class %d/%d.", skill_name(spell), chclass, NUM_CLASSES - 1); bad = 1; } if (level < 1 || level > LVL_IMPL) { log("SYSERR: assigning '%s' to illegal level %d/%d.", skill_name(spell), level, LVL_IMPL); bad = 1; } if (!bad) spell_info[spell].min_level[chclass] = level; } in void spello add: for (i = 0; i < NUM_RACES; i++) spell_info[spl].min_level_race[i] = LVL_IMMORT; in void unused spells add: for (i = 0; i < NUM_RACES; i++) spell_info[spl].min_level_race[i] = LVL_IMPL + 1; close and save spell_parser.c Ok, we have the ability to cast and assign, lets list them in practice and let them practice open spec_proc.c In void list skills add this: if (GET_LEVEL(ch) >= spell_info[i].min_level_race[(int) GET_RACE(ch)]) { sprintf(buf, "%-20s %s\r\n", spell_info[i].name, how_good(GET_SKILL(ch, i))); strcat(buf2, buf); /* This shows the Race practices */ } Now, the need to add the ability to practice, like in cast the same old class one can do it so lets add that: Where if (skill_num < 1 || GET_LEVEL(ch) < spell_info[skill_num].min_level_race[(int) GET_RACE(ch)]) { blah blah blah change to: if (skill_num < 1 || GET_LEVEL(ch) < spell_info[skill_num].min_level[(int) GET_CLASS(ch)] && GET_LEVEL(ch) < spell_info[skill_num].min_level_race[(int) GET_RACE(ch)]){ /* sprintf(buf, "You do not know of that attack\r\n"); send_to_char(buf, ch); return (1); } */ ^^^^^^^ Reason I commented it out is I changed it because all of my classes have spells and skills. You only have to worry about the top part. save and close spec_proc.c Now, they can practice, cast, and the mud can assign, now lets assign them to some classes. open class.c Go to where it assigns the spells/skills to race and class's: Add this comment above the init_spells.... /*DBZ Dimension Snippets Race/Class assigns To assign a class, use: spell_level_class To assign a race, use: spell_level If you assign it to a race and a class then a double echo follows: example A Human Warrior both assigned kick kick (good) kick (good) No matter, both will have the same practice, just look weird */ Then follow those directions and change that list. Example: spell_level(SPELL_ARMOR, RACE_HUMAN, 5) spell_level_class(SPELL_STRENGTH, CLASS_WARRIOR, 10) /* By the way, I do belive warriors should cast something */ Save and close class.c YOUR DONE!!!!!! Only thing you may want to do is gointo db.c and change the log where is says assigning spells, but that is just for looks. NOTICE: Not responbile for what this does. This is for entertainment only. Not all systems are alike, nor all code so you may have problems. I will not be able to help you unless you want me to send you your code that is windows comptbile (Which I wouldn't accept because its yours, you worked hard on it, why would you give it away?) Post Thoughts Well, now you races can have race only spells, why not go further??? Why not make Race only rooms? Or guilds of a certain class and race? I noticed a snippet on the circlemud ftp site call GMaster.tar.gz, and I looked through it and if you use this system for your guilds (which I highly support, I don't use it because I'm running a windows mud) Ideas > When a player types practice, you might work around and make it look like: Your current amount of practices is: 9 ---------------------------------------- These are your class skills and spells ---------------------------------------- Sancturary Good Kick Poor Armor Superb ---------------------------------------- These are your race skills and spells ---------------------------------------- Fly Superb High Kick Poor Ultra Charm SUPERB!!! < I wish!! ---------------------------------------- >If you create an automated skill/spell listing add in your races. >If your mud is HIGHLY roleplaying mud you can create a seprate cast command, just copy the orignal one, and can the refernces to min_level_race... and GET_RACE >Once again, if your mud is HIGHLY into roleplaying, add an extra Race Only gm, then maybe even a race guildguard (the more races you have the more the work, but its all according to your theme) >If you use a language code you may be able to link the language practices to races. Like a elf would speak english and elf only. Human could speak the easy language like human, elf, dwarf, pixie. Then you could turn languages into skills. >GOOD ONE!!!-If one of your races lack in the stats to be a good elf warrior, or an elf cleric would not be able to fight for them selfs, then assign an elf an excellant fighting skill (not kick, since that is one of the worse skills) or a nice spell. If you don't want them to fight then maybe a affect spell that only is tar_self. >BTW (by the way) You can assign skills to races Closeing I ask that if you come up with any form of nice improvment to circle please submit it to the ftp site. Even if you can't skell (pun intended on spell) I do not want no one takeing this and makeing it something else and say ' orignaly by: David Piner, please credit him.' Make your own. It toke me along time to figure this out. However if you wish to create a plug-in please email me at dapiner@yahoo.com. Thanks David Piner 'The Bard that Could' dapiner@yahoo.com