Just to get it outta the way, I'm using:
SmaugWiz 2.02 on Win98, PII 350
Ok, so I wrote spell_plague and it seems to be working except for 1 thing. I want this spell to be contagious, so I opened update.c and added the following just above the ifcheck for IsPoisoned().
if ( ch->IsPlagued() )
{
CCharacter *victim, *v_next;
int retcode;
for ( victim = ch->GetInRoom()->first_person;
victim;
victim = v_next; )
{
v_next = ch->GetNextInRoom();
if ( !victim->IsNpc() )
{
retcode = spell_plague(gsn_plague, LEVEL_AVATAR, ch, victim);
}
}
}
The GSN and the IsPlagued() function are all set up correctly. The spell works just fine if nobody else is in the room. It does damage on each tick perfectly, displays the damage messages just fine. But as soon as somebody else is in the room over a tick, the MUD goes into an endless loop.
Problem is, it isn't the loop. I replaced the spell_plague(gsn_plague, ... line with victim->SendText("Ping.\n\r"); and it no longer crashed.
I have also tried pulling the code from inside spell_plague out and inserting it, as well as just doing victim->SetPlagued() which simply sets the AFF_PLAGUE bit. Both those ways, it goes into an endless loop again.
What am I doing wrong? :)
SmaugWiz 2.02 on Win98, PII 350
Ok, so I wrote spell_plague and it seems to be working except for 1 thing. I want this spell to be contagious, so I opened update.c and added the following just above the ifcheck for IsPoisoned().
if ( ch->IsPlagued() )
{
CCharacter *victim, *v_next;
int retcode;
for ( victim = ch->GetInRoom()->first_person;
victim;
victim = v_next; )
{
v_next = ch->GetNextInRoom();
if ( !victim->IsNpc() )
{
retcode = spell_plague(gsn_plague, LEVEL_AVATAR, ch, victim);
}
}
}
The GSN and the IsPlagued() function are all set up correctly. The spell works just fine if nobody else is in the room. It does damage on each tick perfectly, displays the damage messages just fine. But as soon as somebody else is in the room over a tick, the MUD goes into an endless loop.
Problem is, it isn't the loop. I replaced the spell_plague(gsn_plague, ... line with victim->SendText("Ping.\n\r"); and it no longer crashed.
I have also tried pulling the code from inside spell_plague out and inserting it, as well as just doing victim->SetPlagued() which simply sets the AFF_PLAGUE bit. Both those ways, it goes into an endless loop again.
What am I doing wrong? :)