Author Topic: Hunger Items  (Read 1512 times)

Hello, I was wondering if anyone has code for adding hunger from ¥ola's Food mod into the Legacy food items. So when you eat it will add hunger or hydration. Thanks!

I am Yola, all you need to do is make the object on use add to %client.hunger, and then remove the item

So like this?

Quote
function onUse(%client)
   {
   
   %NumberThing = 40;
   %additionHydration = %client.hydration + %NumberThing;
   if(%additionHydration <= $HungerMod::pref::MaxHydration)
   {
      %client.hydration = %additionHydration;
   }
   else
   {
      %client.hydration = $HungerMod::pref::MaxHydration;
   }
   
   }

onFire already removes the item.

as far as i can remember, that should do it

Alright, that didn't work. Any idea of what would :/

as far as i can remember, that should do it
Nope. Not at all.

Then what does Jess or some other scripter who knows D:

Nope. Not at all.

great explanation why it shouldn't, please don't post like this, it's not helpful at all.

It's my mod, and as far as I can remember the hydration variable is stored directly on the client, so it would be %client.hydration

he was following my method to get %additionHydration

Other than onUse maybe not being correct, I see no issues

So like this?

onFire already removes the item.
Try instead doing this in the onFire function. The parameters for onFire should be %this (The image datablock), %obj (The player the image is mounted to), and %slot (The slot the player is using). So you'll want to add a line that says %obj.client.hydration += %whatever

Thanks Pecon! It worked. Du best!