[CODE SNIPPET] Enhanced teleport

From: Andrey Fidrya (andrey@ALEX-UA.COM)
Date: 09/04/98


Hi, All!

Here is teleport spell from RMUD.
It teleports caster to random room in same zone. It requires no other code
changes (just set in spell_parser that SPELL_TELEPORT requires no arguments)
and it doesn't takes much CPU time. Maybe you'll want to add some deathtrap or
godroom checks to it...

ASPELL(spell_teleport)
{
  int to_room = 0, counter = 0, room;

  for (room = ch->in_room; room > NOWHERE &&
     world[ch->in_room].number / 100 == world[room].number / 100; room--)
    if (number(1, ++counter) == 1)
      to_room = room;
  for (room = ch->in_room + 1; room <= top_of_world &&
     world[ch->in_room].number / 100 == world[room].number / 100; room++)
    if (number(1, ++counter) == 1)
      to_room = room;
  if (!to_room)
    return;

  act("$n disappears. [Change this msg]", FALSE, ch, 0, 0, TO_ROOM);
  char_from_room(ch);
  char_to_room(ch, to_room);
  act("$n appears. [Change this msg]", FALSE, ch, 0, 0, TO_ROOM);
  look_at_room(ch, 0);
}

Btw, is it worth to be made stock?

  Andrey (andrey@alex-ua.com)
    aka Zmey // RMUD


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



This archive was generated by hypermail 2b30 : 12/15/00 PST