Creating A Monster Index

Posted by Daniel Spain on Tue 22 May 2012 12:19 AM — 1 posts, 8,638 views.

#0
hello all, in my game i have been listing monsters like so:

There is a dragon, a dragon, and a minotaur here.

to do this i use the following code:


void shwmon(int room)
{
   int i,mn[10],m,c=0;

   for(i = 0 ; i < NMON ; i++)
   {
     if((arnmar.active) && (arnmar.loc==room))
     {
       mn[c++] = arnmar.id;
     }
   }

   if(c)
   {
      sendplayer(p,BRRED,"\r\nThere is ");
      
      for(i = 0 ; i < c ; i++)
      {
        m = mn;

        if((mon < NMON) && (mon[i+1] < NMON) && (i<(NMRMMN-1)))
        {
           if(!i) sendplayer(p,BRRED," %s %s",
                  prefix[monsters[m].prefix],
                  monsters[m].name);
           else   
           sendplayer(p,BRRED,", %s %s",
                     prefix[monsters[m].prefix],
                     monsters[m].name);
        } 
        else
        {
           if(!i) sendplayer(p,BRRED," %s %s",
                  prefix[monsters[m].prefix],
                  monsters[m].name); 
           else
           sendplayer(p,BRRED,", and %s %s",
           prefix[monsters[m].prefix],
           monsters[m].name);
        }
      }

      sendplayer(p,BREED," here.");
      sendplayer(p,WHITE,"\r\n");
   }
}


what i want to accomplish next is to index em differently
so it would come out:

There are two dragons, and a minotaur here.

i been trying it so many different ways and i keep coming up emptyhanded, any help would be appreciated.
the problem i am having is how to store em.
Amended on Tue 22 May 2012 12:20 AM by Daniel Spain