View Full Version : Hunger bar mod

10-09-2013, 12:16 AM
I'm trying to make a mod that create a ui bar displaying the current hunger, so i can eat before starting to starve, but i can't seen to find wich stat to refere
this is what i made until now:

// Hunger bar

texture Textures/UI/gradiant_green.tga
offset 483.0 8.0 // 24.0 26.5 bal
size 100.0 10.0
color Green
stat Normal Hunger
highlightText "$$HungerBar$$\n"
entityType PlayerServer
blinkIntensity 0.5
draworder 1
canClick 1
addCommand selectPlayer
// PartiallyIgnoreWidescreenCenter 1

texture Textures/black.tga
offset 483.0 8.0 // 24.0 26.5
size 100.0 10.0
drawOrder -1.0
// PartiallyIgnoreWidescreenCenter 1

texture Textures/UI/plyrhealth_border.tga
offset 470 7.5 // 11.0 26
size 128.0 12.0
draworder 2
blocksMouse 0
// PartiallyIgnoreWidescreenCenter 1

the only place i could find that shows the hunger is when you are already starving, in the box that appear when hovering the mouse over the starving icon...
any ideas how i can move that number into a bar or a counter that always shows up?

10-09-2013, 11:11 AM
I don't think you can do a bar because you have no player stat that represents the max value.

10-09-2013, 03:49 PM
yep, i tried to use MaxHunger as maxvalue but it CtD, i think this is 'cause maxHunger isn't a player stat but a system var (the var is in the file system2 in DW),

So, i was thinking, is it possible to reference the var, MaxHunger, in the system2 file, as the max value, or maybe to create a new var, with a fixed value of 18000 (same as MaxHunger) so i can use as the max value?

I was able to use StatValue to show the Hunger in a counter with the following code, but the rapidly changing numbers are driving me crazy, so, this is why i'm trying to change this into a bar

offset 484.0 0.0 // 24.0 26.5 bal
size 100.0 10.0
color White
stat normal Hunger
entityType PlayerClient
//highlightText "$$Hunger$$\n"