I have a great idea to make all food heal when eatin just not sure 100% where i would go to start this or really how so just looking for some newb guidance if at all possible thank you all in advance!
 
In Food.cs
See how it handles stamina. [Health would be Hits]
Code:
public static bool FillHunger(Mobile from, int fillFactor)
        {
            if (from.Hunger >= 20)
            {
                from.SendLocalizedMessage(500867); // You are simply too full to eat any more!
                return false;
            }

            int iHunger = from.Hunger + fillFactor;

            if (from.Stam < from.StamMax)
                from.Stam += Utility.Random(6, 3) + fillFactor / 5;

            if (iHunger >= 20)
            {
                from.Hunger = 20;
                from.SendLocalizedMessage(500872); // You manage to eat the food, but you are stuffed!
            }
            else
            {
                from.Hunger = iHunger;

                if (iHunger < 5)
                    from.SendLocalizedMessage(500868); // You eat the food, but are still extremely hungry.
                else if (iHunger < 10)
                    from.SendLocalizedMessage(500869); // You eat the food, and begin to feel more satiated.
                else if (iHunger < 15)
                    from.SendLocalizedMessage(500870); // After eating the food, you feel much less hungry.
                else
                    from.SendLocalizedMessage(500871); // You feel quite full after consuming the food.
            }

            return true;
        }
 
Last edited:
In Food.cs
See how it handles stamina. [Health would be Hits]
Code:
public static bool FillHunger(Mobile from, int fillFactor)
        {
            if (from.Hunger >= 20)
            {
                from.SendLocalizedMessage(500867); // You are simply too full to eat any more!
                return false;
            }

            int iHunger = from.Hunger + fillFactor;

            if (from.Stam < from.StamMax)
                from.Stam += Utility.Random(6, 3) + fillFactor / 5;

            if (iHunger >= 20)
            {
                from.Hunger = 20;
                from.SendLocalizedMessage(500872); // You manage to eat the food, but you are stuffed!
            }
            else
            {
                from.Hunger = iHunger;

                if (iHunger < 5)
                    from.SendLocalizedMessage(500868); // You eat the food, but are still extremely hungry.
                else if (iHunger < 10)
                    from.SendLocalizedMessage(500869); // You eat the food, and begin to feel more satiated.
                else if (iHunger < 15)
                    from.SendLocalizedMessage(500870); // After eating the food, you feel much less hungry.
                else
                    from.SendLocalizedMessage(500871); // You feel quite full after consuming the food.
            }

            return true;
        }

thank you so vary much going to give some code a shot and see what i can't do.
Post automatically merged:

In Food.cs
See how it handles stamina. [Health would be Hits]
Code:
public static bool FillHunger(Mobile from, int fillFactor)
        {
            if (from.Hunger >= 20)
            {
                from.SendLocalizedMessage(500867); // You are simply too full to eat any more!
                return false;
            }

            int iHunger = from.Hunger + fillFactor;

            if (from.Stam < from.StamMax)
                from.Stam += Utility.Random(6, 3) + fillFactor / 5;

            if (iHunger >= 20)
            {
                from.Hunger = 20;
                from.SendLocalizedMessage(500872); // You manage to eat the food, but you are stuffed!
            }
            else
            {
                from.Hunger = iHunger;

                if (iHunger < 5)
                    from.SendLocalizedMessage(500868); // You eat the food, but are still extremely hungry.
                else if (iHunger < 10)
                    from.SendLocalizedMessage(500869); // You eat the food, and begin to feel more satiated.
                else if (iHunger < 15)
                    from.SendLocalizedMessage(500870); // After eating the food, you feel much less hungry.
                else
                    from.SendLocalizedMessage(500871); // You feel quite full after consuming the food.
            }

            return true;
        }


from.Stam += What does this control?
Utility.Random(6, 3) + guessing here but this controls the healing factor per say if it was put in as hits?
fillFactor / 5; this would control how much it puts into your fill factor?

Just trying to learn as much as i can of this so sorry if i am asking to many questions.
Not trying to be a Nagy person.
 
Last edited:
It creates a random number [between 6 and 3] and then adds the fill factor. Bread Loaf has a fill factor of 3 where cooked bird is 5 (more fill factor = more bonus). If you roll a random number of 5 and you ate bread [fill factor 3] it would restore 8 stamina/health.

The fill factor max or Hunger is 20 (this caps food items affect on stamina or in the case of Hits.
Code:
 if (from.Hunger >= 20)
            {
                from.SendLocalizedMessage(500867); // You are simply too full to eat any more!
                return false;
            }

 
Thank you so much for taking the time to explain how the math and values work! I feel like i can understand alot more when it comes to some of the codes math!

Now if i can figure out how to edit pvm damage to curve the tamer gap that OSI has made uo today haha.

I am not trying to make any public server i do not have the code ability haha. Just one for me and a group of friends to play on and relive the old days of being young adults again haha.

Plus i said hell why not learn code so i know how all this works figure out all the ins and outs and the what you can do and can't does!
Post automatically merged:

Another question if i wanted to raise the hunger amount what script would i find that cap in?

I looked around food but didn't see it i could have missed it knowing my blind eyes at times.
 
Last edited:
Everything is found in Food.cs, however, be cautious how much you increase it. Since potions have a delay timer between uses, so do bandages and considering casting delays for spells, you could unbalance the game. Also food doesn't require a free hand to use like potions or spell casting and you can't be interrupted while eating. ;) I wouldn't remove the cap, consider all the mechanics at work that I mentioned...
 
Last edited:
Everything is found in Food.cs, however, be cautious how much you increase it. Since potions have a delay timer between uses, so do bandages and considering casting delays for spells, you could unbalance the game. Also food doesn't require a free hand to use like potions or spell casting and you can't be interrupted while eating. ;) I wouldn't remove the cap, consider all the mechanics at work that I mentioned...

Now that you pointed out that makes me second guess my thinking pattern...
 
Back