TAXI COMMAND SNIPPET By KOUMINTANG KOWTOW of STAR WARS REBELLION UPRISING ---------------------------------------------------------------------------- Feel free to use this snippet as you see fit, and distribute it as you wish. All I ask is you keep the credits and the comments in where they belong ---------------------------------------------------------------------------- FILES TO BE MODIFIED: BUILD.C MUD.H SPACE.C or SPACE2.C TABLES.C ---------------------------------------------------------------------------- Without further ado, lets get to the code. ---------------------------------------------------------------------------- IN BUILD.C ---------------------------------------------------------------------------- Find: char * const r_flags [] = and at the end add: , "spaceport" THEN UNDER VOID DO_REDIT: FIND: if ( !str_cmp( arg, "flags" ) ) and add in , spaceport before the last \n\r ---------------------------------------------------------------------------- IN MUD.H ---------------------------------------------------------------------------- FIND: /* * Room flags. Holy cow! Talked about stripped away.. * Used in #ROOMS. Those merc guys know how to strip code down. * Lets put it all back... ;) */ AND AT THE END OF THE LIST ADD: #define ROOM_SPACEPORT 47 I use extended Bit Vectors so my number is 47 yours may be different if you do not use extended Bit Vectors your number will look something like #define ROOM_SPACEPORT BV27 For example. THEN FIND: /* * Command functions. * Defined in act_*.c (mostly). */ And ADD IN: DECLARE_DO_FUN( do_taxi ); THEN FIND: void echo_to_cockpit_main args( ( int color , SHIP_DATA *ship , char *argument ) ); AND UNDER IT ADD: void transship args( (SHIP_DATA *ship, int destination) ); ---------------------------------------------------------------------------- IN SPACE.C or SPACE2.C (depending on which you use) ---------------------------------------------------------------------------- AT THE BOTTOM OF THE FILE ADD: /* * DO_TAXI COMMAND WRITTEN FOR SWR 1.0 and DERIVITIVES * BY KOUMITANG KOWTOW OF STAR WARS REBELLION UPRISING * ANY QUESTIONS ABOUT THIS CODE CAN BE SENT TO littlejay_43019@yahoo.com */ void do_taxi( CHAR_DATA *ch, char * argument) { SHIP_DATA *ship, *rental = NULL; char buf[MAX_STRING_LENGTH]; int cost; if ( !xIS_SET( ch->in_room->room_flags, ROOM_SPACEPORT ) )/* if you are not using extended bitvectors remove the x from xIS_SET*/ { send_to_char( "&RYou need to be at a landing pad to call a public shuttle.\n\r", ch); return; } cost = 200; if( ch->gold < cost) { send_to_char("You do not have enough gold to get the rental here! \n\r", ch); return; } for ( ship = first_ship; ship; ship = ship->next ) { if ( !str_cmp( ship->owner , "Public" ) && !IS_SET(ship->flags, SHIP_SIMULATOR ) ) { if( ship->class > CAPITAL_SHIP) continue; if( ship->type == MOB_SHIP) continue; if( ship->shipstate != SHIP_DOCKED) continue; if( ship->lastdoc == ch->in_room->vnum) continue; if( is_rental(ch,ship) ) rental = ship; } } if(rental == NULL) { send_to_char( "All the public ships are already here.\n\r", ch); return; } transship(rental, ch->in_room->vnum); ch->gold -= 200; rental->hatchopen = TRUE; sprintf( buf, "%s - %s lands on the platform and you are charged 200 credits.", rental->model, rental->name ); echo_to_room( AT_GREEN, get_room_index( rental->location ), buf); sprintf( buf, "The hatch on %s opens.", rental->name ); echo_to_room( AT_YELLOW, get_room_index( rental->location ), buf); rental->shipyard = ch->in_room->vnum; save_ship(rental); } /* * TRANSSHIP CODE WRITTEN BY: ORTLUK FOR THE DESIGNSHIP COMMAND * ALL QUESTIONS ABOUT THIS CODE SHOULD BE SENT TO: ortluk@hotmail.com * A SPECIAL THANKS TO ORTLUK FOR WRITING THIS CODE. */ void transship(SHIP_DATA *ship, int destination) { int origShipyard; if ( !ship ) return; origShipyard = ship->shipyard; ship->shipyard = destination; ship->shipstate = SHIP_DOCKED; extract_ship( ship ); ship_to_room( ship , ship->shipyard ); ship->location = ship->shipyard; ship->lastdoc = ship->shipyard; ship->shipyard = origShipyard; if (ship->starsystem) ship_from_starsystem( ship, ship->starsystem ); save_ship(ship); } ---------------------------------------------------------------------------- IN TABLES.C ---------------------------------------------------------------------------- FIND: if ( !str_cmp( name, "do_target" )) return do_target; AND BELOW IT ADD: if ( !str_cmp( name, "do_taxi" )) return do_taxi; THEN FIND: if ( skill == do_target ) return "do_target"; AND BELOW IT ADD: if ( skill == do_taxi ) return "do_taxi"; ---------------------------------------------------------------------------- IN THE SHELL ---------------------------------------------------------------------------- MAKE CLEAN MAKE ---------------------------------------------------------------------------- IN THE GAME: ---------------------------------------------------------------------------- cedit taxi create do_taxi cedit taxi level 1 cedit save copyover/reboot your mud That is it, taxi will be ready to use after that. AGAIN PLEASE LEAVE THE CREDITS AND COMMENTS WHERE THEY ARE TO GIVE CREDIT WHERE CREDIT IS DUE. ANY QUESTIONS ABOUT MY CODE PLEASE E-MAIL ME @ littlejay_43019@yahoo.com