Re: NEWBIE Lives system & Prompt

From: Peter Ajamian (peter@pajamian.dhs.org)
Date: 02/05/00


Jerry Billings wrote:
>
> In a message dated 2/4/00 1:40:48 AM Pacific Standard Time,
> peter@pajamian.dhs.org writes:
>
>  Exactly what kind of lives system are you looking to do?
>
>  Regards, Peter
>   >>
> Well I just want a simple one., you start out the game with 10 lives, and
> every time you die you lose one, and when lose all ten you cannot log in
> anymore, it'll give a message sayiung you've died all your lives or something
> and then disconnect you. But I also want to be able to sell lives so they can
> buy them back.

Okay, that should be fairly easy to do, and since you caught me in a
good mood I'll help you out a lot.  First you need to change structs.h,
look for the lines below in the struct player_special_data_saved...

   /* spares below for future expansion.  You can change the names from
      'sparen' to something meaningful, but don't change the order.  */

and change one of the ubyte spares to a name you want to use such as
lives.

Then add a #define to utils.h that you can use to reference the new
variable...

#define GET_LIVES(ch) (CHECK_PLAYER_SPECIALS((ch),
(ch)->player_specials->saved.lives)

Then add a line to init_char in db.c which initializes GET_LIVES(ch) to
10.

if (!IS_NPC(ch)) GET_LIVES(ch) = 10;

Next you'll need to modify raw_kill in fight.c and add lines to
decrement the lives and check them possibly setting the deleted flag on
the char, all before the extract_char line...

if (GET_LEVEL(ch) < LVL_IMMORT && !--GET_LIVES(ch))
  SET_BIT(PLR_FLAGS(d->character), PLR_DELETED);

Note that the check for immortal is before the decrement/check of the
lives left, this way the lives will only be decremented if the player is
not an immortal.

Also note immortals are never supposed to die, so the check for
immortals here is really redundant, but I like to be extra carefull.

All that is left now is for you to create a new command which players
can use to buy more lives.  You may want to make it a mob special so
they can only buy lives from a ceartain mob or mobs, at any rate, I'll
leave that part for you to figure out.

Regards, Peter


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



This archive was generated by hypermail 2b30 : 04/10/01 PDT