Hospitals & Player stats

Posted by Dark_Trunks on Mon 10 Jun 2002 03:29 PM — 4 posts, 17,725 views.

Australia #0
I know, its a strange combination but these are the things I need to know right now!

So anyway, I want to add a hospital room to my mud, my question is this: How do I change the rate of healing depending on the room the player is in? And while we're on the subject of healing, how do I change the rate of healing for a perticular race?

My next question is about player stats. C programming definately isnt my strong point (seeing as I saw C for the first time when I downloaded the source for smaug!), so please bare with me. I know how to access the stats, xp, mana etc by using the statement 'ch->' but I want to make a couple of new variables in the same place. Which .c file can I find these in and how do add them?

Thanks in advance for any help anyone can provide.
Australia Forum Administrator #1
You want the declaration of the character, which is in mud.h. Somewhere in the middle you will find all the characteristics that a player has. Here is part of it ...


/*
 * One character (PC or NPC).
 * (Shouldn't most of that build interface stuff use substate, dest_buf,
 * spare_ptr and tempnum?  Seems a little redundant)
 */
struct  char_data
{
    CHAR_DATA *     next;
    CHAR_DATA *     prev;
    CHAR_DATA *     next_in_room;

...

    sh_int      num_fighting;
    sh_int      substate;
    sh_int      sex;
    sh_int      class;
    sh_int      race;
    sh_int      level;
    sh_int      trust;
    int         played;
    time_t      logon;
    time_t      save_time;
    sh_int      timer;
    sh_int      wait;
    sh_int      hit;
    sh_int      max_hit;
    sh_int      mana;
    sh_int      max_mana;
    sh_int      move;
    sh_int      max_move;
    sh_int      practice;
    sh_int      numattacks;
    int         gold;
    int         exp;

...

    sh_int      mod_con;
    sh_int      mod_cha;
    sh_int      mod_lck;
    sh_int      mental_state;       /* simplified */
    sh_int      emotional_state;    /* simplified */
    int         pagelen;                        /* BUILD INTERFACE */
    sh_int      inter_page;                     /* BUILD INTERFACE */
    sh_int      inter_type;                     /* BUILD INTERFACE */
    char        *inter_editing;                 /* BUILD INTERFACE */
    int         inter_editing_vnum;             /* BUILD INTERFACE */
    sh_int      inter_substate;                 /* BUILD INTERFACE */
    int         retran;
    int         regoto;
    sh_int      mobinvis;   /* Mobinvis level SB */
};

USA #2
most of what u asking does not require coding, for the hospital room it seems you are making it to complicated. for 1 room just make a prog
example:
if rand(30)
if position($r) == ? -i dont know these without looking
mprestore $r 30
else
if position($r) == ?
mprestore $r 50
else
etc.
can also include it to restore races etc differently but will take lil longer but still most likely less time if not used to coding
and for setting regen rates for races
setrace ?? hp_regen ??
i have never used this but should work
Australia #3
Great thanks alot people. I actually found the player stats myself not long after posting. Funny how that happens hey? And also, earlier today, while writing some other code, I found a little section about hp regen, I think in update.c, so I figure a few 'if' statements to check races should do the job.