Welcome to the Builder Academy

Question Bug in dying mob

More
26 May 2025 12:49 - 26 May 2025 12:51 #10719 by JTP
Bug in dying mob was created by JTP
Hi

I was in a room with 1 mob. I start to kill it. When it died I received XP twice and then there was 2 corpses.

The weird part is that it only happens 1/4ish times

Any idea why ?
Attachments:
Last edit: 26 May 2025 12:51 by JTP.

Please Log in or Create an account to join the conversation.

More
26 May 2025 21:24 #10720 by thomas
Replied by thomas on topic Bug in dying mob
I think the stop_fighting call is in the wrong place. I'm pretty sure we'd have discovered if this is stock behaviour. Have you added multiattack?

Please Log in or Create an account to join the conversation.

More
26 May 2025 21:54 - 27 May 2025 10:14 #10721 by JTP
Replied by JTP on topic Bug in dying mob
Yes I have the option to have several attacks

And after some testing it seems those who has more attacks has this happening sometimes.
Last edit: 27 May 2025 10:14 by JTP.

Please Log in or Create an account to join the conversation.

More
26 May 2025 22:19 - 27 May 2025 19:37 #10722 by JTP
Replied by JTP on topic Bug in dying mob
I hope one of you guys can see where the problem is then ? I have no idea.


