Cargo system for SWR 1.0 - installs easily into stock swr 1.0. the instructions may be a little vauge, but most coders should be able to understand it. p.s. don't set a planet with import to all and anything for export, it will work but players could make money by simply loading and unloading cargo without ever going anywhere. Any questions/comments email: ortluk@hotmail.com in mud.h: --------- in struct ship_data { int maxcargo; int cargo; int cargotype; in struct planet_data { int import; int export; after WEAPON_ types /* cargo types */ #define CARGO_NONE 0 #define CARGO_ALL 1 #define CARGO_LOMMITE 2 #define CARGO_MELEEN 3 #define CARGO_NEUTRON 4 #define CARGO_ZERSIUM 5 #define CARGO_STEEL 3 #define CARGO_RYLL 7 #define CARGO_ALAZHI 8 #define CARGO_MAX 9 with other DECLARE_DO_FUNC lines - DECLARE_DO_FUN( do_load_cargo ); DECLARE_DO_FUN( do_unload_cargo ); DECLARE_DO_FUN( do_imports ); in clans.c: ------------ char * const cargo_names[CARGO_MAX] = { "none", "all","lommite","Meleenium","Neutronium","Zersium", "steel","rhyll","alazhi" }; in do_setplanet - add the following if ( !strcmp( arg2, "import")) { for (i = 0; i < CARGO_MAX; i++) { if (!str_cmp( argument, cargo_names[i])) { planet->import = i; send_to_char("done.\n\r", ch ); save_planet( planet ); return; } } send_to_char("No such cargo type\r\n", ch); return; } if ( !strcmp( arg2, "export")) { for (i = 0; i < CARGO_MAX; i++) { if (!str_cmp( argument, cargo_names[i]) && (i != CARGO_ALL)) { planet->export = i; send_to_char("done.\n\r", ch ); save_planet( planet ); return; } } send_to_char("No such cargo type\r\n", ch); return; and add this function. void do_imports( CHAR_DATA *ch, char *argument ) { PLANET_DATA *planet; if (argument[0] == '\0') { send_to_char("Usage: imports \r\n", ch); return; } planet = get_planet( argument ); if (!planet) { send_to_char("&RNo such planet\r\n", ch); return; } ch_printf(ch,"&BImport and Export data for %s:\r\n", planet->name); ch_printf(ch,"&BImport: &W%s &BExport: &W%s\r\n", cargo_names[planet->import], cargo_names[planet->export]); return; } in do_planets - add ch_printf( ch, "&WImports: &G%s &WExports: &G%s\n\r", cargo_names[planet->import], cargo_names[planet->export]); in space.c ------------ add this line - extern char * const cargo_names[CARGO_MAX]; in save_ship - with the other fprinfs - fprintf( fp, "MaxCargo %d\n", ship->maxcargo ); if (ship->cargo > 0) { fprintf( fp, "Cargo %d\n", ship->cargo ); fprintf( fp, "CargoType %d\n", ship->cargotype ); } in fread_ship - you know where they go KEY( "Cargo", ship->cargo, fread_number( fp ) ); KEY( "CargoType", ship->cargotype, fread_number( fp ) ); KEY( "MaxCargo", ship->maxcargo, fread_number( fp ) ); if (ship->cargotype != CARGO_NONE && ship->cargo < 1) ship->cargotype = CARGO_NONE; in do_setship - if ( !str_cmp( arg2, "maxcargo" ) ) { ship->maxcargo = URANGE(0, atoi(argument), 500); send_to_char( "Done.\n\r", ch ); save_ship(ship); return; } in do_showship ch_printf( ch, "Cargo: %d/%d, Cargo Type: %s \n\r", ship->cargo, ship->maxcargo, cargo_names[ship->cargotype]); in do_makeship ship->maxcargo=0; ship->cargo=0; ship->cargotype=0; in do_info - ch_printf( ch, "Maximum Speed: %d Hyperspeed: %d Maximum Cargo %d\n\r", target->realspeed, target->hyperspeed, target->maxcargo ); in do_stat - ch_printf( ch, "&OCargo: &Y%d/&O%d Cargo Type: &Y%s&w\n\r", ship->cargo, ship->maxcargo, cargo_names[ship->cargotype]); add these functions - void do_unload_cargo( CHAR_DATA *ch, char *argument) { SHIP_DATA *ship; SHIP_DATA *target; int cost; PLANET_DATA *planet; if ( argument[0] == '\0' ) { act( AT_PLAIN, "Which ship do you want to unload?.", ch, NULL, NULL, TO_CHAR); return; } target = ship_in_room( ch->in_room , argument ); if ( !target ) { act( AT_PLAIN, "I see no $T here.", ch, NULL, argument, TO_CHAR ); return; } if (!check_pilot(ch, target)) { send_to_char("Hey, that's not your ship!\r\n", ch); return; } if ( target->cargo == 0 ) { send_to_char("You don't have any cargo.\r\n",ch); return; } if ( !IS_SET( ch->in_room->room_flags, ROOM_IMPORT ) && !IS_SET( ch->in_room->room_flags, ROOM_SPACECRAFT )) { send_to_char("You can't do that here!", ch); return; } planet = ch->in_room->area->planet; if (!planet) { ship = ship_from_hanger( ch->in_room->vnum ); if (!ship) { send_to_char("You can't do that here!", ch); return; } if ((ship->maxcargo - ship->cargo) < 1) { send_to_char("There is no room for anymore cargo\r\n",ch); return; } if (ship->cargo == 0) ship->cargotype = CARGO_NONE; if ((ship->cargo > 0) && (ship->cargotype != target->cargo)) { send_to_char("They have a differnt type of cargo.\n\r",ch); return; } if (ship->cargotype == CARGO_NONE) ship->cargotype = target->cargotype; if ((ship->maxcargo - ship->cargo) >= target->cargo) { ship->cargo += target->cargo; target->cargo = 0; target->cargo = CARGO_NONE; send_to_char("Cargo unloaded.\r\n",ch); return; } else { target->cargo -= ship->maxcargo - ship->cargo; ship->cargo = ship->maxcargo; ch_printf(ch, "%s Loaded, %d tons still in %s hold.\r\n", ship->name, target->cargo, target->name); return; } } if ((target->cargotype != CARGO_NONE) && (target->cargotype != planet->import) && (planet->import != CARGO_ALL)) { send_to_char("You can't deliver that here.\r\n",ch); return; } cost = target->cargo; cost *= (planet->base_value / 1000) * target->cargotype; ch->gold += cost; target->cargo = 0; target->cargotype = CARGO_NONE; ch_printf(ch,"You recieve %d credits for a load of %s.\r\n", cost, cargo_names[planet->import]); return; } void do_load_cargo( CHAR_DATA *ch, char *argument) { SHIP_DATA *ship; SHIP_DATA *target; int cost; PLANET_DATA *planet; if ( argument[0] == '\0' ) { act( AT_PLAIN, "Which ship do you want to load?.", ch, NULL, NULL, TO_CHAR); return; } target = ship_in_room( ch->in_room , argument ); if ( !target ) { act( AT_PLAIN, "I see no $T here.", ch, NULL, argument, TO_CHAR ); return; } if (!check_pilot(ch, target)) { send_to_char("Hey, that's not your ship!\r\n", ch); return; } if ( !IS_SET( ch->in_room->room_flags, ROOM_IMPORT ) && !IS_SET( ch->in_room->room_flags, ROOM_SPACECRAFT )) { send_to_char("You can't do that here!", ch); return; } planet = ch->in_room->area->planet; if (!planet) { ship = ship_from_hanger( ch->in_room->vnum ); if (!ship) { send_to_char("You can't do that here!", ch); return; } if (ship->cargo == 0) { send_to_char("They don't have any cargo\n\r", ch); return; } if ((target->maxcargo - target->cargo) < 1) { send_to_char("There is no room for anymore cargo\r\n",ch); return; } if ((target->cargotype =! CARGO_NONE) && (ship->cargotype != target->cargotype)); { send_to_char("Maybe you should deliver your cargo first.\n\r",ch); return; } if (target->cargotype == CARGO_NONE) target->cargotype = ship->cargotype; if ((target->maxcargo - target->cargo) >= ship->cargo) { target->cargo += ship->cargo; ship->cargo = 0; send_to_char("Cargo loaded.\r\n",ch); return; } else { ship->cargo -= target->maxcargo - target->cargo; target->cargo = target->maxcargo; send_to_char("Cargo Loaded.\r\n",ch); return; } } if (target->maxcargo - target->cargo <= 0) { send_to_char("There is no room for more Cargo.\r\n", ch); return; } if ((target->cargotype != CARGO_NONE) && (target->cargo != planet->export)) { send_to_char("Maybe you should deliver your cargo first\r\n",ch); return; } if (planet->export == CARGO_NONE) { send_to_char("We don't export goods here\r\n", ch); return; } cost = (target->maxcargo - target->cargo); cost *= (planet->base_value / 10000) * planet->export; if (ch->gold < cost) { send_to_char("You can't afford it!\r\n", ch); return; } ch->gold -= cost; target->cargo = target->maxcargo; target->cargotype = planet->export; ch_printf(ch,"You pay %d credits for a load of %s.\r\n", cost, cargo_names[planet_export]); return; } in tables.c if ( !str_cmp( name, "do_imports")) return do_imports; if ( !str_cmp( name, "do_load_cargo")) return do_load_cargo; if ( !str_cmp( name, "do_unload_cargo")) return do_unload_cargo; if ( skill == do_imports) return "do_imports"; if ( skill == do_load_cargo) return "do_load_cargo"; if ( skill == do_unload_cargo ) return "do_unload_cargo"; almost done .... now just make clean make and add the commands online cedit imports create do_imports cedit imports level 1 cedit loadcargo create do_load_cargo cedit loadcargo level 1 cedit unloadcargo create do_unload_cargo cedit unloadcargo level 1 cedit save