Recall To Player Houses [by Admin]
Snippet Posted Wednesday, August 12th @ 11:35:01 PM, by George Greer in the Commands dept.
Added Feb 6, 1997. Click the link below to read it or download it.

From: Admin 
Subject: GOHOME Command

In player_special_data_saved in structs.h, you will see a bunch of spares.
Change one of them to int gohome.

then in utils.h, right below GET_PRACTICES(ch), put this line:

#define GET_GOHOME(ch)          ((ch)->player_specials->saved.gohome)



In interpreter.c, with all the ACMD prototypes, put the following lines:

ACMD(do_gohome);

ACMD(do_takehome);

ACMD(do_givehome);

Then, in the command list, make the command declarations like this:

{ "gohome", POS_STANDING, do_gohome, 1, 0 },

{ "givehome", POS_DEAD, do_givehome, LVL_GRGOD, 0 },

{ "takehome", POS_DEAD, do_takehome, LVL_GRGOD, 0 },

Here are the commands, just put these in whatever .c file you want.:

ACMD(do_gohome)
{

if (GET_GOHOME(ch) == 0)
{
  send_to_char("You don't have a gohome!\r\n", ch);
  return;
}

if (real_room(GET_GOHOME(ch)) < 0)
{
  sprintf(buf, "Invalid Gohome, Room %d does not exist.\r\n",
GET_GOHOME(ch));
  send_to_char(buf, ch);
  return;
}

  sprintf(buf, "%s fades into nothingness and is gone.\r\n",
GET_NAME(ch));
  send_to_room(buf, ch->in_room);
  char_from_room(ch);
  char_to_room(ch, real_room(GET_GOHOME(ch)));
  sprintf(buf, "%s appears in a flash of blinding light!\r\n",
GET_NAME(ch));
  send_to_room(buf, ch->in_room);
  look_at_room(ch, 0);

}


ACMD(do_givehome)
{
  struct char_data *vict;
  int home;

  half_chop(argument, arg, buf);

  if (!*arg || !*buf || !isdigit(*buf))
  {
    send_to_char("Usage: givehome  \r\n", ch);
    return;
   }

  if (!(vict = get_char_vis(ch, arg)))
  {
    send_to_char(NOPERSON, ch);
    return;
  }

  if (GET_GOHOME(vict) != 0)
  {
    send_to_char("Character already has a gohome, remove the old one first!\r\n", ch);
    return;
   }

  home = atoi(buf);

  if (real_room(home) < 0)
  {
  send_to_char("Room does not exist.\r\n", ch);
  return;
  }

  GET_GOHOME(vict) = home;
  GET_LOADROOM(vict) = home;
  sprintf(buf1, "You make %s a gohome!\r\n", GET_NAME(vict));
  send_to_char(buf1, ch);
  sprintf(buf1, "%s makes you a gohome!\r\n", GET_NAME(ch));
  send_to_char(buf1, vict);
}

ACMD(do_takehome)
{
  struct char_data *vict;

  skip_spaces(&argument);

  if (!*argument)
  {
    send_to_char("Usage: takehome \r\n", ch);
    return;
  }

  if (!(vict = get_char_vis(ch, argument)))
  {
     send_to_char(NOPERSON, ch);
     return;
  }

  if (GET_GOHOME(vict) == 0)
  {
    sprintf(buf, "%s does not even have a gohome!\r\n", GET_NAME(vict));
    send_to_char(buf, ch);
    return;
  }

    GET_GOHOME(vict) = 0;
    sprintf(buf, "%s removes your gohome!\r\n", GET_NAME(ch));
    send_to_char(buf, vict);
    sprintf(buf, "You remove %s gohome!\r\n", GET_NAME(vict));
    send_to_char(buf, ch);
}


<< Recall Snippet [by The Ready *2* Die? Staff] | Reply | View as text | Flattened | Receptionists without rebooting! [by Gary Barnett] >>

 


Related Links
  download
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.