Cirlce [CODE] - Putting spare int's to use.

From: Cris Jacobin (jacobin@BELLATLANTIC.NET)
Date: 10/31/97


        This is how I went about implementing death/kill/deathtrap counters
for player characters.  It's meaningless in terms of characters having view
of the underlying engine, yet still satisfies their hunger for numbers in
do_score.

        I also have a 'victories in the arena' counter, but left it out
considering my arena being scratch code.  Should be simple enough to add.

-Jac
A ButterMud Production - telnet://betterbox.net:4000

Edit the follow spares in structs.h

__structs.h__

 int spells_to_learn;         /* How many can you learn yet this level*/
   int rip_cnt;
   int kill_cnt;
   int dt_cnt;;
   int spare10;

__

Add the following macros in utils.h

__utils.h__


#define GET_RIP_CNT(ch)         ((ch)->player_specials->saved.rip_cnt)
#define GET_KILL_CNT(ch)        ((ch)->player_specials->saved.kill_cnt)
#define GET_DT_CNT(ch)          ((ch)->player_specials->saved.dt_cnt)

__

Add the following right before die(victim) is called.

__fight.c__

 if (!IS_NPC(victim))
     GET_RIP_CNT(victim) += 1;
    if (!IS_NPC(ch))
     GET_KILL_CNT(ch) += 1;

__

Add the following right before the character is extracted when walking into
a deathtrap.

__act.movement.c__

GET_DT_CNT(ch) += 1;

__

Report it within do_score

__do.score__

 sprintf(buf, "%sYou have died %d times and killed %d opponents.\r\n",
          buf, GET_RIP_CNT(ch), GET_KILL_CNT(ch));
    sprintf(buf, "%sYou have walked into a deathtrap %d times.\r\n",
          buf, GET_DT_CNT(ch));

__

Now for the nosey wizards in stat_char

__act.wizard.c__

sprintf(buf, "Rip: [%d], Kills: [%d], DeaathTraps:
[%d]\r\n",GET_RIP_CNT(k), GET_KILL_CNT(k), GET_DT_CNT(k));
    send_to_char(buf, ch);

__


     +------------------------------------------------------------+
     | 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