From: Alvoria MUD Subject: Emblamer (Complainer) Add the functions together in spec_procs.c (the get_people_room and the select_person_room are both kindof useful... you may want to add them to utils.c instead and add a prototype in utils.h so you can use them anywhere for whatever purpose). Er... please note that this was made while still in my mailer. Don't forget to assign this to a mob in spec_assign.c Er... after having typed it... I guess he's not much of a blamer compared to a complainer. Oh well... I guess I will change the name of the proc :P. - mendar /* start of the proc stuff... */ /* start of the proc stuff... */ int get_people_room(const int room) { struct char_data *person; int i=0; for(person=world[room].people ; person; person=person->next_in_room) { if(person) i++; } return i; } struct char_data *select_person_room(const int room, const int whom) { struct char_data *person; int i; i=get_people_room(room); if(i==NULL) return NULL; if(whom>i) return NULL; if(whom==1) { return (world[room].people); } i=whom; i--; for(person=world[room].people; i; person=person->next_in_room) { i--; } return person; } SPECIAL(complainer) { ACMD(do_sleep); ACMD(do_say); ACMD(do_flee); ACMD(do_wake); struct char_data *vict1,*self; self=(struct char_data *)me; if((!AWAKE(self))&&(!IS_AFFECTED(self, AFF_SLEEP))) { if(cmd) { if(number(0,1)) { act("$n awakens.", TRUE, self, 0, 0, TO_ROOM); GET_POS(self) = POS_STANDING; } return (0); } else { if(number(1,5)==5) { act("$n awakens.", TRUE, self, 0, 0, TO_ROOM); GET_POS(self) = POS_STANDING; } return (1); } } if(CMD_IS("flee")&&CAN_SEE(self,ch)) { switch(number(1,6)) { case 1: act("$n tells you 'Run! Run! Flee while you can!'", FALSE, self, 0, ch, TO_VICT); break; case 2: act("$n tells you 'You wimp.'", FALSE, self, 0, ch, TO_VICT); break; case 3: act("$n tells you 'You wuss! haha...'", FALSE, self, 0, ch, TO_VICT); break; default: break; } do_flee(ch,argument,cmd,0); switch(number(1,6)) { case 1: act("$n says 'I bet $N just peed $S pants.'", FALSE, self, 0, ch, TO_ROOM); break; case 2: act("$n says 'I heard $N runs from $S own shadow too.'", FALSE, self, 0, ch, TO_ROOM); break; case 3: act("$n says 'I bet $N's afraid of the dark too.'", FALSE, self, 0, ch, TO_ROOM); break; default: break; } return (1); } if(CMD_IS("sleep")&&CAN_SEE(self,ch)) { do_sleep(ch,argument,cmd,0); switch(number(1,6)) { case 1: do_say(self, "Ok everyone... Shhhhhh.", 0, 0); break; case 2: do_say(self, "That's a good idea... I'm going to sleep too.", 0, 0) ; do_sleep(self,0,0,0); break; case 3: do_say(self, "Heh. What a sleepyhead.", 0, 0); break; default: break; } return (1); } if(cmd) return (0); if(FIGHTING(self)) { switch(number(1,10)) { case 1: do_say(self,"I think I'm losing...",0,0); break; case 2: do_say(self,"The world won't miss a loudmouth like me. Hah.",0,0); break; case 3: if(GET_HIT(self)<(GET_MAX_HIT(self)/3)) { do_say(self,"I'll live...",0,0); do_say(self,"My cuts are only flesh wounds.",0,0); } break; default: break; } return (1); } if(get_people_room(self->in_room)<=1) return (0); vict1=select_person_room(self->in_room, number(1,get_people_room(self->in_room))); if(vict1==self) return (0); if(!CAN_SEE(self,vict1)) return (0); if(FIGHTING(vict1)) { if((number(0,1))&& (CAN_SEE(self,vict1))&& (FIGHTING(vict1)!=self)) { vict1=FIGHTING(vict1); /* swap the person we're talking about */ /* makes it more interesting. */ } switch(number(1,20)) { case 1: act("$n says '$N started it!'", FALSE, self, 0, vict1, TO_NOTVICT); act("$n says 'I KNOW you started it!'", FALSE, self, 0, vict1, TO_VICT); break; case 2: act("$n says '$N's fighting technique is so lame...'", FALSE, self, 0, vict1, TO_NOTVICT); act("$n says 'Your fighting technique is so lame...'", FALSE, self, 0, vict1, TO_VICT); break; case 3: act("$n says 'Hehe. I think $N is going to die.'", FALSE, self, 0, vict1,TO_NOTVICT); break; case 4: act("$n says 'Hehe. I hope $N loses. $E's such a jerk.'", FALSE, self, 0, vict1, TO_NOTVICT); default: break; } return (1); } /* just a summary of how we can get to this point :P. (for those who might be lost already) */ /* execution gets here only if the mob assigned with this is not sleeping, not fighting, if a person hasn't fled or gone to sleep, or the person we've chosen isn't fighting and awake. */ switch(number(1,40)) { case 1: do_say(self,"I talk too much!",0,0); break; case 2: do_say(self,"I think I'm brainless.",0,0); break; case 3: do_say(self,"I think YOU'RE brainless.",0,0); break; case 4: do_say(self,"People are stupid.",0,0); break; case 5: do_say(self,"Who's to blame?",0,0); break; case 6: if(IS_NPC(vict1) && MEMORY(vict1)) act("$n says 'I think $N is after someone.'", FALSE, self, 0, vict1, TO_NOTVICT); break; case 7: act("$n says 'I think $N sleeps too much.'", FALSE, self, 0, vict1, TO_NOTVICT); break; case 8: act("$n says 'Run everyone!!! $N is going to kill you!'", FALSE, self, 0, vict1, TO_NOTVICT); break; case 9: act("$n says 'I saw $N eat the crumbs on the floor of the" " bakery.'", FALSE, self, 0, vict1, TO_NOTVICT); act("$n says 'Bleeech.'", FALSE, self, 0, vict1, TO_ROOM); break; case 10: act("$n says 'I think $N did it. I'm sure...'", FALSE, self, 0, vict1, TO_NOTVICT); break; default: break; } return (1); }