Page 1 of 1

Suggestion: Cooking.

Posted: Thu Jan 19, 2006 6:40 pm
by stranf
I have another thought/request. Hope I'm not bothering you guys or taking you away from more important UOx3 upgrades, but I had another script idea that sounds relatively feasible.

I was thinking of a way of implimenting cooking on my LAN server to increase roleplay opprotunites. Here is one idea that my fellow players and I have come up with:

1- start all PCs with a "hunger" variable of 10 (from 1 to 10)
2- Every 10 minutes the server rolls a 1d4 and drops all players hunger by that amount. (Just one dice roll to save lag time) Print a message to the screen informing you of your status if below 5. ( *you are starting to feel hungry* )

3-If the players hunger is zero (or below set to zero), then set the character to 1/4 health (if above), 1 stanima, and 1 manna point with a message *you are starving*

4-allow the player to heal and/or use potions during this time (to simulate eating grass, whatever), but every 10 minute server check, drop the health to 1/4 again unless the player has eaten.

5- allow small fruits and veggies and stuff to increase 1 hunger, while ribs/bread/etc does 2. (set the max at 10 and say *you are too full to eat right now*).


Anyway, this would force my players to carry a few apples etc. in there pack as well as stop off in taverns or bakerys. (buildings which now are useless on my server).

While such a system might be frusterating on large shards, on our 5 man max LAN shard, it owuld make for great RPing.

What are your thoughts? and how would you begin? Thanks.

Posted: Thu Jan 19, 2006 7:04 pm
by Grimson
UOX3 does already contain a "hunger" system. It's controlled with the "[hunger]" section in the uox.ini.

Posted: Thu Jan 19, 2006 7:52 pm
by stranf
Really?

What does it effect? And how do I turn it on in my ini. Currently it's obviously disable. Thanks. It'd be nice if it was already in.

is it hardcoded? Or can I fine tune it in the js?

Posted: Thu Jan 19, 2006 9:03 pm
by giwo
The hunger system is hardcoded, currently.

I believe the scale goes from 0-5, with everyone starting at 5, and when reaching 0 the user starts to loose HP. Eating food increases the hunger up to the maximum level (5).

As Xuri mentioned, this can be enabled in the uox.ini. I don't recall the exact setting, but just look for hunger settings.

Posted: Thu Jan 19, 2006 9:09 pm
by Xuri
The hunger system is by default disabled for any character with GM privileges (such as any character on the admin account), but it should be working for normal players.

HUNGERRATE is the amount of time (in seconds, I think) that passes between each time a character's hunger level (0-6, 0 being extremely hungry and 6 being fully fed) decreases.

HUNGERDMGVAL is the amount of damage taken when hungry.

Originally there were two additional settings, and I'm not sure why they're no longer used, seing as they seem to be rather crucial for controlling the hunger system. Without them, I don't know how often the hunger damage is applied, for instance - and it also seems like hunger damage is now applied to ANY hunger level below fully fed. Hrm. The missing settings:
HUNGERTHRESHOLD - what hunger level that functions as the threshold for when a character is so hungry that he/she starts taking damage.
HUNGER_DAMAGE_RATE - how often hunger damage is applied

Perhaps giwo/Maarc have further insight into whatever happened to those values.

Posted: Thu Jan 19, 2006 9:17 pm
by giwo
I removed them. :P

As for the threshold, there was no real need for it, damage begins at a hunger level of 0.

The damage is applied on every cycle (every time it checks the hunger level, if the hunger level is 0 it does damage rather than reducing the hunger level).

Posted: Thu Jan 19, 2006 9:23 pm
by stranf
Strange.... None of my PC players in UO has of yet been hungry. We try to eat and it says we are full. Odd. I wonder if I use that new posted CVS build if it will fix it. I'll go check my UOx3 ini. Maybe it's disabled for PCs?

Sounds like the hard coded system is pretty much what I wanted anyway.

Posted: Thu Jan 19, 2006 9:38 pm
by Xuri
Ah, ok giwo. Would still be nice to be able to apply how often damage occured though :P

Stranf: Check the HUNGERRATE value, if it's set to high it may be that not enough time has passed to lower the hunger levels of your players.

Posted: Thu Jan 19, 2006 9:53 pm
by Grimson
Here: viewtopic.php?p=4099#4099 you said you have given your Players GM-Power, if they still got they wo't hunger as giwo said already.

Posted: Thu Jan 19, 2006 9:57 pm
by stranf
I switched the " 'add " command (for temporarily populating the world) and the 'tele command (to get out of tight spots) to zero.

