The Spice of Life

The Spice of Life

16M Downloads

Weird Nutrition value

reddler97 opened this issue ยท 2 comments

commented

i am using this formula
S:food.modifier.formula= IF(count=0,food_hunger_value,food_hunger_value * ((max_history_length - count)/max_history_length))

and i get food values that i have not eaten yet that are over 100% nutritional value
ei: the delightful meal from pam's harvestcraft having 1800%

this could be my own stupidity and not a bug, but i can't figure out why it is doing that

EDIT: also i am using 255 food history

commented

food_hunger_value will vary between 1 and 20. For the result of food.modifier.formula, 1 = 100% nutritional value. So, for example, delightful meal having 1800% at a count of 0 means that it has a food_hunger_value of 18, and therefore your formula will result in 18, which really means 1800% (the result of food.modifier.formula is used as a multiplier, not as the new hunger value).

What exactly are you intending to have this formula do? You might want this instead:

(max_history_length - count)/max_history_length

That would result in:

count nutritional value
0 255/255 = 100%
1 254/255 = 99.6%
2 253/255 = 99.2%
...
5 250/255 = 98.0%
...
100 155/255 = 60.8%
...
255 0/255 = 0.0%
commented

thank you the new formula you provided is what I wanted.
I thought you had to give the formula the new food value rather than the percentage, thus me multiplying the percent by the default food value