Date sent: Wed, 16 Jul 1997 18:44:22 -0200 To: "Liner/Nosferatu" From: Rick Rogers (by way of Rick Rogers ) Subject: RCL 7: Object Spec Example I've had a request for an obj spec example. Well here it is. This is a spec on some body armor. During combat, it might spec and give you some damage. Such a spec would be used to offset a piece of gear with high stats. Rick (Ranger) #define ARMOR 999 int armor(OBJ *armor, CHAR *ch, int cmd, char *arg) { CHAR *vict; char buf[MAX_STRING_LENGTH]; if(!armor->equipped_by) return FALSE; /* Make sure the gear is equipped */ vict=armor->equipped_by; /* Define the victim as the wearer */ /* We'll also throw in some damage if the player tries to remove the armor */ if (cmd==CMD_REMOVE && !number(0,2) ) { /* 33% chance the remove will hurt */ if(!ch) return FALSE; if(ch!=vict) return FALSE; one_argument(arg, buf); if(!*buf) return FALSE; /* Player only typed remove */ if(!isname(buf,OBJ_NAME(armor))) return FALSE; /* Make sure its the armor being removed */ act("Your chest is squeezed as the armor contracts around you!",1, ch, 0, 0, TO_CHAR); act("$n finds it hard to breath as $s armor contracts around $m!",1, ch, 0, 0, TO_ROOM); damage(ch, ch, 100, TYPE_UNDEFINED); /* Ouch */ return TRUE; } /* Here's the damage during combat */ if (!vict->specials.fighting) return FALSE; /* Make sure player is fighting */ if (cmd != MSG_MOBACT) return FALSE; /* Check spec every MOBACT */ if(!number(0,99)) return FALSE; /* 1% chance of spec */ /* All checks done, do the damage */ act("Your chest is squeezed as the armor contracts around you!",1, vict, 0, 0, TO_CHAR); act("$n finds it hard to breath as $s armor contracts around $m!",1, vict, 0, 0, TO_ROOM); damage(vict, vict, 100, TYPE_UNDEFINED); return FALSE; }