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

        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.

A ButterMud Production - telnet://

Edit the follow spares in 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


#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.


 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.


GET_DT_CNT(ch) += 1;


Report it within 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


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

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