Re: CODE/HELP: Second attack snipit

From: Rasmus 'Con' Ronlev (
Date: 07/08/96

On Mon, 8 Jul 1996, Sliver wrote:

>     if((GET_SKILL(ch, SKILL_SECOND_ATTACK) > 0)) {
>        if(GET_SKILL(ch, SKILL_SECOND_ATTACK) > number(1,200)-5*GET_LEVEL(ch) )
>          hit(ch, FIGHTING(ch), TYPE_UNDEFINED);
>     }
>        hit(ch, FIGHTING(ch), TYPE_UNDEFINED);
>     }
> second of all, with this code, whenever I fight while affected by haste, or the 
> second_attack skill, the mud crashes, with no errors in the syslog.

Well, I beleave you've run across the most common problem of the 
implementors adding multible attacks :) The reason for your crash(es) is, 
that normaly the perform_violence routine checks for sanity checks at the 
START of perform_violence() to check if the person is fighting and stuff 
like that. This is not done on your seccond and/or haste attack, and 
thus, if you kill the mob in your first hit, you will be 'hitting' a mob 
thats been killed BEFORE you make the sanity checks again... (does it 
make any sense to you ? *grin*).

Anyway, just add if (FIGHTING(ch)) before all the hit()'s you added, and 
it won't crash... simple and easy :)


     Rasmus Rønlev DOEK'94      WWW:  
     Student instructor         MUD: 5000
       Student, B.Sc in Computer Science and Business Administration. 

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