Re: [Newbie] Autoassist

From: Ron Hensley (ron@CROSS.DMV.COM)
Date: 03/20/98


On Fri, 20 Mar 1998, =?iso-8859-1?Q?Andreas_J=F6nsson?= wrote:

> I am a pretty newbie coder and I want help with adding autoassist,
> I have added the Pfr things and you can switch from autoassist on and off,
> but the actual code in fight.c I cannot write, anyone wants to help me with
> this.

fight.c
  void perform_violence(void) {
at the top add:
  struct follow_type *k;


Somewhere down around:
   if (GET_POS(ch) < POS_FIGHTING) {
      send_to_char("You can't fight while sitting!!\r\n", ch);
      continue;
    }

    if (MOB_FLAGGED(ch, MOB_SPEC) && mob_index[GET_MOB_RNUM(ch)].func !=  NULL)
      (mob_index[GET_MOB_RNUM(ch)].func) (ch, ch, 0, "");
    if (FIGHTING(ch) == NULL || ch->in_room != FIGHTING(ch)->in_room) {
      stop_fighting(ch);
      continue;
    }

Add:
   for (k = ch->followers; k; k=k->next)
     if (PRF_FLAGGED(k->follower, PRF_AUTOASSIST) &&
         (k->follower->in_room == ch->in_room) &&
          !FIGHTING(k->follower)) {
       do_assist(k->follower, GET_NAME(ch), 0, 0);
       sprintf(buf,"%s assists you!\r\n", GET_NAME(k->follower));
       send_to_char(buf,ch);
       sprintf(buf,"You assist %s!\r\n", GET_NAME(ch));
       send_to_char(buf,k->follower);
     }


    *******************************************************************
    *   Ron Hensley                     ron@dmv.com                   *
    *   Network Administrator           http://www.dmv.com/~ron       *
    *                                   PGP Key at WWW Page           *
    *   DelMarVa OnLine                 749-7898 Ext. 403             *
    *******************************************************************


     +------------------------------------------------------------+
     | 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/15/00 PST