Re: Multihit for mobs by Christian Duvall

From: AFCervo (chrisf@PTDPROLOG.NET)
Date: 08/12/97


On Mon, 11 Aug 1997, Crimson Wizard wrote:

> First i noticed there's a hole in the instructions, ie... you need to add
> the appropriate define's to olc.h, but another curious thing is in fight.c
> when you add the routine to perform_violence() and compile, first it
> grumbles about may not be initialising "ch" then this pretty little
> coredump happens:
>
> Mon Aug 11 15:33:44 :: New connection.  Waking up.
> Segmentation fault (core dumped)
>
> GDB
> void perform_violence(void)
> {
>   struct char_data *ch;
>   extern struct index_data *mob_index;
>   int perc, val, apr;
/* Add for loop right here, otherwise ch is nothing */
it is probably down further in the function.  just move your new code
inside of the for loop */
>
>   if (IS_NPC(ch)) {
>     perc = number(1, 101);
>     val = ch->mob_specials.attack1;
>     if (val > perc) {
> **snip**
>

> (gdb) list
> 948     {
> 949       struct char_data *ch;
> 950       extern struct index_data *mob_index;
> 951       int perc, val, apr;
> 952
/* cut from here */
> 953       if (IS_NPC(ch)) {
> 954         perc = number(1, 101);
> 955         val = ch->mob_specials.attack1;
> 956         if (val > perc) {
> 957           apr++;
>
/* to here */

and put it under the for loop, or make the for loop yourself above the new
code and remove the old one......................


judgeing from all this code, you don't have a character for ch...
there should be a for loop in the code that looks like this

  for (ch = combat_list;ch; ch->next_combat_list) {
        next_combat_list = ch->next_fighting;
       /* entire rest of perform_violence goes in here */
  } /*end of for loop*/
} /* end of perform_violence

for further explanation, ch is equal to the list of them fighting, and
perform violence advances ch a round, then ch is equal to the next
fighting player, and the same thing is done until there are no more
players and ch is equal to null.  What you did was have no player equal to
ch, you just used a ch with no character in it.  This is vital to
perform_violence.  I think you can do the mob multi-attacks on your own
tho.....


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



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