Spirit World [by Ortluk]
Snippet Posted Thursday, September 28th @ 02:01:46 PM, by George Greer in the Players dept.
Ortluk writes, "One of my Builders submitted an Idea to me for a spirit world where dead players go, rather than littering the world with player corpses and retrieving them. I liked the idea so I implemented it. It works great for us. This is my first submission, I've learned alot from coders who have submitted there work here, so I thought I'd give something back."
----- Death Snippet --------

This is an alternate way of handling death. Rather than leaving a corpse, players are 
taken to a spirit world, where they must collect spirit gold and find and bribe the 
God of Death, to return to the mortal world.  Make sure you back up your code before 
installing this code.  Also rooms 14100 - 14150 (the ones I used for my spirit world) 
must exsist, as well as mob # 14100, or you're mud will crash, and this code won't work.
Credit me if you want to.

Ortluk

Disclaimer:
I am in no way responsible for any problems this code may cause with your mud, computer,
wife, dog or school work.

Here it is.

In structs.h -
  change one of the int spares in player_special_data_saved to int temp_gold

  Find the player flags and add -
    #define PLR_DEAD        (1 << ##)  /* player is dead (## = next number in list)*/ 
  
  Somewhere in the file add -
    /* Spirit world info */
    #define SPIRIT_MIN  14100  
    #define SPIRIT_MAX  14150
 
In interpreter.c -
  add this entry to the command list.
  { "bribe"    , "bri"  , POS_STANDING, do_not_here , 0, 0},

In fight.c -
  In function raw_kill
    Find -
      make_corpse(ch);
      extract_char(ch);
    Change it to -
      if (IS_NPC(ch)) {
        make_corpse(ch);
        extract_char(ch);
      } else {
        send_to_char("You feel yourself being pulled into a bright light...\r\n", ch);
        char_from_room(ch);
        char_to_room(ch, real_room(number(SPIRIT_MIN, SPIRIT_MAX)));
        GET_HIT(ch) = GET_MAX_HIT(ch);
        GET_MANA(ch) = GET_MAX_MANA(ch);
        GET_MOV(ch) = GET_MAX_MOV(ch);
        update_pos(ch);
        look_at_room(ch, 0);
        if (!PLR_FLAGGED(ch, PLR_DEAD)){
          GET_TEMP_GOLD(ch) = GET_GOLD(ch);
          GET_GOLD(ch) = 0;
          SET_BIT(PLR_FLAGS(ch), PLR_DEAD);
        }
      }

In spec_procs.c Add -
  extern sh_int r_mortal_start_room;
to other externs.

Add the function -
  /* Special process for Death God (must be bribed to be mortal again) */
  SPECIAL(death_god)  
  {
    struct char_data *god = (struct char_data *) me;

    if (!PLR_FLAGGED(ch, PLR_DEAD))
      return FALSE;

    if (CMD_IS("bribe")) {
      if (argument == "god" || argument == "death"){
        send_to_char("Bribe who?\r\n", ch);
        return TRUE;
      } else {                                   
        if (GET_GOLD(ch) >= (GET_LEVEL(ch) * 100)) {
          send_to_char("You see the white light fade into the distance...", ch);
          REMOVE_BIT(PLR_FLAGS(ch), PLR_DEAD);
          char_from_room(ch);
          char_to_room(ch, r_mortal_start_room);
          GET_HIT(ch) = GET_MAX_HIT(ch);
          GET_MANA(ch) = GET_MAX_MANA(ch);
          GET_MOVE(ch) = GET_MAX_MOVE(ch);
          GET_GOLD(ch) = GET_TEMP_GOLD(ch);
          update_pos(ch);
          look_at_room(ch, 0);
          return TRUE;
        } else {
           send_to_char("You don't Have the gold for that", ch);
           return TRUE;
         }
      }
    } else {
      return FALSE;
    }
  }

In spec_assign.c Add -

  SPECIAL (death_god);

to the other defines like it, and add -

  /* Spirit World Assignments */
    ASSIGNMOB(14100, death_god);

at the end of midgaard assignments.

That should be it, just compile as usual.

<< MobSkills for Spec_Procs (with two procs) [by BoxBoy] | Reply | View as text | Threaded | Automated Auction Code [by Jake Turner] >>

 


Related Links
  Ortluk
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.
 
 


You left out a #define...
by Peter Ajamian (peter@pajamian.dhs.org) on Thursday, September 28th @ 02:58:18 PM
http://
You left out the #define for GET_TEMP_GOLD, it should go in utils.h and be as follows...

#define GET_TEMP_GOLD(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.temp_gold))
[ Reply to this comment ]

This line won't work...
by Peter Ajamian (peter@pajamian.dhs.org) on Thursday, September 28th @ 03:06:50 PM
http://
This line won't do what you think it does...

if (argument == "god" || argument == "death"){

the line you want is...

if (str_cmp(argument,"god") && str_cmp(argument,"death")){

Regards, Peter
[ Reply to this comment ]