Very basic shield snippet, by me for Star Wars: The Shadow Within, written upon request of a player. This should be the version I implemented, and it seems to boot up and run well on stock SWFotE so it should work with SWR1.0 and even possible SMAUG with some porting. Very basic system, (could probably be done better but this was the first code I wrote :) ) According to whether or not the shield you wear has 1 in the correct item value, damage is resisted, do_setshield simply toggles this between 1 and 0. Any probs with this please feel free to send me an e-mail at toipot2@aol.com Or drop by on the SW:TsW forums at http://fredrik.homelinux.org/toipot/html/ (follow the instructions to implement it) put this at the end of swskills.c: ---------------------------------------------------------------------- void do_setshield( CHAR_DATA *ch, char *argument ) { OBJ_DATA *shield; char arg[MAX_INPUT_LENGTH]; argument = one_argument( argument, arg ); if ( arg[0] == '\0' ) { send_to_char( "&RUsage: Setshield on/off\n\r&w", ch); return; } if ( (strcmp(arg,"on")== 0) || (strcmp(arg,"ON") == 0) ) { if ( (shield = get_eq_char( ch, WEAR_SHIELD )) == NULL ) { send_to_char("You are not wearing a shield generator!\n\r", ch); return; } if ( shield->value[2] = 1 ) { send_to_char("Your shield has no energy left!\n\r", ch); return; } else { if ( shield->value[3] == 1 ) { send_to_char("Your shield is already on!\n\r", ch); return; } else { shield->value[3]++; send_to_char("Your shield activates with a buzzing noise.\n\r", ch); return; } } } else { if ( (strcmp(arg,"off")== 0) || (strcmp(arg,"OFF") == 0) ) { if ( (shield = get_eq_char( ch, WEAR_SHIELD )) == NULL ) { send_to_char("You are not wearing a shield generator!\n\r", ch); return; } else { if ( shield->value[3] == 0 ) { send_to_char("Your shield is already off!\n\r", ch); return; } if ( shield->value[2] < 1 ) { send_to_char("Your shield has no energy left!\n\r", ch); return; } else { shield->value[3]--; send_to_char("Your shield deactivates with a dull thud and a hiss.\n\r", ch); return; } } } } } ---------------------------------------------------------------------- under do_makeshield (around line 2415) ---------------------------------------------------------------------- obj->value[0] = (int) (level/10+gemtype*10); /* condition */ obj->value[1] = (int) (level/10+gemtype*10); /* armor */ obj->value[2] = (int) (10); /* shield charge */ obj->value[3] = (int) (0); /* shield on/off */ obj->value[4] = (int) (10); /* maxshield */ obj->value[5] = (int) (level/10+gemtype*5); /* damage modifier */ ---------------------------------------------------------------------- under damage modifiers (fight.c) ---------------------------------------------------------------------- if (dam > 10 ) { if ( (shield = get_eq_char( victim, WEAR_SHIELD )) != NULL ) { if (shield->value[3] == 1) { dam -= shield->value[5]; send_to_char("&OYour shield shimmers as it absorbs damage\n\r&w", victim ); } } } ---------------------------------------------------------------------- And at the top of the damage function (still fight.c) ---------------------------------------------------------------------- change OBJ_DATA *damobj, *wield, *victwield; to OBJ_DATA *damobj, *wield, *victwield, *shield; ---------------------------------------------------------------------- in update.c under obj_update (near the top) ---------------------------------------------------------------------- if ( obj->wear_loc == WEAR_SHIELD && obj->value[2] > 0 && obj->value[3] == 1 ) { obj->value[2]--; if ( obj->value[2] == 0 ) { act( AT_PLAIN, "$p hisses and deactivates." , obj->carried_by, obj, NULL, TO_CHAR ); act( AT_PLAIN, "$n's shield generator sparks and gives out." , obj->carried_by, NULL, NULL, TO_ROOM ); obj->value[3]--; } else { act( AT_PLAIN, "$p shimmers and sparks, partially obscuring your vision." , obj->carried_by, obj, NULL, TO_CHAR ); act( AT_PLAIN, "$n's shield sparks and shimmers before them." , obj->carried_by, NULL, NULL, TO_ROOM ); } } ---------------------------------------------------------------------- tables.c: if ( skill == do_setshield ) return "do_setshield"; if ( !str_cmp( name, "do_setshield" )) return do_setshield; You'll know where these go :) ---------------------------------------------------------------------- and mud.h DECLARE_DO_FUN( do_setshield ); with the others ---------------------------------------------------------------------- player.c (near the case ITEM_ARMOR part) (833) if ( obj->value[5] >= 1 ) { ch_printf( ch, "%d/%d", obj->value[2], obj->value[4] ); } ---------------------------------------------------------------------- make clean make copyover/reboot cedit setshield create do_setshield cedit save and your done! (For those with SWFotE you may wish to change the index values for the newbies shield) Diserius Star Wars: The Shadow Within swtsw.ath.cx : 1030 swtsw.ath.cx/toipot/html