***************************************************************** * * * From: Arthur Sheffield * * Rising Moon * * or * * * * Disclaimer: * * Remember to back up your code before * * you apply anything. I am not responsible * * for your mud eating your hard drive and * * spiting it out at you. These code snippits * * are just little things that I have done * * to Rising Moon that seem to work very nicely. * * Feel free to use them or laugh at me as you * * are deleting them. As for credit, if you * * feel the need to memtion me, so be it, but * * its not really nessary. NOR asked that you do. * * * * Note: Some things sent in are just modifications, * * not written by me, just modifidy by me. Others, my be * * written by me. Still no credits are nessary. * * * * If you would, if you improve on any of these please email me * * so I can add those improvments into my code. Thanks :) * * * ***************************************************************** 03/19/01 Subject: Cleric spells : Lloyds set / Lloyds return A spell that allows clerics to set beacons in a room and later return to that room where they set the beacon. Ok now I will go thou the step to put this in place, but some of the things to put in will be a little differnt from your code, cause I have modifiy some parts of my code that are different from the stock code. So on some of this you will have to put them where your code has them set. First: Make a new flag -- PLR_BEACONROOM Second: In structs.h under struct player_special_data you need : int beacon_room; char *beacon_name; Third: In utils.h you will need the following : GET_BEACONNAME(ch) ((ch)->player_specials->beacon_name) GET_BEACONROOM(ch) ((ch)->player_specials->beacon_room) Forth: In db.c under store_to_char add this line somewhere after ch->player_specials->saved = st->player_specials_saved; GET_BEACONNAME = NULL; Fifth: In fight.c under void die add this in so when they die they will lose the room they set: GET_BEACONNAME = NULL; and them modify REMOVE_BIT(PLR_FLAGS(ch), PLR_KILLER | PLR_THIEF); to: REMOVE_BIT(PLR_FLAGS(ch), PLR_KILLER | PLR_THIEF | PLR_BEACONROOM); SIXTH: In the do_score you will add the following: Note: My do_score is very heavly modify, so I will show you how I did it, but you do not have to put this in if you do not want to, this just allows players to see what room they have their beacon set to. (one other thing. if you do not want to add this part to your do_score, then you do not have to add in all the GET_BEACONNAME code, and you will have to remove it from the manaual spells below.) ok the code: *buf = '\0'; if (GET_LEVEL(ch, REAL_L) >= 32) { if (PLR_FLAGGED(ch, PLR_BEACONROOM)) { if (GET_BEACONNAME(ch) != NULL) { sprintf(buf, "Beacon: Set at %s\r\n", GET_BEACONNAME(ch)); } else { strcat(buf, "Beacon: Not set.\r\n"); } } else { strcat(buf, "Beacon: Not set.\r\n"); } } SEVENTH: In spells.h you will have to define the spells, so add: #define SPELL_LLOYDS_SET # meaning which number is next #define SPELL_LLOYDS_RETURN # meaning which number is next then after #define MANUAL_SPELL(spellname) with the rest of the manual spells add: ASPELL(spell_lloyds_set); ASPELL(spell_lloyds_return); EIGHTH: In spell_parser.c under (IS_SET(SINFO.routines, MAG_MANUAL)) add the following: cast SPELL_LLOYDS_SET: MANUAL_SPELL(spell_lloyds_set); break; cast SPELL_LLOYDS_RETURN: MANUAL_SPELL(spell_lloyds_return); break; ok then we have to add the spells, here again my code is heavily modified, so will show you how I set mine, you will have to put yours in to fit your code. first, this is how my code sets spello, this will show you what all my settings are, on const char *name and const char *wear_off_msg if I remember right, those are in the constants.c file. Older stock code assgined the name and the wear_off_msgs there. This is my version of void spello, look it over so you see how to remove the parts your code does not use. /* Assign the spells on boot up */ void spello(int spl, const char *name, int max_mana, int min_mana, int mana_change, int stone_level, int minpos, int targets, int violent, int offenise, int routines, int spare0, int spare1, int spare2, int spare3, const char *wear_off_msg) OK, now the spells, add these in under void mag_assign_spells(void) spello(SPELL_LLOYDS_SET, "lloyds set", 50, 25, 7, 0, POS_STANDING, TAR_IGNORE, FALSE, FALSE, MAG_MANUAL, 0, 0, 0, 0, "!Llyods set!"); spello(SPELL_LLOYDS_RETURN, "lloyds return", 75, 50, 7, 0, POS_STANDING, TAR_IGNORE, FALSE, FALSE, MAG_MANUAL, 0, 0, 0, 0, "!Llyods return!"); NINTH: In the spells.c file add these two spells somewhere in the file: ASPELL(spell_lloyds_set) { sh_int load_broom; SET_BIT(PLR_FLAGS(ch), PLR_BEACONROOM); load_broom = world[ch->in_room].number; if (GET_BEACONNAME(ch) != NULL); free(GET_BEACONNAME(ch)); GET_BEACONNAME(ch) = str_dup(world[ch->in_room].name); GET_BEACONROOM(ch) = load_broom; send_to_char("Your beacon is set to this room.\r\n", ch); return; } ASPELL(spell_lloyds_return) { sh_int load_broom; if (!PLR_FLAGGED(ch, PLR_BEACONROOM)) { send_to_char("You have no beacons set\r\n", ch); return; } REMOVE_BIT(PLR_FLAGS(ch), PLR_BEACONROOM); if (GET_BEACONNAME(ch) != NULL); free(GET_BEACONNAME(ch)); load_broom = GET_BEACONROOM(ch); load_broom = real_room(load_broom); act("$n disappears in a flash of white light", FALSE, ch, 0, 0, TO_ROOM); char_from_room(ch); char_to_room(ch, load_broom); send_to_char("As the flash of light disappears you can see the room.\r\n\r\n", ch); act("$n appears in a flash of white light", FALSE, ch, 0, 0, TO_ROOM); look_at_room(ch, 0); return; } TENTH: Ok adding the min_level, well there again, my code is very heavily modified, my code when it does the init_spell_levels() command in db.c reads a file outside the code, stock code (if i rem right) uses void init_spells_levels(void) in the class.c file. Either way is fine, you just have to rem to add the min_level, weather it is in a file, or in class.c, (I have both these spells assigned to be cleric spells, and you get both at the same time, you do not have assign them to clerics if you do not want to. you can give them to what ever class you want. Ok, that should be it. Now compile and you should be up and running. If you have a problems, email me and i will see what i can do. If I missed anything, let me know, I will update this txt file and resubmit it.