> > > How would I go about creating mobs that will attack other mobs? I have
> > > attempted a spec_proc, but those are only called when a player does
> > > something with that player,mob,room, or object in use.
> >
> > I'd make a flag called MOB_AGGR_MOB, and in mobile_activity() (in mobact.c)
> > have it check for the flag and if it exists, look for an NPC victim to
> > attack. Do it just like the normal MOB_AGGRESSIVE, but check for NPC targets.
Sorry, I was reading this and got to thinking about the flag META_AGG that
is a part of Decadence (a derivitive of sillymud..), which is sort of what
you are talking about.., since players can morph into creatures, which are
considered NPCs. I think, anyway. I haven't looked at that part of the
code. Anyhow, I decided that a MOB_NPC_AGGR is a good flag to put in. So
I spent 5 minutes and did it. I just can't test it yet, so the following
code is MAILER CODE. Pardon any bugs, problems that may occur. The
compiler on my system is down due to a hacker or something.., so until
then:
In structs.h, under all the other MOB_ flags...
#define MOB_NPC_AGGR (1 << 18) (18 is next number on my rotation,
whichever is next on yours)
In constants.c, under the list of MOB_ flags and how they will appear when
you stat a mob, add
"AGGR_NPC",
between the last item and the "\n"
In mobact.c, where it has the comment /* Aggressive mobs */, switch the
aggr code with this:
if (MOB_FLAGGED(ch, MOB_AGGRESSIVE | MOB_AGGR_TO_ALIGN | MOB_NPC_AGGR)) {
found = FALSE;
for (vict = world[ch->in_room].people; vict && !found; vict = vict->next_in_room) {
if (IS_NPC(vict) || !CAN_SEE(ch, vict) || PRF_FLAGGED(vict, PRF_NOHASSLE))
continue;
if (MOB_FLAGGED(ch, MOB_WIMPY) && AWAKE(vict))
continue;
if (!IS_NPC(vict))
if (!MOB_FLAGGED(ch, MOB_AGGR_TO_ALIGN) ||
(MOB_FLAGGED(ch, MOB_AGGR_EVIL) && IS_EVIL(vict)) ||
(MOB_FLAGGED(ch, MOB_AGGR_NEUTRAL) && IS_NEUTRAL(vict)) ||
(MOB_FLAGGED(ch, MOB_AGGR_GOOD) && IS_GOOD(vict))) {
hit(ch, vict, TYPE_UNDEFINED);
found = TRUE;
}
else
if (MOB_FLAGGED(ch, MOB_NPC_AGGR)) {
hit(ch, vict, TYPE_UNDEFINED);
found = TRUE;
}
}
}
Again, this is mailer code. If you see any bugs in it tell me, via
private or list mail, I don't care ;) As long as it don't bug everyone
else.
- The coder who is seldom motivated, but when is does quick work
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST