/******************************************************************************************** * This is a simple skill I created called "NOFLY" which enables characters of a certain * * race. This is best used for a race that is affected by AFF_FLYING by defualt * * (for exmample, dragons). This skill allows for the race to be able to master the arts * * of taking off, and landing gracefully. This skill is automatically set for your race at * * level 1, and is set to 100 percent so that it is always effective. * * You'll have to forive me if it appears large, but I wanted to make sure it was clear and * * somewhat easy to read, as this is my ver first snippet I've ever created. * * Files mucked in this snippet: * * COMM.C * * CONST.C * * DB.C * * FIGHT.C * * INTERP.C * * INTERP.H * * MERC.H * ********************************************************************************************/ /* Note: in the following files, lines that begin with the + sign, then those are the lines to add. */ /*==================================================================== * Okay, to start this off, let's add this skill so that dragons get it at creation, * and it's set to 100 percent. * File to MUCK: comm.c * Search for the text below (minus the asterisk): * gsn_recall * and below it add the following, right before the line that says * Do you wish to customize this character? */ /* Replace dragon with the race name you want to give the skill to. */ + if (ch->race == race_lookup("dragon")) + { + ch->pcdata->learned[gsn_nofly] = 100; + } /*==================================================================== * Next file. This is the actual skill declaration for the skill table. * File to MUCK: const.c * Search for: !Recall! * You'll see a little } bracket underneath that line. First, you'll want to add a comma right * after that bracket, otherwise you'll have compiling errors. */ /* Add the following right after: }, */ + + { + "nofly", { 1, 1, 1, 1 }, { 1, 1, 1, 1}, + spell_null, TAR_IGNORE, POS_STANDING, + &gsn_nofly, SLOT( 0), 0, 12, + "", "!Nofly!", "" + } /*==================================================================== * Alright, let's register the gsn in db.c * File: db.c * Search for: gsn_recall; * Right below it, add the following */ +sh_int gsn_nofly; /* Nofly by Koqlb */ /*==================================================================== * Now, we'll add the command into the command table. * File: interp.c and interp.h * Add a separate sction below the immortal commands for racial skills and add the following. */ /* in interp.c add: */ + { "nofly", do_nofly, POS_STANDING, 0, LOG_NEVER, 1 }, /* and in interp.h, in the appropriate place (if using stock, right below noemote. Otherwise * Add it accordingly in alphabetical order */ +DECLARE_DO_FUN( do_nofly ); /*==================================================================== * Now we'll add the gsn in the skill table in merc.h * File: merc.h * Search for: gsn_recall * Add the following */ + +/* New GSN's for skills by Koqlb */ +extern sh_int gsn_nofly; /*==================================================================== * This is the actual meat and potatoes of the nofly skill. The actual command. * This CAN be used by immortals, and mortals, provided they meed the criteria. * File: fight.c * I recommend putting this at the bottom. I made a section at the bottom of my fight.c * file specifically for racial and class skills/spells. */ +/* Actual nofly command to compliment skill by Koqlb */ +void do_nofly( CHAR_DATA *ch, char *argument ) +{ + int race; + + race = race_lookup(argument); +/* Race lookup detects whether the player is the race that you want the skill for. + * Replace the "dragon" race with whatever race + * You have that's automatically affected by flying. + */ + if (ch->race != race_lookup("dragon") && ch->level <= LEVEL_HERO) /* Immortals can use the nofly command too.*/ + { + send_to_char("Only the Dragon kind can fly and land at will.\n\r",ch); + return; + } + /* If check to make sure the char has enough movement points. You can comment this part if you want. */ + + if (ch->race = race_lookup("dragon") && ch->move > 15) + { + send_to_char("You are too tired to lift off into the skies. Rest a bit.\n\r",ch); + return; + } +/* If check to see if the character isn't flying. If not, sets the character + * with AFF_FLYING affect flag. + */ + if (!IS_AFFECTED(ch, AFF_FLYING)) + { + SET_BIT(ch->affected_by, AFF_FLYING); + act( "You expand your wings and take off into the air.", ch, NULL, NULL, TO_CHAR ); + act( "$n expands $s wings and takes off into the air.", ch, NULL, NULL, TO_ROOM ); + } +/* So the player is already flying... Okay, soooooo... */ + else + { +/* Let's make the player land back on the ground, but we want to enhance RP, so + * we'll make it look like somewhat of a graceful landing though. + */ + REMOVE_BIT(ch->affected_by, AFF_FLYING); + act( "Your wings are absorbed into your shoulders and you land softly.", ch, NULL, NULL, TO_CHAR ); + act( "$n's wings disappear into $s shoulders and $e lands softly.", ch, NULL, NULL, TO_ROOM ); + } + return; +} /*End of the do_nofly command */ /* This is the end of the snippet. Once you add all of this stuff in (Please make sure you didn't leave the * plus signs in... That'll always screw up the compile. :P), then go ahead and * run a clean compile (in other words, type "rm *.o" [without the quotes], hit enter, and THEN type make). * I tested this using ROM 2.4b6 modified with OLC 1.81. However, the race part itself shouldn't mess * anything up. It doesn't add any extra flags that stock ROM doesn't already have on it. I don't ask for a ton * of credit for this snippet or anything. All I ask for is that you do leave the comments with my name in them * Where the line is preceeded by the + sign. I apologize if this code seems sloppy, but I did my best to organize * it. If you have any questions or comments, fire an e-mail my way at koqlbmusic@bellsouth.net and I'll make sure * I write ya back. --Koqlb, Owner and creator of Subversive Visions. * http://www.subversive-visions.com */