Posted Wednesday, August 12th @ 11:31:40 PM, by George Greer in the Mobiles dept.
Added Mar 5, 1997. Click the link below to read it or download it.
From: PD <Address not listed>
Subject: Mob Stacking
This is code to stack mobs, so instead of:
a cityguard stands here.
a cityguard stands here.
a cityguard stands here.
a cityguard stands here.
a cityguard stands here.
you get:
a cityguard stands here.[4]
Just like item stacks.
Here's what you do:
act.informative.c
change the name of list_one_char to "list_all_char", and add an integer
argument num:
void list_one_char(struct char_data * i, struct char_data * ch)
to
void list_all_char(struct char_data * i, struct char_data * ch, int num)
look for...
else if (IS_GOOD(i))
strcat(buf, "(Blue Aura) ");
}
strcat(buf, i->player.long_descr);
/* insert here */
if (num > 1)
{
while ((buf[strlen(buf)-1]=='\r') ||
(buf[strlen(buf)-1]=='\n') ||
(buf[strlen(buf)-1]==' ')) {
buf[strlen(buf)-1] = '\0';
}
sprintf(buf2," [%d]\n\r", num);
strcat(buf, buf2);
}
/*end insert*/
then replace the function list_char_to_char(), with the below:
void list_char_to_char(struct char_data *list, struct char_data *ch)
{
struct char_data *i, *plr_list[100];
int num, counter, locate_list[100], found=FALSE;
num = 0;
for (i=list; i; i = i->next_in_room) {
if(i != ch) {
if (CAN_SEE(ch, i))
{
if (num< 100)
{
found = FALSE;
for (counter=0;(counter<num&& !found);counter++)
{
if (i->nr == plr_list[counter]->nr &&
/* for odd reasons, you may want to seperate same nr mobs by factors
other than position, the aff flags, and the fighters. (perhaps you want
to list switched chars differently.. or polymorphed chars?) */
(GET_POS(i) == GET_POS(plr_list[counter])) &&
(AFF_FLAGS(i)==AFF_FLAGS(plr_list[counter])) &&
(FIGHTING(i) == FIGHTING(plr_list[counter])) &&
!strcmp(GET_NAME(i), GET_NAME(plr_list[counter])))
{
locate_list[counter] += 1;
found=TRUE;
}
}
if (!found) {
plr_list[num] = i;
locate_list[num] = 1;
num++;
}
} else {
list_all_char(i,ch,0);
}
}
}
}
if (num) {
for (counter=0; counter<num; counter++) {
if (locate_list[counter] > 1) {
list_all_char(plr_list[counter],ch,locate_list[counter]);
} else {
list_all_char(plr_list[counter],ch,0);
}
}
}
}
<< Mob Memory Commands [by Demetrius Harris] | Reply | View as text | Flattened | Monkeys. Exploding Monkeys! [by Jason Buckler] >> |
|
Related Links |
|
|
|
CircleMUD Snippets |
|
|
Note: Not all of these snippets will work perfectly with
your version of code, so be prepared to fix one
or two bugs that may arise, and please let me know
what you needed to do to fix it. Sending a corrected
version is always welcome.
|
Finally, if you wish to use any of the snippets from this
page, you are more than welcome, just mention the
authors in your credits. If you wish to release any
of these snippets to the public on another site,
contact me FIRST.
|
|
|
|
|
|
|