Thirst/hunger is gone

Posted by Taebryn on Fri 20 Feb 2004 04:04 AM — 20 posts, 69,841 views.

#0
it hasn't worked since i added new races and classes
i have tried changing hunger_mod 0, and thirst_mod 0, but no success

any ideas?
#1
hello
somebody help!
Canada #2
no one responded because you didn't really supply enough information. What did you change? What have you done to try to fix it? Are there error messages? We need these things to help you.
#3
no error messages, just your hungry and your thirsty never appears
and shops cant sell anything edible
i dont get it

i only added new races and classes
Canada #4
That does make no sense at all. I would recommend reading Nick's GDB guide, adding a break point in do_list, and see why its not being displayed.
Australia #5
I havent gotten to making races and stuff yet but dont the race files have a hunger modifyer or something like that? if so you might have left it out and its defaulted to never hungry at all. Take a look at a standard race file and check those values.
Amended on Sun 22 Feb 2004 09:50 AM by Robert Powell
#6
as in my original message, i have tried changing hunger_mod 0, and thirst_mod 0, but no success
Canada #7
perhaps try setting the modifiers at something other than 0? I don't know how smaug hunger works, but it may be that at 0 modifier, they don't need food. You can also check other races to confirm/disprove this idea.
#8
i ran default smaug 1.4a again, and notice that thirst/hunger doesn't work with it either
what's the deal?

smaug had thirst/hunger didn't it?
#9
even on ROM, thirst and hunger arent working..
Australia Forum Administrator #10
Hang on, slow down. Thirst and hunger are standard in SMAUG. You need to think about what you are doing here. Are you playing an immortal? You probably are, as you are building, making shops and so on. Immortals don't get hungry or thirsty. They *are* immortal, after all. :)

Here is how to find out for sure ...

One of the messages you get when you are hungry is:


You are a mite peckish.


Do a search for "peckish" and you find it in one place, update.c around line 546.

Now edit that file, find that line, and scroll backwards to the start of the function ...


void gain_condition( CHAR_DATA *ch, int iCond, int value )
{
    int condition;
    ch_ret retcode = rNONE;

    if ( value == 0 || IS_NPC(ch) || ch->level >= LEVEL_IMMORTAL || NOT_AUTHED(ch))
        return;


Aha! The following do not get hungry, thirsty etc...

  • NPCs (mobs)
  • Immortals
  • Players who have not yet been authorised (there is no food for them to buy).


I suggest you make a "test" character that is not an immortal for testing things like this.
#11
i think this is the solution!
pray thanks to Nick Gammon!!!!
it was AUTHORIZATION!

i dont know what it is, BUt thats why people cant buy food items, etc!!

how do i auth people?
and can i make it automatic
#12
ok i waitforauth was already at 0
so im trying to fix up the part of the code where it decides to place a player in school or start

so i am going to change
SET_BIT(ch->pcdata->flags, PCFLAG_UNAUTHED);

to
REMOVE_BIT(ch->pcdata->flags, PCFLAG_UNAUTHED);

and see if that works
#13
ive turned the waitforauth to 0
ive changed SET_BIT (auths) to REMOVE_BIT (auths)
ive commented out all the do_ commands that had if Notauth then

and still, my players cant get hungry/thirsty or buy food!

im gonna go insane
#14
ok well i am now seeing hunger messages
i just need to figure out why mobs cant sell edibles or drinkables
#15
it seems only hunger is working now, not thirst
#16
to remove the auth for gaining conditions, i did so:

void gain_condition( CHAR_DATA *ch, int iCond, int value )
{
int condition;
ch_ret retcode = rNONE;

if ( value == 0 || IS_NPC(ch) || ch->level >= LEVEL_IMMORTAL/* || NOT_AUTHED(ch)*/)
return;


(commenting out the NOT_AUTHED part)

it appears after a few hours of testing, that my players now have hunger, but not thirst

this is the gain condition void for all conditions, so why isn't thirst working?

here is what my case COND_THIRST looks like:

case COND_THIRST:
if ( ch->level < LEVEL_AVATAR && ch->class != CLASS_VAMPIRE )
{
set_char_color( AT_THIRSTY, ch );
send_to_char( "You are really thirsty.\n\r", ch );
worsen_mental_state( ch, 1 );
act( AT_THIRSTY, "$n looks a little parched.", ch, NULL, NULL, TO_ROOM);
}
break;


this is in update.c around line 478

what am i missing
Australia Forum Administrator #17
The issue here is also whether the thirst is increasing (or decreasing) - the part you posted just reports when it is low.

I cannot see anything wrong, and in stock SMAUG you get thirsty, it happens to me all the time.

Is your character an imm, or not? What sort of sector are you in? City or what?

What you need to do is put a breakpoint on gain_condition, and see what is happening to the thirst level.

Here is one approach. I used gdb, and put a breakpoint on gain_condition, and then added a small script to see what was happening to it (was it going up or down?). I note the thirst is gradually going down (ie. he is getting thirsty) however it is quite slow. You might need to be patient to get the thirst message. I put in a "bt" into the script to see where the gain_condition was called from.

I typed this:


break gain_condition if iCond == 2
commands
 silent
 printf "Gain condition for character %s, amount %i\n", ch->name, value
 printf "  -- current condition is %i\n",  ch->pcdata->condition[iCond]
 bt
 cont
 end



Output


Gain condition for character Nick, amount -1
-- current condition is 44
#0 gain_condition(char_data*, int, int) (ch=0x852b830, iCond=2, value=-1)
at update.c:396
#1 0x0811ae39 in char_update() () at update.c:1076
#2 0x0811c956 in update_handler() () at update.c:2037
#3 0x08098eb5 in game_loop() () at comm.c:735
#4 0x08098613 in main (argc=1, argv=0xbfffe240) at comm.c:304
#5 0x420156a4 in __libc_start_main () from /lib/tls/libc.so.6
Gain condition for character Nick, amount -1
-- current condition is 43
#0 gain_condition(char_data*, int, int) (ch=0x852b830, iCond=2, value=-1)
at update.c:396
#1 0x0811ae39 in char_update() () at update.c:1076
#2 0x0811c956 in update_handler() () at update.c:2037
#3 0x08098eb5 in game_loop() () at comm.c:735
#4 0x08098613 in main (argc=1, argv=0xbfffe240) at comm.c:304
#5 0x420156a4 in __libc_start_main () from /lib/tls/libc.so.6
Gain condition for character Nick, amount -1
-- current condition is 42
#0 gain_condition(char_data*, int, int) (ch=0x852b830, iCond=2, value=-1)
at update.c:396
#1 0x0811ae39 in char_update() () at update.c:1076
#2 0x0811c956 in update_handler() () at update.c:2037
#3 0x08098eb5 in game_loop() () at comm.c:735
#4 0x08098613 in main (argc=1, argv=0xbfffe240) at comm.c:304
#5 0x420156a4 in __libc_start_main () from /lib/tls/libc.so.6
Gain condition for character Nick, amount -1
-- current condition is 41


I would do something like that to see if the condition is changing, is it going up or down, and why.

In about 10 minutes he only went from 44 to 41, so he won't be thirsty for quite a while yet.
Amended on Wed 25 Feb 2004 09:31 PM by Nick Gammon
USA #18
Also, make sure the items they are selling *ARE* food. So, say you had an item named bread. Make sure you do:

oset bread type food
oset bread value0 10

That should be alright, I think. Then again, you may have done this already. Just something to be aware of.
#19
both are working fine, and apparently always were
it seems it just takes a really long time to gain condition