I am using Circle3.0bpl14, with dgscripts pl5a and olc+ 2.0
Whenever a char is fighting a mob, and the mob gets killed, the game
crashes in this function:
void hitprcnt_mtrigger(struct char_data *ch)
{
trig_data *t;
char buf[MAX_INPUT_LENGTH];
if (!SCRIPT_CHECK(ch, MTRIG_HITPRCNT) || !FIGHTING(ch) ||
AFF_FLAGGED(ch, AFF_CHARM)) <<<<< DEBUGGER POINTS TO HERE!!!!!
return;
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
if (TRIGGER_CHECK(t, MTRIG_HITPRCNT) && GET_MAX_HIT(ch) &&
(((GET_HIT(ch) * 100) / GET_MAX_HIT(ch)) <= GET_TRIG_NARG(t))) {
ADD_UID_VAR(buf, t, FIGHTING(ch), "actor", 0)
script_driver(ch, t, MOB_TRIGGER, TRIG_NEW);
break;
}
}
}
This function is called at the end of
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;
/* check if the character has a fight trigger */
fight_mtrigger(ch);
/* Do some sanity checking, in case someone flees, etc. */
if (ch->in_room != victim->in_room) {
<snip>
.
<snip>
} else
damage(ch, victim, dam, w_type);
}
/* check if the victim has a hitprcnt trigger */
hitprcnt_mtrigger(victim); <<<<< CALLED HERE
}
in fight.c. Just before this function is called, the damage() function
is called.
If the victim dies, the damage() function calls the die() function.
The die() function calls raw_kill(), and the raw_kill() calls the
extract_char() function.
The extract_char() function removes all traces of the victim from
memory, then the hit() function calls hitprcnt_mtrigger(), passing it
the victim info, which no longer exists, causing the game to crash.
I tried putting a if (victim) statement just before the function call,
but that didn't seem to work. Anyone got any ideas?
Thanks in advance.
Throck
+------------------------------------------------------------+
| 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 : 12/15/00 PST