[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  How to stop the need for food and water

How to stop the need for food and water

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


Posted by Rob Harper   (108 posts)  [Biography] bio
Date Thu 26 Jun 2003 06:23 AM (UTC)
Message
Hey..well as the subject says I was wondering how do I kill the need for mortals to eat and drink.
[Go to top] top

Posted by Nick Gammon   Australia  (22,982 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Thu 26 Jun 2003 07:29 AM (UTC)
Message
This was asked before, see this post:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=812

If that doesn't give enough detail, post again.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Rob Harper   (108 posts)  [Biography] bio
Date Reply #2 on Thu 26 Jun 2003 07:43 AM (UTC)
Message
...ahh thanks for the help..but do you mind leading me a little more in the right direction for hunger, and thirst...and apprearently sleep.
[Go to top] top

Posted by Nick Gammon   Australia  (22,982 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Fri 27 Jun 2003 01:06 AM (UTC)

Amended on Fri 27 Jun 2003 01:07 AM (UTC) by Nick Gammon

Message
For a start, in update.c is a function gain_condition which seems to control getting hungry, thirsty etc.:


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;

...



It appears that immortals, mobs, and unauthorised characters do not suffer from these conditions. You could simply replace the conditional test with a simple "return". ie.

Change the "if ( blah blah) return" to just "return";


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Gregar   (20 posts)  [Biography] bio
Date Reply #4 on Sun 21 Dec 2003 06:46 AM (UTC)
Message
Hunger, again. Heh

In gain_condition, I see this snippet referred to in your post Nick, but looking into it further, I also see that recovery from being drunk is included as part of gain hunger/thirst.
So, if I am reading it correctly, ending the if call at level would cease you from getting hungry, but it would also prevent you from a natural recovery from being drunk.

It kind of works both ways, removes 1 on a tick for hunger/thirst, adds 1 on the same tick to make you less drunk.

This seems to be a recurring question for Smaug as well as some time functions, but noone has laid out a clear cut answer to either. I have looked at this code fourty seven different ways, and tried many different combinations of tweaking to reach some type of balance. My best solution to it was to edit the race files to reflect thresholds for hunger/thirst by race, making them all never hungry/thirsty. The best fix for Smaug 1.4a seems to be removing all of the gain function except for drunken state gains. IE; if drunk do x, and leave out all the hunger/thirst probablities altogether.

A reminder however, is to adjust potion/pills/food/drink so they do not add to the characters stomach contents.

If anyone has come up with a better way to address this, I would sure be interested in hearing it.

Gregar
[Go to top] top

Posted by Gregar   (20 posts)  [Biography] bio
Date Reply #5 on Sun 21 Dec 2003 09:07 AM (UTC)
Message
So here's how I solved the problem completely.

In update.c find

void char_update( void )
gain_condition( ch, COND_FULL, -1 + race_table[ch->race]- >hunger_mod );

And changed it to
gain_condition( ch, COND_FULL, +2 + race_table[ch->race]->hunger_mod );

The original called for a -1 plus race mods, causing the character to get hungry, where my adjustment makes the character get full based on race mods. Similiar changes to COND_THIRST also. There are also some condition changes depending on the climate of your areas, so those need to be checked also, as long as you are showing a consistent gain, you can play with these numbers to get your desired results.

Removed the messaging for being full, sloshing stomach ect, and made our potions/pills not add to hunger and it works great. You could clean up your code by removing the calls for dying of thirst/starvation ect entirely, or leave them intact in case you decide to go back to force feeding in the future.

So, I am done with hunger/thirst, I am sure I will be back with something else soon.
[Go to top] top

Posted by halkeye   Canada  (28 posts)  [Biography] bio
Date Reply #6 on Sun 21 Dec 2003 09:11 AM (UTC)
Message
easist way.

void gain_condition( CHAR_DATA *ch, int iCond, int value )
{
if (iCond == COND_THIRST || iCond == COND_HUNGER) {
if (ch->pcdata)
{
ch->pcdata->condition[iCond] = 100;
return;
}
....


Best way would simply be to go through update.c and remove all the gain_conditions. remove the eat and drink stuff..

But if you were todo that. why would you care about the drunkness? just remove it all.



Gavin
Dark Warriors - Coder
http://darkwars.wolfpaw.net
telnet://darkwars.wolfpaw.net:4848
[Go to top] 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.


19,552 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]