Re: [Multi-attack obscure error]

From: Del (caminturn@earthlink.net)
Date: 11/06/00


RJ Bean wrote:
>
> In an attempt to implement multiple attack skills (second attack, third
> attack...sixth attack) I edited perform_violence() near the call to hit()
> and put some nested if statements along the lines of if you got second
> attack, then hit, if third attack, then hit, etc...  I compiled it with no
> errors and it runs fine for like about 3 or 4 rounds of combat.  Then the
> mud goes kablooie, crashes down and stuff.  It may have something to do with
> the victim going to pos_mortally wounded b/c half the time it crashes when
> the next round starts after the vict has been mort wounded.  MSVC 6.0 offers
> to debug the .exe file when an error occurs.  It brought me to the first
> line of the sanity check in hit() where it says:
>   if ((ch->in_room) != (victim->in_room)) {
>     if ((FIGHTING(ch)) && (FIGHTING(ch)) == (victim))
>       stop_fighting(ch);
>     return;
>
> It's pretty vague about what went wrong
> but I believe that in_room's value was like deinitialized or destroyed or
> something.  How?  I haven't the foggiest...  Anybody have any sort of
> trouble like this before?
>


I posted an attack code a long time ago, after I saw the one that added
attacks as skills. I detested that idea because it was limiting and used
flags. It was not hard to create the system to allow any number of
attacks
and if you want a second attack as a skill, you can add it easily or
just
add a check if they are a certain class and above a certain level (or
whatever
you want to use for a basis for that second attack) and add one to the
attack
phase. BTW, this is not to slam the person who wrote the code.. All code
is good
because it provides references on how to do things.

A fix for your possible problem (and was a problem with mine):

void hit(struct char_data * ch, struct char_data * victim, int type)
{
  struct obj_data *wielded = GET_EQ(ch, WEAR_WIELD);
  int w_type, victim_ac, calc_thaco, dam, diceroll;


+  if(!ch || !victim)
+    return;

  /* check if the character has a fight trigger */
  fight_mtrigger(ch);


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/11/01 PDT