Re: Spells affecting mobs or objects...

From: Chris Proctor (cjp@YOYO.CC.MONASH.EDU.AU)
Date: 07/16/97


>         I'm somewhat confused as to how to make a manual spell affect
> either an object OR a character/mob.  I mean, in the actual code for the
> spell, is there any convenient way to check and see if the argument
> passed is an object or a spell?
>         I don't want you folks to think I'm slacking, I looked around for
> such a device already in the code, but I just couldn't find one.  Did I
> just miss something, or is this trickier than I anticipate?

Ok, the other two replies suggested:
A: Copy the bless code.
This won't work if you want a manual spell. Cos bless isn't one :P
B: use generic_find.
This won't work because you no longer have the original argument to
do_cast (unless you want to write code to save it, as I have, but that's a
different story).

The answer's easier yet. In the declaration of ASPELL there are two
variables of note: victim and obj.

Just do a:

if (victim != NULL) {
  do_stuff_to_character_victim;
  return;
}
else if (obj != NULL) {
  do_stuff_to_object_victim;
  return;
}
else {
  send_to_char("Eh?\r\n", ch);
  return;
}

The cast code already automatically locates the character/object
(searching through lists in the appropriate places).

Now you just go into spell_parser.c and do a spello entry, and use:
TAR_CHAR_ROOM | TAR_OBJ_ROOM
or TAR_CHAR_WORLD | TAR_OBJ_WORLD
for the target and voila!

or whatever (yes, you can just about copy the bless entry for the spello
stuff).
don't forget the heaps of entries in various files that you need for
manual spells.

Chris.

               /|
  _           />>
  \\         / \
   |\_______|/\/-------------------------------------------------------,
  [*********<()>--- - ---=== Chris Proctor, a.k.a Deathblade ===---   -->
   |/~~~~~~~|\/\-------------------------------------------------------`
  //         \ /        cjp@yoyo.cc.monash.edu.au
  ~           \>>       cjpro1@bedrock.eng.monash.edu.au
               \|       cjp@red.icplus.net.au
                        cjpro1@student.monash.edu.au

        Dominia Mud: snafu.net.au 3333

        My homepage: http://yoyo.cc.monash.edu.au/~cjp


     +------------------------------------------------------------+
     | 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