Re: [Circle] [Code] falling_char

From: Ron Hensley (
Date: 11/17/96


Heres a working version of the code you posted a while back.
Fixes the problem with the 'for' loop never actually changing.
Fixes the problem that if there is no dir_option[5] your mud would crash as
 the code never checked that dir_option[5] was not NULL before trying to
 access world[ch->in_room].cir_option[5]->to_room
Fixes problem that the CASEs were upside down, and none had break
Adds making the player actually look at each room as they drop, or else
 they wouldnt get a feeling of dropping, theyd only get a message to know
 they even moved
Still a problem if you are in the AIR and there is no down exit you will
 stop in mid air. With judicious building, itll work i guess, that being 
 a down door from any 'in the air' room

void fall_char(struct char_data *ch) {

  int rooms_fallen, down_room, dam;

  if (IS_NPC(ch))

  rooms_fallen = 1; /* Falling in the same room is considered 1 room */

  if (world[ch->in_room].dir_option[5]) {
    down_room = world[ch->in_room].dir_option[5]->to_room;
    for (; down_room; down_room=world[ch->in_room].dir_option[5]->to_room) {
      send_to_char("You fall!\r\n", ch);
      char_to_room(ch, down_room);  
      look_at_room(ch, 0); 
      if (!(world[ch->in_room].dir_option[5]))
  switch(rooms_fallen) {
    case 1:
      dam = GET_MAX_HIT(ch) * .9;
    case 2:
      dam = GET_MAX_HIT(ch) * .66;
    case 3:   
      dam = GET_MAX_HIT(ch) * .3;
    case 4:
      dam = GET_MAX_HIT(ch) * .2;
      dam = GET_MAX_HIT(ch);  /* ouch */
  GET_HIT(ch) = dam;
  send_to_char("You hit the ground with a loud THUD!\r\n", ch);
  act("$n falls onto the ground with a THUD!", FALSE, ch, 0, 0, TO_ROOM);

    *   Ron Hensley                              *
    *   Systems Administrator        *
    *                                   PGP Key at WWW Page           *
    *   DelMarVa OnLine                 749-7898 Ext. 403             *

| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   |

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