Problem strain / tick

Posted by DjNiVeK on Fri 09 Apr 2004 04:12 PM — 5 posts, 17,587 views.

#0
Alright, what I want to do is to put strain on the muscles after using a skill, what will reduce your hp/mana (chakra)/stamina per tick when you still have strain. I put this in update.c (at least, I think it should be there :P) and well, it doesn't work, lol. It doesn't remove the hp/mana/stamina per tick or send the message.


int strain( CHAR_DATA *ch )
{
int gain;
    if ( ch->gates == 0 )
    {
        if ( ch->strain == 1 )
	{
	act( AT_FIRE, "The pain slowly goes away with one last pinch!", ch, NULL, NULL, TO_CHAR);
	act( AT_FIRE, "$n seems to be recovered", ch, NULL, NULL, TO_ROOM);
	ch->strain = ch->strain - 1;
        if( ch->move < 11 )
	   {
		gain = 5;
	   }
	   if( ch->move > 10 )
	   {
		ch->move -= 10;
	   }
	   if( ch->mana < 6 )
	   {
		gain += 5;
	   }
	   if( ch->mana > 5 )
	   {
	   	ch->mana -= 5;
	   }
           ch->hit -= 10 + gain;
           return rNONE;
       	}
	else
        if ( ch->strain == 2 || ch->strain == 3 )
	{
	act( AT_FIRE, "Your muscles really hurt!", ch, NULL, NULL, TO_CHAR);
	act( AT_FIRE, "$n staggers a bit because of the pain!", ch, NULL, NULL, TO_ROOM);
	ch->strain = ch->strain - 1;
        if( ch->move < 16 )
	   {
		gain = 7;
	   }
	   if( ch->move > 15 )
	   {
		ch->move -= 15;
	   }
	   if( ch->mana < 6 )
	   {
		gain += 7;
	   }
	   if( ch->mana > 5 )
	   {
	   	ch->mana -= 5;
	   }
           ch->hit -= 15 + gain;
	   return rNONE;
       	}
	else
        if ( ch->strain == 4 || ch->strain == 5 )
	{
	act( AT_FIRE, "You cough up some blood because of the pain!", ch, NULL, NULL, TO_CHAR);
	act( AT_FIRE, "$n coughs up some blood!", ch, NULL, NULL, TO_ROOM);
	ch->strain = ch->strain - 1;
        if( ch->move < 21 )
	   {
		gain = 10;
	   }
	   if( ch->move > 20 )
	   {
		ch->move -= 20;
	   }
	   if( ch->mana < 11 )
	   {
		gain += 10;
	   }
	   if( ch->mana > 10 )
	   {
	   	ch->mana -= 10;
	   }
           ch->hit -= 17 + gain;
	   return rNONE;
       	}
	else
        if ( ch->strain == 6 || ch->strain == 7 )
	{
	act( AT_FIRE, "The pain shoots through your body, causing you to fall!", ch, NULL, NULL, TO_CHAR);
	act( AT_FIRE, "$n falls on the ground because of the pain!", ch, NULL, NULL, TO_ROOM);
	ch->strain = ch->strain - 1;
        if( ch->move < 26 )
	   {
		gain = 15;
	   }
	   if( ch->move > 25 )
	   {
		ch->move -= 25;
	   }
	   if( ch->mana < 16 )
	   {
		gain += 15;
	   }
	   if( ch->mana > 15 )
	   {
	   	ch->mana -= 15;
	   }
           ch->hit -= 20 + gain;
	   return rNONE;
       	}
	else
        if ( ch->strain == 8 || ch->strain == 9
	  || ch->strain == 10 )
	{
	act( AT_FIRE, "Your muscles feel like they are on fire, causing you to cry out in pain!", ch, NULL, NULL, TO_CHAR);
	act( AT_FIRE, "$n cries out in pain", ch, NULL, NULL, TO_ROOM);
	ch->strain = ch->strain - 1;
        if( ch->move < 31 )
	   {
		gain = 17;
	   }
	   if( ch->move > 30 )
	   {
		ch->move -= 30;
	   }
	   if( ch->mana < 17 )
	   {
		gain += 17;
	   }
	   if( ch->mana > 16 )
	   {
	   	ch->mana -= 16;
	   }
           ch->hit -= 25 + gain;
	   return rNONE;
       	}
	else
	if ( ch->strain > 10 )
	{
	act( AT_FIRE, "Your muscles feel like they have been torn apart!", ch, NULL, NULL, TO_CHAR);
	act( AT_FIRE, "$n seems like $e is in terrible pain!", ch, NULL, NULL, TO_ROOM);
	ch->strain = ch->strain - 1;
        if( ch->move < 41 )
	   {
		gain = 20;
	   }
	   if( ch->move > 40 )
	   {
		ch->move -= 40;
	   }
	   if( ch->mana < 21 )
	   {
		gain += 15;
	   }
	   if( ch->mana > 20 )
	   {
	   	ch->mana -= 20;
	   }
           ch->hit -= 30 + gain;
	   return rNONE;
       	}
    }
    else
    if ( ch->gates == 1 )
    {	
	ch->strain += 1;
        return rNONE;
    }
    else
    if ( ch->gates == 2 )
    {
        ch->strain += 2;
	return rNONE;
    }
    else
    if ( ch->gates == 3 )
    {
	ch->strain += 3;
	return rNONE;
    }
    else
    if ( ch->gates == 4 )
    {
	ch->strain += 4;
	return rNONE;
    }
    else
    if ( ch->gates == 5 )
    {
       	ch->strain += 5;
	return rNONE;
    }
    else
    if ( ch->gates == 6 )
    {
        ch->strain += 6;
	return rNONE;
    }
    else
    if ( ch->gates == 7 )
    {
        ch->strain += 7;
	return rNONE;
    }
    return rNONE;
}


If you need to know anything else, tell me :P
Australia Forum Administrator #1
OK, you put it in update.c. Did you call it anywhere or just put that function there?
#2
Only on top of update.c. I did that because that's where the mana_gain, move_gain, etc are located aswell.
Australia Forum Administrator #3
I see. Well, functions don't just call themselves you know, you need to put in the code to call it somewhere.

In the case of the functions you mentioned (mana_gain, move_gain, etc) they are all called from char_update, so that would be a logical place to call your new routine.



if ( ch->position >= POS_STUNNED )
{
    if ( ch->hit  < ch->max_hit )
        ch->hit  += hit_gain(ch);

    if ( ch->mana < ch->max_mana )
        ch->mana += mana_gain(ch);

    if ( ch->move < ch->max_move )
        ch->move += move_gain(ch);

// here, perhaps

}


#4
works now :)
thanks =)