/**************************************************************** *For those of you who are new to coding, or for those of you * * who aren't, I made this little bitty snippet simply because * * a LOT of MUDs have vampires on them, and a lot of them may * * be able to feed, or drain corpses, but they aren't able to * * necessarily regain hp by drinking blood in general. * * So that's why I made this. I don't need any sort of credit * * unless you desire to do so... Or what's the point of sharing * * an idea? Also, on my MUD, I've made it vary by level. You* * are fully welcome to do the same, or leave it as it is. * * If you follow the directions (I try to be as detailed as * * possible), you shouldn't have ANY problems adding this snip. * * If you have any questions, comments, or anything else, * * Feel free to contact me at justinwilliams@fantasysquare.com * * -Koqlb, Implementor of Subversive Visions * * P.S.- This was used on a version of ROM, so if you don't have* * the vampire race, you can add it, or chang the race name * * in the snippet to another one that drinks blood. Or, you can * * get rid of the race_lookup check completely so that all plrs * * can replenish hp by drinking blood. * * UPDATED Dec 4th, 2014 * ****************************************************************/ /* Alrighty. First off, I'd like to dissect this snippet and show you what it * does. If you already know first hand what this will do, and don't want to * find out about the details of it, then just skip to the part, where it * says --+*code*+-- (or search for that in this documents, * and follow the instructions below there. */ /* -+TUTORIAL+-: Okay, just in case you're curious, here is the tutorial. You can even use this as a guide for future references to similar things, so I hope it's useful. Here's the guide: if (( liquid = (obj->value[2] == (liq_lookup("blood")))) && ch->race == race_lookup("vampire")) { gain_condition( ch, COND_THIRST, amount * liq_table[liquid].liq_affect[COND_THIRST] * 2); gain_condition( ch, COND_HUNGER, amount * liq_table[liquid].liq_affect[COND_HUNGER] * 2); if (ch->hit < ch->max_hit) { ch->hit += number_range(10, 50); } else { ch->hit = ch->max_hit; } } Liquid indicates the liquid itself. and the liq_lookup is a function that's in lookup.c so that the MUD can look up a certain liquid number by its name from the tables in const.c. liquidname is the "name" of the liquid on your mud (for example, milk, water, etc.). The ch->race is the race of the character drinking. The race_lookup function is a lot similar, it only checks well... races, and "racename", is the race benefitting from this. Next is the gain_condition. This was put in there because with blood, I had to not only modify the liquid table slightly, but because I noticed that it didn't quench thirst. On ROM, it has the opposite effect of -1 by default. Therefore, I made it 2, and multiplied the number by 2 for the race benefitting from this to give them a slight advantage. Now, for the hp bonus (or whatever bonus you want to give them.) I picked a number_range between 10 and 50 for my MUD, you may want to make it less if you don't have high HP on your MUD (maybe between 5 and 25). The first line with the number range depicts how much HP to add to the current players hp. This is really helpful when they first die too, because they can replenish some hp after being killed. the second if check in there is tricky. Normally, if you just put the addition to the hp in there, you may find that the players hp goes over their maximum hit points. Therefore, that second check in there makes sure that if they drink, and their hit points are at maximum, they'll stay there. That's the tutorial. If you wish to apply this to other races, or use other liquids, or even make it so that it helps them gain something else, it's pretty easy to figure out and change. I hope that this helped. Below is the code.*/ ------------------ /*--+*code*+--: */ /* In act_obj.c */ /* Find this (case sensitive): COND_THIRST * Right below that, and in between the COND_HUNGER and the if check * for COND_FULL, add this bit of code. + equals things you should add. *-------------------------------------------------------------------- * Old version had a funky if check for if ch->hit was over max_hit. * Fixed this properly. */ amount * liq_table[liquid].liq_affect[COND_HUNGER] / 2 ); +/* Let Vampires be or other blood drinkers replenish + * their health by drinking blood. + * -Koqlb of Subversive Visions + */ + if (( liquid = (obj->value[2] == (liq_lookup("blood")))) + && ch->race == race_lookup("vampire")) + { + gain_condition( ch, COND_THIRST, + amount * liq_table[liquid].liq_affect[COND_THIRST] * 2); + gain_condition( ch, COND_HUNGER, + amount * liq_table[liquid].liq_affect[COND_HUNGER] * 2); + if (ch->hit < ch->max_hit) + { + ch->hit += number_range(10, 50); } + else { + ch->hit = ch->max_hit; + } + } + /*Don't include the + signs when you're copying and pasting, or just * remove them when you're done. */ /* Also, if you want, I'd recommend taking out the if check for players being * full that doesn't enable them to drink or eat anymore. But that's your * choice. Just search for "Your too full to" and delete all of the if checks. * for that. If you want to leave the "too full" check in, I'd increase the * numbers in the number range to about 25 and 100, so that a player might * be able to get a good enough increase at higher levels.*/ /* Last but not least... In "const.c", search for: "liquid_table" and find blood on the list. See that value that's a negative numeber? Change it to the number '2'. This will ensure that there is SOME thirst-quenching to it. (Why they had it as a negative # escapes me... */ ------------------ /* That's it... To add another race, all you have to do is simply add: * && ch->race == race_lookup("racename")) to the 'if' check. * Also, next to the "vampires" lookup, be sure that if you add * a race, that the vampires doesn't have an extra ) on it (it'll have two of them * if it doesn't.*/ /* Other snippets by Koqlb are on http://www.mudbytes.net : * Nofly skill - Flying races can fly/land at will. * BetterQuestFix - Make a minute a real minute * Immortal Spellup - Fun Immortal Spellup Command. * TrueSight - True Sight Spell = ALL Detections * Player Validation - Validation system for new players. * Bash Crontab Startup Script - Add this to your server's crontab. Better than Mudcheck.pl * Shorten Declares and Clean - Clean and shrink some code. * Wizify - Immortal Command to set all stats on a new Imm Staff Member. *!Quest3Fix - This will be done in the next 48 hours. Fixes to make quest3 * work correctly. */