Re: [code] [question] [newbie] Mob Attacks

From: brian (
Date: 03/02/97

  dan's on the right track, but instead of having the mob just switch
FIGHTING(ch) = newvict, why not enable it to fight multiple people at

in the player struct is a char_data structure called *fighting, as you may
have guessed already, FIGHTING(ch) is actually just ch->*fighting

  what that star means is it has to be CREATE'd to have any memory
content, it also means you can store multiple names in that there bugger..

  so, instead of struct char_data *fighting           we could move it to
                 struct char_data *fighting[MAX_FIGHTERS];

  then #define MAX_FIGHTERS 3         at more near the beginning of
structs.h..  so, what next?  well first off you'll have to find the place
in fight.c to have it check for multiple fighters (i'll give you a clue,
it's in void perform_violence() )

  ok, now right before it decides it's gonna hit(vict) , put in a little
check for multiple fighters, and decide which he wants to hit this round.

struct char_data *bubba = NULL;
int j;

// NOTE:  i'm not familiar with stock structures any more so it may
//        be under ch->player_specials->fighting

  for (j = MAX_FIGHTERS; j < 0; j--)
     if (ch->fighting[j] && number(0,MAX_FIGHTERS))
        bubba = ch->fighting[j];
  if (!bubba)
    bubba = ch->fighting[0];

now here's where it get's tricky, no not for you, for me..   i beleive
(maybe)  that stock peform_violence() went something like this:


   if (!fighting)


so, now we switcha-rooni :

   hit(ch, bubba, TYPE_UNDEFINED);

  don't forget to change your #define FIGHTING to include the [0].. or
even better yet just define FIGHTING to pick a random fighter..

   #define FIGHTING(ch)   ( number(0,1) ? ch->fighting[0] : number(0,1) ?
                ch->fighting[1] : ch->fighting[2] )

   #define FIGHTING(ch)   ( ch->fighting[0] ? number(0,1) ?    \
      ch->fighting[1] ? ch->fighting[1] : ch->fighting [0] :   \
      ch->fighting[0] : NULL )

but then you can't have the #define MAX_FIGHTERS, so whatever..

this is as applicable to real players as much as it is to mobs..

(hope this helps)


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