Gw Temp

Menu

Tutorial - 'Hunger Meter' by SirUltimos

An item about RPGMaker 2000 posted on

Blurb

SirUltimos writes a tutorial outlining two ways to add a hunger system to your game (to make it more realistic).

Body

Hunger System Tutorial by Sir Ultimos

In how many RPG's do you see characters that need to eat to live? Not many. How many real people do you know that need to eat to live? Probably quite a few.

In this tutorial I hope to show you how to make a hunger system so that your characters must eat, just like real people, and get weaker if they haven't eaten for a while. For the weakening part, I will show you two ways to do it.

Part 1: The Hunger Meter

To start with, you are going to need 10 pictures, each one representing a different stage of hunger (this will be your hunger bar). Make one picture with the bar full, one with it slightly less than full, one less than that, etc. Be sure to name each picture so that you can easily figure out which picture is which. Also, you will need to create several variables.

Now that we have our pictures, let's create a common event. Name this common event 'Hunger Meter Timer' or something similar. Make this common event a parallel process, and have it set a fork condition so that if the timer (Timer 1, for you 2K3 people) is below one second is completes the actions described below.

Set Timer for 5 minutes (This is how long it will take for out hero to get hungrier)
Decrease 'Hunger' variable by 1.
Start Timer (Don't make the timer visible)

<>Branch if Timer is 0M 01S Less Equal
<>Timer 1 Operation: Set, 5M 00S
<>Variable Oper: [xxxx:Hunger] - 1
<>Timer 1 Oper: Start
<>
: End

This common event should look like the code above.

Next, we need to make the hero able to starve to death, don't we? We also need to display how hungry the hero is so that the player can see it.

Create another common event and name it appropriatly. This event is also a parallel process. Make this event have several fork conditions so that it will display the different pictures you made. If the 'Hunger' variable is at 10, make it display the full bar (as a picture) in the corner of the screen (or at whichever screen position you wish). If the variable is at 9, make it display the marginally empty bar, and continue on in this fashion until you get to the fork where the variable is 0 and the bar is empty. Also, when the variable is 0, call a Game Over command (to simulate the hero starving to death.) Note: Make all these pictures the same number so that the new one will overwrite the the older one.

The last thing we need is for the player to be able to feed thier hero. To do this, make an item that will turn on a switch for a common event. In the event that is called make it add to the 'Hunger' variable. How much to add depends upon the item. Be sure to also make a fork condition so that if the 'Hunger' variable goes over 10 it is set equal to 10. It would also be beneficial so that if the variable is already at 10 it displays a message that tells the player the hero is full. The code for an apple is displayed below.

<>Branch if Var [xxxx:Hunger] is 10
<>Message: The hero is full!
<>Switch Oper [xxxx:Apple] OFF
: End
<>Variable Oper [xxxx:Hunger] + 1
<>Change Items: Apple 1 Remove
<>Branch if Var [xxxx:Hunger] is 10
<>Variable Oper [xxxx:Hunger] Set 10
: End
<>Switch Oper [xxxx:Apple] OFF

Be sure to make many different types of food that recover different amounts of hunger!

Part 2: The Weakening

So you have a hunger meter, and the hero can die from lack of food, now it's time to make the hero weaker as they get hungrier!

Method 1: Multiing

For this method of making the hero weaker, you will need to create a duplicate of every one of your party members. Make these duplicate characters have the same name, but at each level make thier stats slightly lower than the 'real' hero. Then, in the common event that displays the hunger meter, make it so that at a certain hunger level (3 would be good) it switches out the normal heros to these weaker heros. Be sure to make it that at every level above 3 it switches the heros back to thier normal state. You should also make a fork condition at every level so that if the heroes are already switched it doesn't do it again.

You will also need to make a common event so that each time your normal heroes level up the weaker heroes will level up.

Method 2: Variable-licious

With this method you will need two variable for each stat for every party member. Make a common event so that on level up each of the heroes stats (make sure you choose Max HP and Max MP) will be recorded in a variable. As for the second variable, make it equal to the stat variables minus whatever number you wish (this number will determine how much weaker your heroes will be). At level 3 and every level below it, make the heroes stats equal to the second variables. At every level above 3, make the heroes stats equal to the first variables (thier real stats). You will also want to make fork conditions at each level so it only performs this operation once.

The advantages to this method are that you will not clutter up your hero database and it is much easier to make your heroes get weaker at different levels of hunger, instead of just 1 (of course, you will nedd a few more variables for this, but it's still easier than making that many more heroes).


I hope you learned something from this tutorial and that you could understand my writing. Any questions, comments, concerns or derogatory comments against me and/or my mother can be emailed to sirultimos@gmail.com



And until next time, I wish all the little people out there a charming Rhamadan!