/* This is a sample spec_proc for mobs */
int sample_proc1(struct char_data *ch,struct char_data *pl,char *arg,int cmd)
/* ch = the mob whose proc this is
pl = the person whose command is being processed (NULL for mob "ticks")
arg = argument to the command
cmd = command number (see commands.doc for a listing) */
{
struct char_data *victim;
/* if(cmd==-1) { ** only for ACT_SPEC_DIE mobs **
** handle death stuff **
} else... */
if(pl) { /* We were called because a command was given */
/* If the mob is not in "position" to react, then don't allow it */
if(GET_POS(ch)<=POSITION_SLEEPING || GET_POS(ch)==POSITION_FIGHTING)
return FALSE;
switch(cmd) {
case **smile**: /* Command numbers to catch */
do_say(ch,"No smiling!",0);
break;
case **poke**:
/* Who is the player doing something to? */
/* (as in "poke <x> or kill <y> - as only argument) */
victim=get_char_vis(pl,argument); /* need to double-check this..*/
if(victim==ch) { /* Is it me? */
/* do something */
act("$N squirms away from your poke.",FALSE,pl,0,ch,TO_CHAR);
act("$N squirms away from $n's poke.",TRUE,pl,0,ch,TO_ROOM);
return TRUE; /* Since we took care of the command. */
}
break;
default:
break;
}
} else { /* Called on the mob tick */
switch(number(0,10)) { /* Do something randomly */
case 0:
do_action(ch,"",**burp**); /* Make 'em burp */
break;
default:
break;
}
}
return(FALSE);
}
/* obj proc, for a cake that must be sliced to be eaten */
int sample_proc2(struct obj_data *obj,struct char_data *ch,char *arg,int cmd)
{
struct obj_data *target;
char name[MAX_INPUT_LENGTH];
if(ch) {
if(!CAN_SEE_OBJ(ch,obj))
return(FALSE);
one_argument(arg,name); /*???*/
target=get_obj_vis(ch,name);
if(target!=obj)
return(FALSE);
switch(cmd) {
case **eat**:
act("$n tries to fit $p in $s mouth, but fails!",TRUE,ch,obj,0,TO_ROOM);
act("You can't fit it in your mouth!",FALSE,ch,0,0,TO_CHAR);
return(TRUE);
break;
case **slice**:
for(i=0;i<5;i++) {
temp=read_object(*piece of cake*,VIRTUAL);
if(in room)
obj_to_room(temp,ch->in_room);
else
obj_to_inv(temp,ch??);
}
extract_obj(obj); /* Get rid of the original unsliced cake */
break;
default:
break;
}
} else {
if(..in inventory..&& hungry...&& !number(0,6)) {
act("$p calls out to your famished stomach, 'Eat me! Eat me!'",
FALSE,...,obj,0,TO_CHAR);
}
}
return(FALSE);
}
/* A room proc, which teleports people to a cell at random */
int sample_proc3(int room,struct char_data *ch,char *arg,int cmd)
{
struct char_data *k;
if(!ch) {
for(k=world[room].people;k;k=k->next_in_room) {
if(!number(0,5)) {
act("There is a whirring of a machine close by.",FALSE,k,0,0,TO_ROOM);
act("You hear a whir of a machine, and a slight tug in your soul.",
FALSE,k,0,0,TO_CHAR);
teleport_to(k,real_room(**cell number**));
return(TRUE);
}
}
}
return(FALSE);
}