Teleport Spell [by Franco]
Snippet Posted Wednesday, August 12th @ 11:37:53 PM, by George Greer in the Skills dept.
. Click the link below to read it or download it.

From: Franco <awe@mt.arias.net>
Subject: [Circle] New Teleport

I thought the relocate spell was overused, so I rewrote the teleport spell
(how often is the original used anyway, cept by a few snoopy morts?). You
have to change the spello/mag_assign_spell or wotever functions in
'spell_parser.c' to have the spell accept a TAR_VICT_WORLD (I think).


/* New and improved teleport spell */
ASPELL(spell_teleport)
{
  struct room_data *newroom = 0;
  struct room_data *casting_room, *target_room;
  struct obj_data *foolz_objs;
  int randroom = 0, prob = 0, NR = 0, i;

  extern int top_of_world;

  if (ch == NULL || victim == NULL)

  return;

  casting_room = &world[ch->in_room];
  target_room = &world[victim->in_room];

  if (GET_LEVEL(victim) > LVL_IMMORT && GET_LEVEL(ch) < LVL_IMMORT) {

  send_to_char("Your mortal magic is foiled.\r\n", ch);

  return;
  }
  /*
  if (IS_SET(casting_room->room_flags, ROOM_NOTELEPORT)) {

  send_to_char("This room blocks your attempt to teleport.\r\n", ch);

  return;
  }

  if (IS_SET(target_room->room_flags, ROOM_NOTELEPORT)) {

  send_to_char("The destination room blocks your teleport.\r\n", ch);

  return;
  }
  */
  if (IS_SET(casting_room->room_flags, ROOM_NOMAGIC)) {

  send_to_char("Your magic fizzles out and dies.\r\n", ch);

  return;
  }


  if (IS_NPC(victim)) {

  send_to_char("You cannot get an image of the location..\r\n", ch);

  return;
  }

  newroom = &world[victim->in_room];

  if (IS_SET(newroom->room_flags, ROOM_NOMAGIC)) {

  send_to_char("Your destination's anti-magic barrier prevents the spell.\r\n",
 ch);

  return;
  }
  if (IS_SET(newroom->room_flags, ROOM_TUNNEL)) {

  send_to_char("The size of the destination prevents your teleportation.\r\n",
ch);

  return;
  }
  prob = number(1,100);

  if (GET_LEVEL(ch) >= LVL_IMMORT)

  prob = 50;

  if (prob >= 3 && prob <= 90) {

send_to_char("Your magic takes affect as your begin to shift locations...\r\n",
 ch);

act("$n slowly disappears, teleporting away.", TRUE, ch, 0, 0, TO_NOTVICT);

    NR = victim->in_room;


char_from_room(ch);

char_to_room(ch, NR);


act("$n teleports into the room.", TRUE, ch, 0, 0, TO_ROOM);

send_to_char("You have teleported on target.\r\n", ch);

look_at_room(ch, 0);

return;
  }

  if (prob < 3) {

  send_to_char("Your spell goes awry as you teleport into solid matter!\r\n", c
h);

  act("$n miscasts a teleport spell, and disappears.", TRUE, ch, 0, 0, TO_NOTVI
CT);


  for (i = 0; i < NUM_WEARS; i++)


if (GET_EQ(ch, i))


  unequip_char(ch, i);

  while (ch->carrying) {



foolz_objs = ch->carrying;



extract_obj(foolz_objs);

  }

  extract_char(ch);

  sprintf(buf, "(GC) %s has misteleported, attempting to teleport to %s, and di
ed.", GET_NAME(ch), GET_NAME(victim));

  mudlog(buf, BRF, LVL_IMMORT, TRUE);

  log(buf);

  return;
  }

  if (prob < 90) {

  send_to_char("Your spell goes awry as you teleport into an unknown place!\r\n
", ch);

  act("$n miscasts a teleport spell, and disappears.", TRUE, 0, 0, 0, TO_NOTVIC
T);
      do {


randroom = number(0, top_of_world);
      }

  while (ROOM_FLAGGED(randroom, ROOM_PRIVATE | ROOM_DEATH));

  char_from_room(ch);

  char_to_room(ch, randroom);

  act("$n teleports into the room.", TRUE, ch, 0, 0, TO_ROOM);

  send_to_char("You luckily have not died during teleportation.\r\n", ch);

  look_at_room(victim, 0);

  return;
  }
}



<< Summon Spell (w/answer) [by Mark Gerritsen] | Reply | View as text | Flattened | Teleport Rooms [by Daniel Burke] >>

 


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.