This snippet adds slave circuits to the current list of modules, enabling ship owners and pilots to remotely call the ship to their location, if they're in a hanger, change the ship password, check status, or use the ship's speakers to broadcast with shiptalk. In mud.h Around line 1223, in struct ship_data, add: sh_int slave; Around line 1929, add: #define AFFECT_SLAVE 14 *NOTE: Make sure that the number above hasn't already been used, if it has, just change it to a higher number than hasn't! Around line 4955, add: void talk_channel args( ( CHAR_DATA *ch, char *argument, int channel, const char *verb ) ); In tech.c Void do_makemodule; Around line 31, find the very long ifcheck that starts with: if str_cmp(arg, "hull") && str_cmp(arg, "shield") && str_cmp(arg, "speed") and add this to it: && str_cmp(arg, "slave") Then on the line just below, add "Slave" to the list of available modules. Around line 205, add: if(!str_cmp(arg, "slave")) { affecttype = AFFECT_SLAVE; affectammount = (level / 25); strcpy(name, "A Slave Module"); } Void do_showmodules; Around line 328, add: if(mod->affect == AFFECT_SLAVE) strcpy(str, "Slave"); Void do_removemodule; Around line 480, add: if(mod->affect == AFFECT_SLAVE) ship->slave-=mod->ammount; In ships.c Void do_installmodule; Around line 2197, add: int slave=0; Around line 2262, add: if(mod->affect == AFFECT_SLAVE) ++slave; Around line 2285, add: if (modobj->value[0] == AFFECT_SLAVE && (ship->slave > 0)) { send_to_char("This ship already has an slave circuit!\n\r", ch); return; } Around line 2300, add: (modobj->value[0] == AFFECT_SLAVE && slave >= maxslot) || Around line 2412, add: if(mod->affect == AFFECT_SLAVE) ship->slave+=mod->ammount; In space.c, void save_ship, around line 2680, add: fprintf( fp, "Slave %d\n", ship->slave ); in fread_ship, around line 3639, add: KEY( "Slave", ship->slave, fread_number( fp ) ); *Note: Make sure that you put the key in the right case! Then just copy/paste the following code into space.c, add the lines for do_transmit_pass, do_transmit_call, do_transmit_status, and do_transmit_broadcast in mud.h and tables.c, recompile, create the 4 comamnds in-mud, and add the following helpfile. 1 "Slave Module"~ Syntax- transmit_pass Syntax- transmit_call Syntax- transmit_status Syntax- transmit_broadcast TRANSMIT_CALL allows you to call your ship from anywhere that it is at, as long as you are in a hanger. There is a slight delay based on your ship's hyperspeed. TRANSMIT_PASS allows you to remotley change your ship's password from anywhere. TRANSMIT_STATUS shows you the ship's status over your comlink. It is equal to you being inside the ship and typing "status." TRANSMIT_BROADCAST allows you to send a message over the ship's internal speakers. It is similar to shiptalk, but can only do one way broadcasts. You must have a comlink to use any of these commands. ~ Send me an e-mail at fotemud@yahoo.com if you have any problems with it. -Trillen void do_transmit_pass( CHAR_DATA *ch, char *argument) /* Coded by Trillen of SW:FotE for slave circuit modules * Allows player to remotely change the shiplock */ { int locknum; SHIP_DATA *ship; char buf[MAX_STRING_LENGTH]; char arg1[MAX_STRING_LENGTH]; char arg2[MAX_STRING_LENGTH]; bool ch_comlink; OBJ_DATA *obj; argument = one_argument(argument, arg1); argument = one_argument(argument, arg2); if ( !arg1 || arg1[0] == '\0') { send_to_char( "Usage: transmit_pass <####>\n\r", ch ); return; } if ( !arg2 || arg2[0] == '\0') { send_to_char( "Usage: transmit_pass <####>\n\r", ch ); return; } for(ship=first_ship; ship; ship=ship->next) if(!str_prefix(arg1, ship->name)) break; if (!ship) { send_to_char( "Error: That ship does not exist.\n\r", ch ); return; } if (ship->slave < 1) { send_to_char( "Error: That ship does not have a slave circuit.\n\r", ch); return; } if ( !check_pilot( ch , ship ) ) { send_to_char("&RHey, thats not your ship!\n\r",ch); return; } if (IS_IMMORTAL(ch) ) { ch_comlink = TRUE; } if (!IS_IMMORTAL(ch) ) { ch_comlink = FALSE; for ( obj = ch->last_carrying; obj; obj = obj->prev_content ) { if (obj->pIndexData->item_type == ITEM_COMLINK) ch_comlink = TRUE; } } if ( !ch_comlink ) { send_to_char( "You need a comlink to do that.\n\r", ch); return; } if ( IS_SET( ch->in_room->room_flags, ROOM_SILENCE ) ) { send_to_char( "Your comlink will not function here.\n\r", ch ); return; } locknum = atoi( arg2 ); if (locknum < 1000 || locknum > 9999) { send_to_char("Number out of range. Shippass must be between 1000 and 9999.\n\r",ch); return; } ship->password = locknum; sprintf(buf, "%s lock number set to %d.\n\r", ship->name, ship->password); send_to_char(buf, ch); save_ship(ship); } void do_transmit_call( CHAR_DATA *ch, char *argument) /* Coded by Trillen and Eleven of SW:FotE for slave circuit modules * Allows user to call ship from anywhere in the galaxy. * Note: I couldn't find a way to have the timer call only detect movement commands, so if the player uses any command before the hyperspace travel timer runs out, it will instantly move the ship to the hanger to prevent it appearing in another room and getting stuck. */ { SHIP_DATA *ship; char buf[MAX_STRING_LENGTH]; char buf2[MAX_STRING_LENGTH]; int roomloc; int hprspd = 0; bool ch_comlink; OBJ_DATA *obj; switch( ch->substate ) { default: if ( argument[0] == '\0' ) { send_to_char( "Usage: transmit_call \n\r", ch ); return; } for(ship=first_ship; ship; ship=ship->next) if(!str_prefix(argument, ship->name)) break; if (!ship) { send_to_char( "Error: That ship does not exist.\n\r", ch ); return; } if (ship->class >= SHIP_CRUISER) { send_to_char( "Error: Capitol ships cannot be called to a hanger.\n\r", ch ); return; } if (ship->slave < 2) { send_to_char( "Error: That ship does not have a Class 2 slave circuit.\n\r", ch ); return; } if (!check_pilot( ch , ship )) { send_to_char( "That ship does not belong to you!\n\r", ch ); return; } if (ship->tractored != NULL) { send_to_char( "That ship is being held by a tractor beam.\n\r", ch ); return; } if (IS_IMMORTAL(ch) ) { ch_comlink = TRUE; } if (!IS_IMMORTAL(ch) ) { ch_comlink = FALSE; for ( obj = ch->last_carrying; obj; obj = obj->prev_content ) { if (obj->pIndexData->item_type == ITEM_COMLINK) ch_comlink = TRUE; } } if ( !ch_comlink ) { send_to_char( "You need a comlink to do that.\n\r", ch); return; } if (!IS_NPC(ch) && IS_SET(ch->pcdata->act2, ACT_GAGGED)) { send_to_char( "You can't activate the call signal when you're gagged!\n\r", ch); return; } if (!IS_NPC(ch) && ( IS_SET(ch->act, PLR_SILENCE) )) { send_to_char( "You can't activate the call signal when you're silenced!\n\r", ch ); return; } if ( IS_SET( ch->in_room->room_flags, ROOM_SILENCE ) ) { send_to_char( "Your comlink will not function here.\n\r", ch ); return; } if ( !IS_SET( ch->in_room->room_flags, ROOM_CAN_LAND ) ) { send_to_char( "You must be in a hanger or docking bay!\n\r", ch ); return; } if (ship->hyperspeed == 5) hprspd = 25; if (ship->hyperspeed == 4) hprspd = 22; if (ship->hyperspeed == 3) hprspd = 19; if (ship->hyperspeed == 2) hprspd = 16; if (ship->hyperspeed == 1) hprspd = 13; sprintf(buf, "Remote Signal Recieved. En route to rendezvous point.\n\r"); send_to_char( "Remote Signal Recieved. Ship is en route to your location.\n\r", ch ); echo_to_ship( AT_PLAIN, ship, buf ); roomloc = ch->in_room->vnum; add_timer ( ch , TIMER_DO_FUN , hprspd , do_transmit_call , 1 ); ch->dest_buf = str_dup(argument); return; case 1: if ( !ch->dest_buf ) return; argument = str_dup(ch->dest_buf); DISPOSE( ch->dest_buf); break; case SUB_TIMER_DO_ABORT: if ( !ch->dest_buf ) return; argument = str_dup(ch->dest_buf); DISPOSE( ch->dest_buf); break; } ch->substate = SUB_NONE; for(ship=first_ship; ship; ship=ship->next) if(!str_prefix(argument, ship->name)) break; if (!ship) { send_to_char( "Error: Ship cannot be found.\n\r", ch ); return; } if ( !IS_SET( ch->in_room->room_flags, ROOM_CAN_LAND ) ) { send_to_char( "Your ship must land in a hanger or docking bay!\n\r", ch ); return; } roomloc = ch->in_room->vnum; sprintf(buf2, "Ship has arrived at rendezvous point.\n\r"); { send_to_char( "Ship has arrived at rendezvouz point.\n\r", ch ); echo_to_ship( AT_PLAIN, ship, buf2 ); } { ship->location = roomloc; extract_ship( ship ); ship_to_room( ship , ship->location ); ship->lastdoc = ship->location; ship->shipstate = SHIP_DOCKED; } if (ship->starsystem) ship_from_starsystem( ship, ship->starsystem ); save_ship(ship); } void do_transmit_status( CHAR_DATA *ch, char *argument) /* Coded by Trillen of SW:FotE for slave circuit modules. * Allows player to use comlink to get status on any of his ships with a slave circuit. */ { SHIP_DATA *ship; int x; bool ch_comlink; OBJ_DATA *obj; if ( argument[0] == '\0' ) { send_to_char( "Usage: transmit_status \n\r", ch ); return; } for(ship=first_ship; ship; ship=ship->next) if(!str_prefix(argument, ship->name)) break; if (!ship) { send_to_char( "Error: That ship does not exist.\n\r", ch ); return; } if (!ship->slave >= 3) { send_to_char( "Error: That ship does not have a Class 3 slave circuit.\n\r", ch); return; } if (!check_pilot( ch , ship )) { send_to_char( "That ship does not belong to you!\n\r", ch ); return; } if (IS_IMMORTAL(ch) ) { ch_comlink = TRUE; } if (!IS_IMMORTAL(ch) ) { ch_comlink = FALSE; for ( obj = ch->last_carrying; obj; obj = obj->prev_content ) { if (obj->pIndexData->item_type == ITEM_COMLINK) ch_comlink = TRUE; } } if ( !ch_comlink ) { send_to_char( "You need a comlink to do that.\n\r", ch); return; } if (!IS_NPC(ch) && IS_SET(ch->pcdata->act2, ACT_BOUND)) { send_to_char( "You can't transmit the status request when you're bound!\n\r", ch); return; } if ( IS_SET( ch->in_room->room_flags, ROOM_SILENCE ) ) { send_to_char( "Your comlink will not function here.\n\r", ch ); return; } send_to_char( "Remote status request transmitted. Receiving response now.\n\r", ch ); ch_printf( ch, "&w[&W %s &w] &zShip Condition: %s\n\r\n\r",ship->name, ship->shipstate == SHIP_DISABLED ? "&RDisabled" : "&GRunning"); ch_printf( ch, "&zCurrent Coordinates:&w %.0f %.0f %.0f &zCurrent Heading:&w %.0f %.0f %.0f\n\r", ship->vx, ship->vy, ship->vz, ship->hx, ship->hy, ship->hz ); ch_printf( ch, "&zSpeed:&w %d&W/%d &zHyperdrive: &wClass %d %s %s\n\r", ship->currspeed , ship->realspeed, ship->hyperspeed, ship->class >= SHIP_CRUISER ? "&zBay doors:" : "", (ship->class >= SHIP_CRUISER && ship->bayopen == TRUE) ? "&wOpen" : (ship->class>= SHIP_CRUISER && ship->bayopen == FALSE) ? "&wClosed" : "" ); ch_printf( ch, "&zHull:&w %d&W/%d &zShields:&w %d&W/%d &zFuel:&w %d&W/%d\n\r\n\r", ship->hull, ship->maxhull, ship->shield, ship->maxshield, ship->energy, ship->maxenergy); ch_printf( ch, "&zPrimary Weapon System: &w%-7s&W:: &w%s\n\r", ship->primaryState == LASER_DAMAGED ? "&ROffline" : "&GOnline", primary_beam_name(ship)); switch(ship->primaryType) { case 0: x = 0; break; case 1: x = ship->primaryCount; break; case 2: x = 2*ship->primaryCount; break; case 3: x = 3*ship->primaryCount; break; case 4: x = 4*ship->primaryCount; break; case 5: x = ship->primaryCount; break; case 6: x = ship->primaryCount; break; case 7: x = ship->primaryCount; break; case 8: x = ship->primaryCount; break; case 9: x = ship->primaryCount; break; default: x = 1; break; } ch_printf(ch, "&z Linked fire: &w%s\n\r", (x <= 1) ? "Unavailable" : ship->primaryLinked == TRUE ? "&GON" : "&ROFF"); switch(ship->secondaryType) { case 0: x = 0; break; case 1: x = ship->secondaryCount; break; case 2: x = 2*ship->secondaryCount; break; case 3: x = 3*ship->secondaryCount; break; case 4: x = 4*ship->secondaryCount; break; case 5: x = ship->secondaryCount; break; case 6: x = ship->secondaryCount; break; case 7: x = ship->secondaryCount; break; case 8: x = ship->secondaryCount; break; case 9: x = ship->secondaryCount; break; default: x = 1; break; } if(ship->secondaryCount != 0) { ch_printf( ch, "&zSecondary Weapon System: &w%-7s&W:: &w%s\n\r", ship->secondaryState == LASER_DAMAGED ? "&ROffline" : "&GOnline", secondary_beam_name(ship)); ch_printf(ch, "&z Linked fire: &w%s\n\r", (x <= 1) ? "Unavailable" : ship->secondaryLinked == TRUE ? "&GON" : "&ROFF"); } if (ship->turret1) ch_printf( ch, "\n\r&zTurret One: &w %s &zCurrent Target:&w %s\n\r", ship->statet1 == LASER_DAMAGED ? "Damaged" : "Operational" , ship->target1 ? ship->target1->name : "none"); if (ship->turret2) ch_printf( ch, "&zTurret Two: &w %s &zCurrent Target:&w %s\n\r", ship->statet2 == LASER_DAMAGED ? "Damaged" : "Operational" , ship->target2 ? ship->target2->name : "none"); if (ship->turret3) ch_printf( ch, "&zTurret Three:&w %s &zCurrent Target:&w %s\n\r", ship->statet3 == LASER_DAMAGED ? "Damaged" : "Operational" , ship->target3 ? ship->target3->name : "none"); if (ship->turret4) ch_printf( ch, "&zTurret Four: &w %s &zCurrent Target:&w %s\n\r", ship->statet4 == LASER_DAMAGED ? "Damaged" : "Operational" , ship->target4 ? ship->target4->name : "none"); if (ship->turret5) ch_printf( ch, "&zTurret Five: &w %s &zCurrent Target:&w %s\n\r", ship->statet5 == LASER_DAMAGED ? "Damaged" : "Operational" , ship->target5 ? ship->target5->name : "none"); if (ship->turret6) ch_printf( ch, "&zTurret Six: &w %s &zCurrent Target:&w %s\n\r", ship->statet6 == LASER_DAMAGED ? "Damaged" : "Operational" , ship->target6 ? ship->target6->name : "none"); if (ship->turret7) ch_printf( ch, "&zTurret Seven:&w %s &zCurrent Target:&w %s\n\r", ship->statet7 == LASER_DAMAGED ? "Damaged" : "Operational" , ship->target7 ? ship->target7->name : "none"); if (ship->turret8) ch_printf( ch, "&zTurret Eight:&w %s &zCurrent Target:&w %s\n\r", ship->statet8 == LASER_DAMAGED ? "Damaged" : "Operational" , ship->target8 ? ship->target8->name : "none"); if (ship->turret9) ch_printf( ch, "&zTurret Nine: &w %s &zCurrent Target:&w %s\n\r", ship->statet9 == LASER_DAMAGED ? "Damaged" : "Operational" , ship->target9 ? ship->target9->name : "none"); if (ship->turret10) ch_printf( ch, "&zTurret Ten: &w %s &zCurrent Target:&w %s\n\r", ship->statet10 == LASER_DAMAGED ? "Damaged" : "Operational" , ship->target10 ? ship->target10->name : "none"); ch_printf(ch, "\n\r&w | &zMissile launcher:&w %-15s &zPayload: &w%d&W/%d\n\r", !ship->maxmissiles ? "&RNot installed" : ship->missilestate == LASER_DAMAGED ? "&ROffline" : "&GOnline", ship->missiles, ship->maxmissiles); ch_printf(ch, " %-10s&w | &zTorpedo launcher:&w %-15s &zPayload: &w%d&W/%d\n\r", ship->warheadLinked == TRUE ? "&GLinked" : "&RUnlinked", !ship->maxtorpedos ? "&RNot installed" : ship->torpedostate == LASER_DAMAGED ? "&ROffline" : "&GOnline", ship->torpedos, ship->maxtorpedos); ch_printf(ch, " &w| &zRocket launcher: &w %-15s &zPayload: &w%d&W/%d\n\r", !ship->maxrockets ? "&RNot installed" : ship->rocketstate == LASER_DAMAGED ? "&ROffline" : "&GOnline", ship->rockets, ship->maxrockets); if(ship->maxbombs > 0) ch_printf(ch, "&zBomb Payload: &w%d&W/%d\n\r", ship->bombs, ship->maxbombs); } void do_transmit_broadcast( CHAR_DATA *ch, char *argument) /* Coded by Trillen and Tawnos of SW:FotE for slave circuit modules */ /* Allows player to send a message over his ship, in a one-way shiptalk */ { SHIP_DATA *ship; int newloc; ROOM_INDEX_DATA *original; CHAR_DATA *wch; char arg1[MAX_STRING_LENGTH]; bool ch_comlink; OBJ_DATA *obj; argument = one_argument(argument, arg1); if ( !arg1 || arg1[0] == '\0') { send_to_char( "Usage: transmit_broadcast \n\r", ch ); return; } if ( !argument || argument[0] == '\0') { send_to_char( "Usage: transmit_broadcast \n\r", ch ); return; } for(ship=first_ship; ship; ship=ship->next) if(!str_prefix(arg1, ship->name)) break; if (!ship) { send_to_char( "Error: That ship does not exist.\n\r", ch ); return; } if (ship->slave < 4) { send_to_char( "Error: That ship does not have a class 4 slave circuit.\n\r", ch); return; } if ( !check_pilot( ch , ship ) ) { send_to_char("&RHey, thats not your ship!\n\r",ch); return; } if (IS_IMMORTAL(ch) ) { ch_comlink = TRUE; } if (!IS_IMMORTAL(ch) ) { ch_comlink = FALSE; for ( obj = ch->last_carrying; obj; obj = obj->prev_content ) { if (obj->pIndexData->item_type == ITEM_COMLINK) ch_comlink = TRUE; } } if (IS_IMMORTAL(ch) ) { ch_comlink = TRUE; } if ( !ch_comlink ) { send_to_char( "You need a comlink to do that.\n\r", ch); return; } if (!IS_NPC(ch) && IS_SET(ch->pcdata->act2, ACT_GAGGED)) { send_to_char( "You can't send a message when you're gagged!\n\r", ch); return; } if (!IS_NPC(ch) && ( IS_SET(ch->act, PLR_SILENCE) )) { send_to_char( "You can't send a message when you're silenced!\n\r", ch ); return; } if ( IS_SET( ch->in_room->room_flags, ROOM_SILENCE ) ) { send_to_char( "Your comlink will not function here.\n\r", ch ); return; } newloc = ship->cockpit; original = ch->in_room; char_from_room( ch ); char_to_room( ch, get_room_index(newloc) ); talk_channel( ch, argument, CHANNEL_SHIP, "shiptalk" ); for ( wch = first_char; wch; wch = wch->next ) { if ( wch == ch ) { char_from_room( ch ); char_to_room( ch, original ); break; } } return; }