How to make a hunger script?

I want to make a script that would make regen of health go down ONLY if hunger attribute is 0 or less, i dunno how! Help me!!! NOWW!!!

2 Likes

have not tested this but maybe make a script (in entity scripts) every second if hunger of (this entity) == 100 (or 0 depending if you want to make it kill you if it reaches max) then set health of (this entity) to health of (this entity) - (number here) the number could be 1 2 3 4 5 or 25 depending how fast you want do die

2 Likes

oh yeah i forgot you can make hunger go up by setting regen speed on player hunger attribute (set it to something low because it goes to 100 / the max really fast)

2 Likes

if hunger == 0 ( if attribute is 0 trigger)
then set attribute regen of hp == -1

2 Likes