as I understood it, the accounts were still PC,

but the Add and Tele commands were lowered to PC level, and not GM.

So basically if you set the 'add script to zero, then your PCs will no longer hunger?

That's interesting. I could drop the add back to 3, but I kind of need the 'tele incase we fall through the floor. Would that be sufficent?

Posted: Thu Jan 19, 2006 10:01 pm
by Grimson
stranf wrote:So basically if you set the 'add script to zero, then your PCs will no longer hunger?
No, that has nothing to do with making a player a GM. I guess your games where simply too short for hunger to take effect. With the default settings it takes about 1 hour and 40 minutes till you drop one hunger level, with 6 levels it should take about 10 hours till you actually start loosing health because of hunger.

Posted: Thu Jan 19, 2006 10:20 pm
by stranf
I think you nailed it.

Yeah, all of us are college kids, we get on for 2 to 3 hour bouts at the most.

So I assume (my UOx computer is at home so I can't see the .ini) that HUNGERRATE is in the uo.ini file? If that's the case, I'll just edit that value to find a satisfactory hunger rate for our shorter adventures.

Sweet. If it's not, and it wouldn't be too difficult, I'd like it in the .ini for the next release. Thanks for the support as always.

Posted: Thu Jan 19, 2006 10:23 pm
by Grimson
stranf wrote:So I assume (my UOx computer is at home so I can't see the .ini) that HUNGERRATE is in the uo.ini file?
Yes.
stranf wrote:If that's the case, I'll just edit that value to find a satisfactory hunger rate for our shorter adventures.
Exactly.

Posted: Sun Jan 22, 2006 7:54 am
by stranf
Well Grimson, my hungerrate is at 75 (A LOT less then the default 6000) and I still as of yet have not eaten an apple on UO. Had the server running for 2 hours.

But if you log out and log back in, does it re-set the hunger? During that span I was using multiple characters.

here is the players account info, I don't think they are gm account:

Code: Select all

SECTION ACCOUNT 3
{
NAME stranf
PASS stranf
FLAGS 0x0
PATH ./accounts/stranf/
TIMEBAN 0x0
CONTACT unknown
CHARACTER-1 0x19e4a [Stranf]
CHARACTER-2 0xd106 [Hans]
CHARACTER-3 0xe3d5 [William]
CHARACTER-4 0x2949d [Thrain]
CHARACTER-5 0xffffffff [UNKNOWN]
CHARACTER-6 0xffffffff [UNKNOWN]
}
Maybe I should leave the server on over night and see if when I wake up my char is dead of starvation? :wink:

Posted: Sun Jan 22, 2006 2:51 pm
by Grimson
stranf wrote:Well Grimson, my hungerrate is at 75 (A LOT less then the default 6000) and I still as of yet have not eaten an apple on UO. Had the server running for 2 hours.
Ah, found a little bug. In uox3.cpp at line 1345 it says:

Code: Select all

if( mChar.GetCommandLevel() > PLAYER_CMDLEVEL && !mChar.IsDead() && !mChar.IsInvulnerable() )
So it actually checks if the player has a higher level than a normal player. The fix is:

Code: Select all

if( mChar.GetCommandLevel() == PLAYER_CMDLEVEL && !mChar.IsDead() && !mChar.IsInvulnerable() )
I'll upload a fixed version in few moments and post the link here: viewtopic.php?t=724
stranf wrote:But if you log out and log back in, does it re-set the hunger? During that span I was using multiple characters.
It doesn't reset it, but it also doesn't decrease it while you're logged out.

Posted: Mon Jan 23, 2006 3:46 am
by stranf
Thanks for spotting the bug and correcting it. Good work. I'll test it as soon as I have some free time.

Hmm...so if I read the boolean logic correctly it would only lower the hunger of a living character that is greater than a PC but is also not invulnerable. That's why not even my GMs were getting hungry. hehe.



-----------------------------

ok, I went and extracted only the new uox.exe from your zip and your hunger fix works!

The only problem I see now with the experimental version is the stacking problem, and my comerades over the internet get kicked off.

when they do, I get this error:

Code: Select all

Packed 0xBF --unhandled 0xC
or something like that. Usually every 1-5 min. or so it just disconnects you (even me playing on the same server). So if you wouldn't mind, Grimson, keep posting those ZIPs in the other thread. Pretty soon I'll get a stable one. In the mean time I'll enjoy what I got!