Mental State problems at AV

Posted by Dralnu on Sun 12 Jun 2005 12:05 AM — 11 posts, 36,332 views.

USA #0
To start, I havn't touched the mental_state code, but it seems that without eating, avatars still loose their mental_state for some reason. Code follows:

case COND_FULL:
if( ch->level < LEVEL_AVATAR && ch->Class != CLASS_VAMPIRE )
{
set_char_color( AT_HUNGRY, ch );
send_to_char( "You are STARVING!\n\r", ch );
act( AT_HUNGRY, "$n is starved half to death!", ch, NULL, NULL, TO_ROOM );
if( !IS_PKILL( ch ) || number_bits( 1 ) == 0 )
worsen_mental_state( ch, 1 );
retcode = damage( ch, ch, 1, TYPE_UNDEFINED );
}
break;

case COND_THIRST:
if( ch->level < LEVEL_AVATAR && ch->Class != CLASS_VAMPIRE )
{
set_char_color( AT_THIRSTY, ch );
send_to_char( "You are DYING of THIRST!\n\r", ch );
act( AT_THIRSTY, "$n is dying of thirst!", ch, NULL, NULL, TO_ROOM );
worsen_mental_state( ch, IS_PKILL( ch ) ? 1 : 2 );
retcode = damage( ch, ch, 2, TYPE_UNDEFINED );
}
break;

case COND_BLOODTHIRST:
if( ch->level < LEVEL_AVATAR )
{
set_char_color( AT_BLOOD, ch );
send_to_char( "You are starved to feast on blood!\n\r", ch );
act( AT_BLOOD, "$n is suffering from lack of blood!", ch, NULL, NULL, TO_ROOM );
worsen_mental_state( ch, 2 );
retcode = damage( ch, ch, ch->max_hit / 20, TYPE_UNDEFINED );
}
break;

help. I don't see the problem in the code. The ch->level < Avatar seems to be right, I just don't see what could be causing the loss of mst
USA #1
Are they still getting hungry? IE, still getting those messages?
USA #2
no, its still in Score though, but they still have the mst problems
USA #3
Well then, if they aren't getting those messages, that part of the code is fine, it's elsewhere that is changing their mental state.
USA #4
I looked through the code, and that seemed like the only thing dealing with hunger and mst...
USA #5
That's basically the only thing to do with hunger, but not mentalstate at all.
USA #6
I'll check again. Might be something with fighting...
USA #7
I'm fairly certain that there's some code I've seen in fight.c someplace that lowers your mental state when you take a particularly hard hit. I forget exactly the specifics of what a "hard hit" is, but I do think that it lowers mental state during combat under some circumstances.

Maybe that's what you're having happen?
USA #8
That really HURT!

ch->pcdata->maxhit / 4

something like that I think. I looked through, and it seemed like dying also messed up your mst, but I think it is still a bug somewhere in the eat/drinking part, but I'm not certant. I'e changes the hard hit part to maxhp/3, wich at this point is only one mob who can do that (Executioner, oddly enough).
USA #9
Erm.. not exactly.

Look for calls to "worsen_mental_state" and that should answer your questions about where and how mental state is being lowered.

Hopefully that helps?
USA #10
hopefully. I'm going to check into it in a bit