Affect Timer

Posted by Dace K on Sat 10 May 2003 04:40 AM — 3 posts, 16,124 views.

Canada #0
Hey. Does anybody know where the updating for affects
is located? I need to change the time for spell/skill affects from rounds (seconds) to beats. I can't find it, and it's rather annoying me. If anyone could post, I'd appreciate. Thanks.
USA #1
As per our MSN conversation:

First comment out the old timer stuff in violence_update() in fight.c:

/*
        for ( timer = ch->first_timer; timer; timer = timer_next )
        {
            timer_next = timer->next;
            if ( --timer->count <= 0 )
            {
                if ( timer->type == TIMER_DO_FUN )
                {
                    int tempsub;
                    DO_FUN *current = timer->do_fun;

                    tempsub = ch->substate;
                    ch->substate = timer->value;
                    extract_timer( ch, timer );
                    (current)( ch, "" );
                    if ( char_died(ch) )
                      break;
                    ch->substate = tempsub;
                }
                else
                  extract_timer( ch, timer );
            }
        }
*/

Add this to update.c somewhere:


void update_timers( void )
{
  DESCRIPTOR_DATA *d;
  CHAR_DATA *ch;

    for ( d = first_descriptor; d; d = d->next )
    {
            if ( d->connected == CON_PLAYING )
              ch = d->character;
            else
              continue;

      for ( timer = ch->first_timer; timer; timer = timer_next )
        {
            timer_next = timer->next;
            if ( --timer->count <= 0 )
            {
                if ( timer->type == TIMER_DO_FUN )
                {
                    int tempsub;
                    DO_FUN *current = timer->do_fun;

                    tempsub = ch->substate;
                    ch->substate = timer->value;
                    extract_timer( ch, timer );
                    (current)( ch, "" );
                    if ( char_died(ch) )
                      break;
                    ch->substate = tempsub;
                }
                else
                  extract_timer( ch, timer );
            }
        }
   }
   return;
}


then in update_handler add:


static  int     pulse_timercheck;

if ( --pulse_timercheck     <= 0 )
    {
        pulse_check      = PULSE_TIMERCHECK;
        update_timers     ( );
    }


add the PULSE_TIMERCHECK to mud.h

I whipped this up real quick, hopefully you can fill in the blanks. But this should give you control over the timers as you want.
Canada #2
Boborak 0wns. Just thought you all should know that =D.