This snippet was taken from www.grayarea.com/sneak.htm and MAY NOT be
posted on your web site. It MUST be linked back to the above URL for   
download.   


- The following snippet when added into update.c allows for 
- lightning to strike players who are greater than level 17.
- This has a 15% chance of occuring if the player is awake
- and outside and the weather is SKY_LIGHTNING.

- I don't use the WAIT_STATES I put in here on my mud
- I use a stunned variable in CHAR_DATA but do whatever
- Ya want, this is really just a rough sketch for you
- to further enhance.

- The number_chance function is from Vassago's quest code I added it in db.c and use
- it quite a lot in my code:

bool number_chance(int num)
{
    if (number_range(1,100) <= num) return TRUE;
    else return FALSE;
}

- Insert the following function in update.c:
- Under Local functions add:
void    lightning       args( ( void ) );

- Any place you want put:

void lightning( void )
{
 DESCRIPTOR_DATA *d;
  for ( d = descriptor_list; d != NULL; d = d->next )
        {
            if ( d->connected == CON_PLAYING
                && IS_OUTSIDE( d->character )
                && IS_AWAKE  ( d->character )
                && number_chance(15)
                && !IS_IMMORTAL(d->character)
                && d->character->level > 17
                && weather_info.sky == SKY_LIGHTNING ) {

  send_to_char("{x{RYou see a brilliant flash come down from the sky and then black out!\n\r",d->character);
 act( "$n has been struck by lightning!", d->character, NULL, NULL,TO_ROOM );
if(check_immune(d->character,DAM_LIGHTNING) != IS_IMMUNE) {
 if(d->character->fighting) {stop_fighting(d->character,TRUE); }
if(check_immune(d->character,DAM_LIGHTNING) != IS_RESISTANT) {
 if(d->character->hit > d->character->hit /2) {d->character->hit -= d->character->hit/10; }
  WAIT_STATE(d->character,25); } else {
 if(d->character->hit > d->character->hit /2) {d->character->hit -= d->character->hit/50; }
 WAIT_STATE(d->character,10); }
if(check_immune(d->character,DAM_LIGHTNING) == IS_VULNERABLE) {
d->character->hit -= d->character->hit/2;
WAIT_STATE(d->character,40); } }
} }
}

- Under weather_update (); add:
  lightning       ( );

