/******************************************************************************************* * This is a simple snippet to allow you to use one skill function for muliple skills. * A little bit of thinking and anyone could figure this out and it's simply a minor code. * alteration so no credit is warrented * jereth@hotmail.com *******************************************************************************************/ //I'm useing a skill from a multi-time from mud //This shows how to modify any skill to be used for multiple reasons //Flash Bomb Also Used For: //Robotic: Flash Shot //Tech: Flash Device void spell_flash_bomb( int sn, int level, CHAR_DATA *ch, void *vo,int target ) { CHAR_DATA *vch; CHAR_DATA *vch_next; AFFECT_DATA af; int number; /***************************************************************** * This is where seperate syntax is assigned to each spell. * useing (skill_table[sn].name, "Skill Name") will do only the * functions associated with which ever command was used * eg. c 'flash bomb' will only use things assigned with * (!str_cmp (skill_table[sn].name, "Flash Bomb")) ***************************************************************** //All ACT Syntax - Each spell that calls from this function is listed. if (!str_cmp (skill_table[sn].name, "Flash Bomb")) {//For Alch Flash Bomb act("$n drops a flash bomb! The room is filled with a bright light.",ch,NULL,NULL,TO_ROOM); act("You drop a flash bomb and look away.",ch,NULL,NULL,TO_CHAR); } if (!str_cmp (skill_table[sn].name, "Flash Shot")) {//For Robotic Flash Shot act("$n shoots a flash of light.",ch,NULL,NULL,TO_ROOM); act("You close your eye lense and shoot a flash of light.",ch,NULL,NULL,TO_CHAR); } if (!str_cmp (skill_table[sn].name, "Flash Device")) {//For Tech Flash Device act("$n drops a flash Device! The room is filled with a bright light.",ch,NULL,NULL,TO_ROOM); act("You drop a flash device and look away.",ch,NULL,NULL,TO_CHAR); } // End All ACT Syntax /****************************************************************************************** * Skills act as normal with no if statements, these are universial for all skills assigned ****************************************************************************************** for ( vch = char_list; vch != NULL; vch = vch_next ) { vch_next = vch->next; if ( vch->in_room == NULL ) continue; if ( vch->in_room == ch->in_room ) { if (is_safe_spell(ch,vch,TRUE) || (IS_NPC(ch) && IS_NPC(vch) && (ch->fighting == vch || vch->fighting == ch))) continue; // Really can't become more blind if ( IS_AFFECTED(ch,AFF_BLIND) || is_affected(vch,skill_lookup("flash bomb")) || is_affected(vch,skill_lookup("flash shot")) || is_affected(vch,skill_lookup("flash device"))) continue; af.where = TO_AFFECTS; af.type = sn; af.level = level; af.location = APPLY_HITROLL; af.modifier = -4; af.duration = 1+level; af.bitvector = AFF_BLIND; affect_to_char( vch, &af ); if (!str_cmp (skill_table[sn].name, "Flash Bomb")) { send_to_char( "A flash bomb goes off, You are blinded!\n\r", vch ); act("$n was blinded by a flash bomb.",vch,NULL,NULL,TO_ROOM); } if (!str_cmp (skill_table[sn].name, "Flash Shot")) { send_to_char( "A flash shot was discharged, You are blinded!\n\r", vch ); act("$n was blinded by a flash shot.",vch,NULL,NULL,TO_ROOM); } if (!str_cmp (skill_table[sn].name, "Flash Device")) { send_to_char( "A flash device is activates, You are blinded!\n\r", vch ); act("$n was blinded by a flash device.",vch,NULL,NULL,TO_ROOM); } } } //Random generator for others in outdoor areas to see the flash. if ( vch->in_room->area == ch->in_room->area && IS_OUTSIDE(vch) && IS_OUTSIDE(ch) && IS_AWAKE(vch) ) { number = number_range(0,3); switch(number) { case (0) : send_to_char( "A quick flash brightens the sky.\n\r", vch ); break; case (1) : send_to_char( "A white flash illuminates the sky.\n\r", vch ); break; case (2) : send_to_char( "A quick flash illuminates the sky.\n\r", vch ); break; case (3) : send_to_char( "A white flash brightens the sky.\n\r", vch ); break; } } } // These are the three skills that use flash bomb // Note all share the same gsn, which doesn't matter since // the skill name is what shows up in the affect list. // Simply alter dispell type things to remove (skill_table[sn].name, "Skill Name") // Also if you wish to be able to put all skills in scrolls and such // You will need to assign a different SLOT number to each or the first // one will be loaded. { "flash bomb", { 1 }, { 1 }, spell_flash_bomb, TAR_IGNORE, POS_FIGHTING, &gsn_flash_bomb, SLOT( 4), 5, 12, "", "You can see again.", "" }, {//Calls Flash Bomb (Alch) "flash shot", { 1 }, { 1 }, spell_flash_bomb, TAR_IGNORE, POS_FIGHTING, &gsn_flash_bomb, SLOT( 0), 5, 12, "Flash Shot", "You can see again.", "" }, {//Calls Flash Bomb (Alch) "flash device", { 1 }, { 1 }, spell_flash_bomb, TAR_IGNORE, POS_FIGHTING, &gsn_flash_bomb, SLOT( 0), 5, 12, "Flash Device", "You can see again.", "" }, // Simply, I altered skills this way to reduce code and because I am lazy. // Definition - Lazy Programmer: Someone who spends 6 hours on a piece of code // to save 5 minutes.