no subject (file transmission)

From: Kresimir Kukulj (madmax@fly.cc.fer.hr)
Date: 03/18/96


Someone has mailed that he lost my little modified hunt_victim function.
Or better say I think that you reffered to me.

Well here is it.

void hunt_victim(struct char_data * ch)
{
  ACMD(do_say);
  extern struct char_data *character_list;

  int dir;
  byte found;
  struct char_data *tmp;
  char buffff[160];

  if (!ch || !HUNTING(ch))
    return;
  if (GET_POS(ch) <= POS_FIGHTING)
    return;

  /* make sure the char still exists */
  for (found = 0, tmp = character_list; tmp && !found; tmp = tmp->next)
    if (HUNTING(ch) == tmp)
      found = 1;

  if (!found) {
    do_say(ch, "Damn!  My prey is gone!!", 0, 0);
    HUNTING(ch) = 0;
    return;
  }
  dir = find_first_step(ch->in_room, HUNTING(ch)->in_room);
  if (dir < 0) {
    if (dir == BFS_ALREADY_THERE) 
      if ((ch->in_room == HUNTING(ch)->in_room)) {
        if (!ROOM_FLAGGED(ch->in_room, ROOM_PEACEFUL)) {
          hit(ch, HUNTING(ch), TYPE_UNDEFINED);
          do_say(ch, "You son of a bitch! I found you at last! Die!!", 0, 0);
          return;
        } else 
            return;
      }

    buffff[0] = '\0'; 
    sprintf(buffff, "Damn!  Lost %s!", HMHR(HUNTING(ch)));
    do_say(ch, buffff, 0, 0);
    HUNTING(ch) = 0;
    return;
  } else {
   if (ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_NOMOB))
     return;

    perform_move(ch, dir, 1);
    if ((ch->in_room == HUNTING(ch)->in_room) && 
       (!ROOM_FLAGGED(ch->in_room, ROOM_PEACEFUL))) {
      hit(ch, HUNTING(ch), TYPE_UNDEFINED);
      do_say(ch, "You son of a bitch! I found you at last! Die!!", 0, 0);
      }
    return;
  }
}

It containes some more checking, and variable buffff ( first name I could
think off ) that is used to replace global buf variable. Reason: buf is used
in do_say so that way, if you send buf in do_say , it uses the same memory
space for her stuff and you get following :
The cityguard say' the cityguard say' the cityguard say'

It just repeates it self.
------------------------------
To use it you could do just add in mobact.c

/* Hunter mob */
   if(MOB_FLAGGED(ch, MOB_HUNTER))
     if (HUNTING(ch))
       hunt_victim(ch);

Make shure that in fight when mob is attacked by player it sets 
     HUNTING(mob) = attacker; 

This way mob knows who to find and learn him thing or two :)

I lost my original post so I'm sendind this ( I hope I haven't forget
something - I'm pulling it from my code )

Hope this helps.

P.S. for some gramatical errors I'm not responsible. ;-)

Kresimir

*----------------------------------------*
|  E-Mail address : madmax@fly.cc.fer.hr |
*----------------------------------------*
.... Kad si sretan lupi sysopom o pod...tup...tup...



This archive was generated by hypermail 2b30 : 12/07/00 PST