/********************************************************************** Adds a command for technicians to make the chip. Also includes the code for adding two slot wearlocs. Only droids can wear the chips and also includes the code on adding a silicon type for items because thats needed for making the chips. -Riketsu **********************************************************************/ ------------------------------------------------------------------ TECH.C ------------------------------------------------------------------ Add this function at the bottom of the file: void do_makechip( CHAR_DATA *ch, char *argument ) { char arg[MAX_INPUT_LENGTH]; char name[MAX_STRING_LENGTH]; int level, chance; bool checkbat, checksuper, checkcircuit, checktool, checksilicon; AFFECT_DATA *paf; OBJ_DATA *obj; OBJ_INDEX_DATA *pObjIndex; argument = one_argument( argument, arg ); switch( ch->substate ) { default: if(str_cmp(arg, "speed") && str_cmp(arg, "strength") && str_cmp(arg, "intelligence") && str_cmp(arg, "accuracy") && str_cmp(arg, "power")) { send_to_char("\n\rChips may affect the following aspects of the Droid:\n\rSpeed, Strength, Intelligence, Accuracy, Power\n\r", ch); return; } checkbat = FALSE; checksuper = FALSE; checkcircuit = FALSE; checktool = FALSE; checksilicon = FALSE; if ( !IS_SET( ch->in_room->room_flags, ROOM_FACTORY ) ) { send_to_char( "&RYou need to be in a factory or workshop to do that.\n\r", ch); return; } for ( obj = ch->last_carrying; obj; obj = obj->prev_content ) { if (obj->item_type == ITEM_BATTERY) checkbat = TRUE; if (obj->item_type == ITEM_SUPERCONDUCTOR) checksuper = TRUE; if (obj->item_type == ITEM_CIRCUIT) checkcircuit = TRUE; if (obj->item_type == ITEM_TOOLKIT) checktool = TRUE; if (obj->item_type == ITEM_SILICON) checksilicon = TRUE; } if ( !checkbat ) { send_to_char( "&RYou need a battery to power the chip.\n\r", ch); return; } if ( !checksuper ) { send_to_char( "&RYou need a superconductor to focus the energy.\n\r", ch); return; } if ( !checkcircuit ) { send_to_char( "&RYou need a circuit board to control the chip.\n\r", ch); return; } if ( !checktool ) { send_to_char( "&RYou need a toolkit to build the chip.\n\r", ch); return; } if ( !checksilicon ) { send_to_char( "&RYou need a piece of silicon to make the chip\n\r", ch); return; } chance = IS_NPC(ch) ? ch->top_level : (int) (ch->pcdata->learned[gsn_makechip]); if ( number_percent( ) < chance ) { send_to_char( "&GYou begin the long process of creating a chip.\n\r", ch); act( AT_PLAIN, "$n takes $s tools and begins to work.", ch, NULL, argument , TO_ROOM ); add_timer ( ch , TIMER_DO_FUN , 10 , do_makechip , 1 ); ch->dest_buf = str_dup(arg); return; } send_to_char("&RYou can't figure out what to do.\n\r",ch); learn_from_failure( ch, gsn_makechip ); return; case 1: if ( !ch->dest_buf ) return; strcpy(arg, ch->dest_buf); DISPOSE( ch->dest_buf); break; case SUB_TIMER_DO_ABORT: DISPOSE( ch->dest_buf ); ch->substate = SUB_NONE; send_to_char("&RYou are interupted and fail to finish your work.\n\r", ch); return; } ch->substate = SUB_NONE; level = IS_NPC(ch) ? ch->top_level : (int) (ch->pcdata->learned[gsn_makechip]); if ( ( pObjIndex = get_obj_index( CHIP_VNUM ) ) == NULL ) { send_to_char( "&RThe item you are trying to create is missing from the database.\n\rPlease inform the administration of this error.\n\r", ch ); return; } checkbat = FALSE; checksuper = FALSE; checkcircuit = FALSE; checktool = FALSE; checksilicon = FALSE; for ( obj = ch->last_carrying; obj; obj = obj->prev_content ) { if (obj->item_type == ITEM_TOOLKIT) checktool = TRUE; if (obj->item_type == ITEM_SILICON && checksilicon == FALSE ) { checksilicon = TRUE; separate_obj( obj ); obj_from_char( obj ); } if (obj->item_type == ITEM_BATTERY && checkbat == FALSE) { checkbat = TRUE; separate_obj( obj ); obj_from_char( obj ); } if (obj->item_type == ITEM_SUPERCONDUCTOR && checksuper == FALSE) { checksuper = TRUE; separate_obj( obj ); obj_from_char( obj ); } if (obj->item_type == ITEM_CIRCUIT && checkcircuit == FALSE) { checkcircuit = TRUE; separate_obj( obj ); obj_from_char( obj ); } } chance = IS_NPC(ch) ? ch->top_level : (int) (ch->pcdata->learned[gsn_makechip]) ; if ( number_percent( ) > chance*2 || ( !checktool ) || ( !checkbat ) || ( !checksuper ) || ( !checkcircuit ) || (!checksilicon ) ) { send_to_char( "&RYou hold up your newly created chip.\n\r", ch); send_to_char( "&RThe chip begins to shake violently turning red hot!\n\r", ch); send_to_char( "&RYou drop it as it begins to burn your hand and then.. It disintigrates!\n\r", ch); learn_from_failure( ch, gsn_makechip ); return; } if(!str_cmp(arg, "speed")) strcpy(name, "A Speed Chip"); else if(!str_cmp(arg, "strength")) strcpy(name, "A Strength Chip"); else if(!str_cmp(arg, "intelligence")) strcpy(name, "A Intelligence Chip"); else if(!str_cmp(arg, "accuracy")) strcpy(name, "An Accuracy Chip"); else if(!str_cmp(arg, "power")) strcpy(name, "A Power Chip"); obj = create_object( pObjIndex, level ); obj->item_type = ITEM_ARMOR; SET_BIT( obj->wear_flags, ITEM_TAKE ); SET_BIT( obj->wear_flags, ITEM_WEAR_SLOT1 ); SET_BIT( obj->wear_flags, ITEM_WEAR_SLOT2 ); obj->level = level; STRFREE( obj->name ); obj->name = STRALLOC( name ); STRFREE( obj->short_descr ); obj->short_descr = STRALLOC( name ); STRFREE( obj->description ); strcat( name, " was dropped here." ); obj->description = STRALLOC( name ); CREATE( paf, AFFECT_DATA, 1 ); paf->type = -1; paf->duration = -1; if(!str_cmp(arg, "speed")) paf->location = get_atype("dexterity"); else if(!str_cmp(arg, "strength")) paf->location = get_atype("strength"); else if(!str_cmp(arg, "intelligence")) paf->location = get_atype("intelligence"); else if(!str_cmp(arg, "accuracy")) paf->location = get_atype("hitroll"); else if(!str_cmp(arg, "power")) paf->location = get_atype("damroll"); paf->modifier = 1; paf->bitvector = 0; paf->next = NULL; LINK( paf, obj->first_affect, obj->last_affect, next, prev ); ++top_affect; obj->value[0] = 0; obj->value[1] = 0; obj->value[2] = 0; obj->cost = level; obj = obj_to_char( obj, ch ); send_to_char( "&GYou finish your work and hold up your newly created chip.&w\n\r", ch); act( AT_PLAIN, "$n finishes creating a new chip.", ch, NULL, argument , TO_ROOM ); { long xpgain; xpgain = ((ch->skill_level[TECHNICIAN_ABILITY]+1) * 200); gain_exp(ch, xpgain, TECHNICIAN_ABILITY); ch_printf( ch , "\n\rYou gain %d technician experience.", xpgain ); } learn_from_success( ch, gsn_makechip ); } ------------------------------------------------------------------ MUD.H ------------------------------------------------------------------ Add: DECLARE_DO_FUN( do_makechip ); where it goes. ------------------------------------------------------------------ After: #define ITEM_WEAR_BACK BV19 #define ITEM_WEAR_HOLSTER1 BV20 #define ITEM_WEAR_HOLSTER2 BV21 #define ITEM_WEAR_BOTHWRISTS BV22 Add: #define ITEM_WEAR_SLOT1 BV23 #define ITEM_WEAR_SLOT2 BV24 ------------------------------------------------------------------ After: WEAR_BOTH_WRISTS, Add: WEAR_SLOT1, WEAR_SLOT2, ------------------------------------------------------------------ After: #define SABER_VNUM 72 Add: #define CHIP_VNUM 98 ------------------------------------------------------------------ After: /* Technician skills */ Add: extern sh_int gsn_makechip; ------------------------------------------------------------------ After: ITEM_SHIPBOMB, Add: ITEM_SILICON, ------------------------------------------------------------------ DB.C ------------------------------------------------------------------ After: /* Technicians */ Add: sh_int gsn_makechip; ------------------------------------------------------------------ After: ASSIGN_GSN( gsn_truesight, "true sight"); Add: ASSIGN_GSN( gsn_makechip , "makechip" ); ------------------------------------------------------------------ After: case ITEM_BUTTON: Add: case ITEM_SILICON: ------------------------------------------------------------------ BUILD.C ------------------------------------------------------------------ Inside: char * const w_flags [] = After: "holster1","holster2","bothwrists", Add: "slot1", "slot2", ------------------------------------------------------------------ Inside: char * const wear_locs [] = After: "missile_wield", Add: "slot1", "slot2", ------------------------------------------------------------------ Inside: char * const o_types [] = After: "shipbomb", Add: "silicon", ------------------------------------------------------------------ ACT_INFO.C ------------------------------------------------------------------ Inside: char * const where_name [] = After: "&G&b[&wworn both wrists &b]&G&w ", Add: "&G&b[&wfitted into slot1&b]&G&w ", "&G&b[&wfitted into slot2&b]&G&w ", ------------------------------------------------------------------ ACT_OBJ.C ------------------------------------------------------------------ Inside: void wear_obj( CHAR_DATA *ch, OBJ_DATA *obj, bool fReplace, sh_int wear_bit ) After: One of the cases. Add: case ITEM_WEAR_SLOT1: if ( !IS_DROID(ch) ) { send_to_char( "You are not a Droid.\n\r", ch ); return; } if ( !remove_obj( ch, WEAR_SLOT1, fReplace ) ) return; if ( !oprog_use_trigger( ch, obj, NULL, NULL, NULL ) ) { if ( !obj->action_desc || obj->action_desc[0]=='\0' ) { act( AT_ACTION, "$n fits $p into $s computer.", ch, obj, NULL, TO_ROOM ); act( AT_ACTION, "You fit $p into your head.", ch, obj, NULL, TO_CHAR ); } else actiondesc( ch, obj, NULL ); } equip_char( ch, obj, WEAR_SLOT1 ); oprog_wear_trigger( ch, obj ); return; case ITEM_WEAR_SLOT2: if ( !IS_DROID(ch) ) { send_to_char( "You are not a Droid.\n\r", ch ); return; } if ( !remove_obj( ch, WEAR_SLOT2, fReplace ) ) return; if ( !oprog_use_trigger( ch, obj, NULL, NULL, NULL ) ) { if ( !obj->action_desc || obj->action_desc[0]=='\0' ) { act( AT_ACTION, "$n fits $p into $s computer.", ch, obj, NULL, TO_ROOM ); act( AT_ACTION, "You fit $p into your head.", ch, obj, NULL, TO_CHAR ); } else actiondesc( ch, obj, NULL ); } equip_char( ch, obj, WEAR_SLOT2 ); oprog_wear_trigger( ch, obj ); return; ------------------------------------------------------------------ TABLES.C ------------------------------------------------------------------ Add do_makechip where it belongs. ------------------------------------------------------------------ /system/SKILLS.DAT ------------------------------------------------------------------ After: makebug Add: #SKILL Name makechip~ Type Skill Flags 0 Guild 9 Code do_makechip Dammsg ~ Teachers 1052 1097~ Minlevel 30 End ------------------------------------------------------------------ INSIDE THE MUD ------------------------------------------------------------------ Create the Chip item, vnum 98. If you already have an item with this number be sure to change it in MUD.h Create the Silicon Item, as it will be needed for the creation of the items. ------------------------------------------------------------------ Make Clean, Make And your done.