/* control the fights going on.  Called every 2 seconds from comm.c. */
void perform_violence(void)
{
  struct char_data *ch, *tch;

  for (ch = combat_list; ch; ch = next_combat_list) {
    next_combat_list = ch->next_fighting;

    if (FIGHTING(ch) == NULL || IN_ROOM(ch) != IN_ROOM(FIGHTING(ch))) {
      stop_fighting(ch);
      continue;
    }

    if (IS_NPC(ch)) {
      if (GET_MOB_WAIT(ch) > 0) {
        GET_MOB_WAIT(ch) -= PULSE_VIOLENCE;
        continue;
      }
      GET_MOB_WAIT(ch) = 0;
      if (GET_POS(ch) < POS_FIGHTING) {
        GET_POS(ch) = POS_FIGHTING;
        act("$n scrambles to $s feet!", TRUE, ch, 0, 0, TO_ROOM);
      }
    if ((GET_HIT(FIGHTING(ch)) <= 12) && (MOB_FLAGGED(ch, MOB_MERCY))) {
        stop_fighting(FIGHTING(ch));
        stop_fighting(ch);
        act("$n says: Blessed are the merciful, for they shall obtain mercy!", FALSE, ch, 0, 0, TO_ROOM);
    }
      // re-wield weapon lost to SKILL_DISARM
      if (LOST_WEAPON(ch)) {
        if (DISARM_WAIT(ch) > 0) {
        DISARM_WAIT(ch) -= PULSE_VIOLENCE;
        } else {
        do_wield(ch, OBJN(LOST_WEAPON(ch), ch), 0, 0);
        LOST_WEAPON(ch) = NULL;
      }
    }
}

    if (GET_POS(ch) < POS_FIGHTING) {
      send_to_char(ch, "You can't fight while sitting!!\r\n");
      continue;
    }
    if (GET_MOVE(ch) <= 0)
      continue;

/*    if (GROUP(ch)) {
      while ((tch = (struct char_data *) simple_list(GROUP(ch)->members)) != NULL) { */
    if (GROUP(ch) && GROUP(ch)->members && GROUP(ch)->members->iSize) {
        struct iterator_data Iterator;
    tch = (struct char_data *) merge_iterator(&Iterator, GROUP(ch)->members);
        for (; tch ; tch = next_in_list(&Iterator)) {
        if (tch == ch)
          continue;
        if (!IS_NPC(tch) && !PRF_FLAGGED(tch, PRF_AUTOASSIST))
          continue;
        if (IN_ROOM(ch) != IN_ROOM(tch))
          continue;
        if (FIGHTING(tch))
          continue;
        if (GET_POS(tch) != POS_STANDING)
          continue;
        if (!CAN_SEE(tch, ch))
          continue;

        do_assist(tch, GET_NAME(ch), 0, 0);
      }
        remove_iterator(&Iterator);
    }
    {
    hit(ch, FIGHTING(ch), TYPE_UNDEFINED);
    GET_MOVE(ch) -= 1;
    }
/* more attacks */
//2nd attack****************************************************************  2nd, 3rd, and 4th attack - bs cjl
//Mob multi attacks by level ************ NPC ATTACKS begin
        if (IS_NPC(ch)) {
                int level=GET_LEVEL(ch);
                while (level>24)
                {level-=24;

        if (FIGHTING(ch) == NULL || ch->in_room != FIGHTING(ch)->in_room) {
      stop_fighting(ch);
      continue;
    }

        if (rand_number(1,GET_LEVEL(ch)) < (GET_LEVEL(ch)/2))
        {
        hit(ch, FIGHTING(ch), TYPE_UNDEFINED);
        GET_MOVE(ch) -= 1;
        }
                }
        }

        if (!IS_NPC(ch)) {

    if (FIGHTING(ch) == NULL || ch->in_room != FIGHTING(ch)->in_room) {
      stop_fighting(ch);
      continue;
    }
    if (rand_number( 1, 101 ) < (GET_SKILL(ch, SKILL_ATTACK2) / 2))  /* 50% chance to activate */
        {
          hit(ch, FIGHTING(ch), TYPE_UNDEFINED);
          GET_MOVE(ch) -= 1;
        }
        }
//3rd attack*****************************************************************

        if (!IS_NPC(ch)) {

        if (FIGHTING(ch) == NULL || ch->in_room != FIGHTING(ch)->in_room) {
      stop_fighting(ch);
      continue;
    }

    if (rand_number( 1, 101 ) < (GET_SKILL(ch, SKILL_ATTACK3) / 4))  /* 25% chance to activate */
        {
          hit(ch, FIGHTING(ch), TYPE_UNDEFINED);
          GET_MOVE(ch) -= 1;
        }
        }
//4th attack*****************************************************************
        if (!IS_NPC(ch)) {

    if (FIGHTING(ch) == NULL || ch->in_room != FIGHTING(ch)->in_room) {
      stop_fighting(ch);
      continue;
    }

    if (rand_number( 1, 101 ) < (GET_SKILL(ch, SKILL_ATTACK4) / 8 ))  /* 12.5% chance to activate */
        {
        hit(ch, FIGHTING(ch), TYPE_UNDEFINED);
        GET_MOVE(ch) -= 1;
        }
        }
//haste attack*****************************************************************
        if (!IS_NPC(ch)) {

    if (FIGHTING(ch) == NULL || ch->in_room != FIGHTING(ch)->in_room) {
      stop_fighting(ch);
      continue;
    }

    if (IS_AFFECTED(ch, AFF_HASTE) && (!IS_AFFECTED(ch, AFF_SLOW)))
        {
        hit(ch, FIGHTING(ch), TYPE_UNDEFINED);
        GET_MOVE(ch) -= 1;
        }
        }

//end snippet here*****************************************************************

/* more attacks end */

    if (MOB_FLAGGED(ch, MOB_SPEC) && GET_MOB_SPEC(ch) && !MOB_FLAGGED(ch, MOB_NOTDEADYET)) {
      char actbuf[MAX_INPUT_LENGTH] = "";
      (GET_MOB_SPEC(ch)) (ch, ch, 0, actbuf);
    }
  }
} */ end of file */
Last edit: 27 May 2025 19:37 by JTP.

Please Log in or Create an account to join the conversation.

More
28 May 2025 21:06 #10723 by thomas
Replied by thomas on topic Bug in dying mob
add || DEAD(FIGHTING(ch)) to your checks:
Code:
- if (FIGHTING(ch) == NULL || ch->in_room != FIGHTING(ch)->in_room) + if (FIGHTING(ch) == NULL || ch->in_room != FIGHTING(ch)->in_room || DEAD(FIGHTING(ch)))

Please Log in or Create an account to join the conversation.

More
28 May 2025 21:16 #10724 by JTP
Replied by JTP on topic Bug in dying mob
In the entire perform violence or just the multi attack part ?

Please Log in or Create an account to join the conversation.

Time to create page: 0.202 seconds