Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Problem strain / tick

Problem strain / tick

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by DjNiVeK   (48 posts)  Bio
Date Fri 09 Apr 2004 04:12 PM (UTC)
Message
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
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 09 Apr 2004 10:59 PM (UTC)
Message
OK, you put it in update.c. Did you call it anywhere or just put that function there?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by DjNiVeK   (48 posts)  Bio
Date Reply #2 on Sat 10 Apr 2004 12:23 AM (UTC)
Message
Only on top of update.c. I did that because that's where the mana_gain, move_gain, etc are located aswell.
Top

Posted by Nick Gammon   Australia  (23,165 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 10 Apr 2004 12:59 AM (UTC)
Message
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

}



- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by DjNiVeK   (48 posts)  Bio
Date Reply #4 on Sat 10 Apr 2004 12:08 PM (UTC)
Message
works now :)
thanks =)
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


15,308 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.