[Circle] [Code] falling_char

From: Brian Guilbault (guil9964@nova.gmi.edu)
Date: 11/14/96


Hi Guys-

I finally got around to finishing up my fly code and everything is done 
except for the wearing off part. I now have it so that in affect_update, 
when they affect is removed and if it is SPELL_FLY, a function called 
falling_char is called (sorry I stole the name whoever gave it to me :-)

Anyway, the function looks like it should work except I'm having a 
problem setting up the for loop that cycles through the rooms below until 
it gets to one that doesn't have an exit downward. It's supposed to stop 
there then issue the damage. Here's the entire function:


void fall_char(struct char_data *ch) {

int rooms_fallen, down_room, dam;

rooms_fallen = 1; /* Falling in the same room is considered 1 room */
down_room = world[ch->in_room].dir_option[5]->to_room;

for (ch->in_room; !down_room; down_room) {
  rooms_fallen ++;
  send_to_char("You fall!\r\n", ch);
  char_to_room(ch, down_room);
}

switch(rooms_fallen) {
  case 1: dam = GET_MAX_HIT(ch) * .2;
  case 2: dam = GET_MAX_HIT(ch) * .3;
  case 3: dam = GET_MAX_HIT(ch) * .66;
  case 4: dam = GET_MAX_HIT(ch) * .9;
  default: 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);
}

I do it this way so that everyone has the same chance of survivng a fall 
based on how healthy they are at the time (again thanks for the idea). If 
anyone can help me with that for loop, it would be greatly appreciated.

Thanks,

  -Brian


-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Brian Guilbault - GMI Engineering Institute
E-mail: guil9964@gmi.edu, dante@i-55.com
WWW: http://apollo.gmi.edu/~guil9964
QuarantineMUD: Telnet to exit1.i-55.com 4000
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

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



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