Locate Target Spell [by David Klasinc]
Snippet Posted Wednesday, August 12th @ 11:30:31 PM, by George Greer in the Skills dept.
Added Dec 8, 1997. Click the link below to read it or download it.

From: David Klasinc <bigwhale@CAPYBARA.SK-PTTSC.LJ.EDUS.SI>
Subject: Locate target spell...

If players can locate objects, why not also locate players and mobs?

Here it is.... :) You know what to do... change spells.h with adding new
spell define, change spell_parser.c with adding another spello(), another
case to deal with manual spells and change one of the !UNUSED!... Add
this little snippet to the spells.c and that's it... Hm, no also add one
more ASPELL define in spells.h :)

ASPELL(spell_locate_target)
{
  struct char_data *i;
  char name[MAX_INPUT_LENGTH];
  int j;

  strcpy(name, fname(victim->player.name));
  j = level >> 1;

  for (i = character_list; i && (j > 0); i = i->next) {
    if (!isname(name, i->player.name))
      continue;

    if (i->in_room != NOWHERE)
        sprintf(buf, "%s is in %s.\n\r", IS_NPC(i) ? i->player.short_descr : i-
>player.name,
                world[i->in_room].name);
    else
      sprintf(buf, "%s's location is uncertain.\n\r",
              IS_NPC(i) ? i->player.short_descr : i->player.name);

    CAP(buf);
    send_to_char(buf, ch);
    j--;
  }

  if (j == level >> 1)
    send_to_char("You sense nothing.\n\r", ch);
}


<< Locate Object Spell [by Ryan Stapleton] | Reply | View as text | Threaded | Magic 8-Ball! [by Mike] >>

 


Related Links
  download
Related Articles
More by greerga
 
 

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.