# Hunger Drain Rate?

## Recommended Posts

I am fairly sure it is this inst.components.hunger:SetRate(rate) however, I am confused on one thing, if I set it to 1, it drains incredibly fast and at 10 points per drain I believe, if I wanted it to be 3 times as fast as normal, would it not be 0.3 or would it be 3? If I set it to 3 it still drains insanely fast, way faster than wolfgang does in his mighty state.

##### Share on other sites

tuning.lua contains:

`local seg_time = 30local total_day_time = seg_time*16...local calories_per_day = 75...WILSON_HUNGER_RATE = calories_per_day/total_day_time, --calories burnt per day...WOLFGANG_HUNGER_RATE_MULT_MIGHTY = 3,WOLFGANG_HUNGER_RATE_MULT_NORMAL = 1.5,WOLFGANG_HUNGER_RATE_MULT_WIMPY = 1,`

And wolfgang.lua:

`local hunger_rate = TUNING.WOLFGANG_HUNGER_RATE_MULT_NORMAL...inst.components.hunger:SetRate(hunger_rate*TUNING.WILSON_HUNGER_RATE)`

Doing the math:

seg_time = 30
total_day_time = seg_time*16 = 480
calories_per_day = 75

hunger_rate = TUNING.WOLFGANG_HUNGER_RATE_MULT_NORMAL = 1.5
TUNING.WILSON_HUNGER_RATE = calories_per_day/total_day_time = 75/480 = 0.15625

normal_rate = hunger_rate*TUNING.WILSON_HUNGER_RATE = 1.5 * 0.15625 = 0.234375

If you want 3*normal_rate of wolfgang, that would be 0.703125

But it would be better if you didn't hard-code the number. Make it a variable as it's done for the other characters.
Use TUNING.WILSON_HUNGER_RATE * 3 to get 3 times the normal rate of wilson.

`GLOBAL.TUNING.YOUR_CHARACTER_HUNGER_RATE = TUNING.WILSON_HUNGER_RATE * 3-- ...-- Somewhere inside your create fn, ideallyinst.components.hunger:SetRate(GLOBAL.TUNING.YOUR_CHARACTER_HUNGER_RATE)`

##### Share on other sites

tuning.lua contains:

`local seg_time = 30local total_day_time = seg_time*16...local calories_per_day = 75...WILSON_HUNGER_RATE = calories_per_day/total_day_time, --calories burnt per day...WOLFGANG_HUNGER_RATE_MULT_MIGHTY = 3,WOLFGANG_HUNGER_RATE_MULT_NORMAL = 1.5,WOLFGANG_HUNGER_RATE_MULT_WIMPY = 1,`

And wolfgang.lua:

`local hunger_rate = TUNING.WOLFGANG_HUNGER_RATE_MULT_NORMAL...inst.components.hunger:SetRate(hunger_rate*TUNING.WILSON_HUNGER_RATE)`

Doing the math:

seg_time = 30
total_day_time = seg_time*16 = 480
calories_per_day = 75

hunger_rate = TUNING.WOLFGANG_HUNGER_RATE_MULT_NORMAL = 1.5
TUNING.WILSON_HUNGER_RATE = calories_per_day/total_day_time = 75/480 = 0.15625

normal_rate = hunger_rate*TUNING.WILSON_HUNGER_RATE = 1.5 * 0.15625 = 0.234375

If you want 3*normal_rate of wolfgang, that would be 0.703125

But it would be better if you didn't hard-code the number. Make it a variable as it's done for the other characters.
Use TUNING.WILSON_HUNGER_RATE * 3 to get 3 times the normal rate of wilson.

`GLOBAL.TUNING.YOUR_CHARACTER_HUNGER_RATE = TUNING.WILSON_HUNGER_RATE * 3-- ...-- Somewhere inside your create fn, ideallyinst.components.hunger:SetRate(GLOBAL.TUNING.YOUR_CHARACTER_HUNGER_RATE)`

Wow! Thank you so much! I will go ahead and test the tuning.wilson and see what that turns up!

EDIT: Well then, It appears I owe you one. It works amazingly! Thank you so much!

##### Share on other sites

Er, one last question, where exactly is tuning.lua getting its information from? if wilsons TUNING.WILSON_HUNGERRATE = 1 where is the number one located, specifically where is it getting the math for it from or the code for that from?

EDIT: Oh, sorry for doubleposting, meant to hit edit, also I found it, nevermind

WILSON_HUNGER_RATE = calories_per_day/total_day_time, --calories burnt per day

##### Share on other sites

@bigpak, no prob!

All the lua files are located in your game folder.

Default locations, if you haven't changed it yourself:

Steam/Windows: C:\Program Files (x86)\Steam\SteamApps\common\dont_starve\
Standalone/Windows: C:\Program Files\dontstarve\mods
Standalone/Mac: /Applications/Don't Starve/Don't Starve.app/Contents/

"..\scripts\tuning.lua"

"..\scripts\prefabs\wolfgang.lua"

Other characters are also in "..\scripts\prefabs" with corresponding names. (playable maxwell is named waxwell)

Edit: Sorry, misunderstood your question. If there's a variable being used in any file, just use ctrl+f and search it. Usually you'll find it declared in the same file.