|
Mob Memory Commands [by Demetrius Harris] |
|
|
|
Posted Wednesday, August 12th @ 11:31:36 PM, by George Greer in the Mobiles dept.
. Click the link below to read it or download it.
From: Demetrius Harris <ldh1@Archive.MsState.Edu>
Subject: [Circle] Mob Memory Code [Warning: Long Text]
I believe that this file contains all the changes i made to allow memory
handling for mobs. If you get any errors as a result of my code just email
me an I will be glad to try and solve it with you.
In structs.h:
goto: struct memory_rec_struct
add: char *name;
after long id;
In interpreter.c:
goto: prototypes for all do_xx
add: ACMD(depiss);
add: ACMD(repiss);
goto: struct command_info cmd_info[] = {
add: { "depiss" , POS_DEAD, do_depiss, LVL_GOD, 0}
add: { "repiss" , POS_DEAD, do_repiss, LVL_GOD, 0}
In mobact.c:
goto: void remember(.....)
add: tmp->name = GET_NAME(victim);
after tmp->id = GET_IDNUM(victim);
goto: void forget(....)
change: while (curr && curr->id != GET_IDNUM(victim)) {
to: while ((curr && curr->id != GET_IDNUM(victim)) ||
(curr && curr->name != GET_NAME(victim))) {
In act.wizard.c:
goto: /* Showing the bitvector */
add: the following after 'send_to_char(buf, ch);' of bitvector
/* Show player on mobs piss list */
if (IS_NPC(k) && (MOB_FLAGGED(k, MOB_MEMORY))) {
sprintf(buf, "Pissed List:\r\n");
for (names = MEMORY(k); names && !found; names = names->next) {
sprintf(buf2, " %s\r\n", names->name);
strcat(buf, buf2);
}
send_to_char(strcat(buf, "\r\n"), ch);
}
add: the following code:
ACMD(do_depiss)
{
void forget(struct char_data * ch, struct char_data * victim);
char buf3[80];
struct char_data *vic = 0;
struct char_data *mob = 0;
two_arguments(argument, buf1, buf2);
if (!*buf1 || !*buf2) {
send_to_char("Usage: depiss <player> <mobile>\r\n", ch);
return;
}
if (((vic = get_char_vis(ch, buf1))) && (!IS_NPC(vic))) {
if (((mob = get_char_vis(ch, buf2))) && (IS_NPC(mob))) {
if (MOB_FLAGGED(mob, MOB_MEMORY))
forget(mob, vic);
else {
send_to_char("Mobile does not have the memory flag set!\r\n", ch);
return;
}
}
else {
send_to_char("Sorry, Player Not Found!\r\n", ch);
return;
}
}
else {
send_to_char("Sorry, Mobile Not Found!\r\n", ch);
return;
}
sprintf(buf3, "%s has been removed from %s pissed list.\r\n",
GET_NAME(vic), GET_NAME(mob));
send_to_char(buf3, ch);
}
ACMD(do_repiss)
{
void remember(struct char_data * ch, struct char_data * victim);
char buf3[80];
struct char_data *vic = 0;
struct char_data *mob = 0;
two_arguments(argument, buf1, buf2);
if (!*buf1 || !*buf2) {
send_to_char("Usage: repiss <player> <mobile>\r\n", ch);
return;
}
if (((vic = get_char_vis(ch, buf1))) && (!IS_NPC(vic))) {
if (((mob = get_char_vis(ch, buf2))) && (IS_NPC(mob))) {
if (MOB_FLAGGED(mob, MOB_MEMORY))
remember(mob, vic);
else {
send_to_char("Mobile does not have the memory flag set!\r\n", ch);
return;
}
}
else {
send_to_char("Sorry, Player Not Found!\r\n", ch);
return;
}
}
else {
send_to_char("Sorry, Mobile Not Found!\r\n", ch);
return;
}
sprintf(buf3, "%s has been added to %s pissed list.\r\n",
GET_NAME(vic), GET_NAME(mob));
send_to_char(buf3, ch);
}
If you don't mind give some credit to Shame the Imp of SliceMUD
<< Mob Flag "Smart" Mobs [by Lars Juul] | Reply | View as text | Flattened | Mob Stacking [by PD] >> |
|
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.
|
|
|
|
|
|
|