じ☆ve冰风 发表于 2026-7-12 13:00:16

Hunger, Thirst, Sleepsystem without Scripting

Auf Deutsch bitte:
http://www.youtube.com/playlist?list=PLl1I2bD1AHDVtcwPU13xe4odZP6UTa6g_
 
Difficulty:
http://cleos683.files.wordpress.com/2012/12/schwierigkeitsgrad4.png?w=645

 
In this Tutorial I’ll show you how to make the HUD for my Hunger, Thirst, Sleepsystem:
For beginners this tutorial could be a bit difficult to understand, because of that you should have used the maker for a while and be familiar with variables, switches and pictures.
You can use this tutorial for each maker from Enterbrain. The event commands are the same or similar.
The first thing you’ll do is open your grafic program (in my case Photoshop) and open a new document with the measurements of one screen of your RPG maker in my case 544 x 418 pixel:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-02_22h06m24s_004_neu.png?w=645
Then you’ll make a rectangle in the upper left corner and fill it with any colour:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-02_22h08m05s_005_.png?w=300&h=230
After that you’ll fill the rectangle with a pattern that you like (right click on the square and choose fill space):
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-02_22h08m45s_006_flc3a4che-fc3bcllen.png?w=645http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-02_22h10m53s_009_.png?w=150&h=114
If you like you can make a relief (right click on the layer and choose Filloptions):
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-02_22h09m27s_007_ebenenstil.png?w=645
Then you’ll take your rubber tool and erase the place for the bars. You can hold Shift for straight lines:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-02_22h10m11s_008_.png?w=645
They should beginn and end at the beginning and ending of the 32 pixel squares of the maker.
Then make a new layer and draw the bars. They should be as long as the places you made before. In my case 5 fields = 160 pixel. That’s important for later.
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-02_22h15m06s_015_.png?w=300&h=229
Make each bar on a new layer. You can give them beautifull colors with the the gradient in the filloptions:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-02_22h14m25s_014_ebenenstil.png?w=645&h=422
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-02_22h11m48s_011_.png?w=300&h=229
Make sure that each bar is on a separate layer.
Now you should place some Icons on the HUD. I took them from the custom VX Ace icon set.
 
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-02_22h13m53s_013_.png?w=645
 
Load it in your graphic program and copy and past it on your HUD
Now save the HUD, and the three single bars separately as a PNG. You can save it directly in your game’s picture folder.
 
The first thing you should do is to import your HUD and your bars in your maker with the resource manager if you didn’t save it already in your pictures folder:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h45m31s_038_resource-manager.png?w=645
First of all we need to make a common event with the following settings: We’ll call this common event later.
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_20h58m22s_002_.png?w=645
Now we will set the Predefinitions for our system: the first thing we’ll set are the maximum deficits:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_20h57m04s_001_control-variables.png?w=645 Why -160? You remember that our bars are 160 pixels long. If our bars are full the picture is set to position X:0 and Y: 0 If the bars are empty then they must be 160 pixel more left. The left part of our coordinate system is minus. Because of that -160.
Repeat that for thirst and sleep:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_20h58m51s_003_.png?w=645
Because we want to behave the three bars differently we need to set three more variables for the steps (for hunger, thirst and sleep).
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h01m05s_004_control-variables.png?w=645Repeat that for thirst and sleep.
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h02m04s_005_.png?w=645
Now we can put in our grafics. Important is that the higher the picture number the higher is the layer of the picture. Because of that we need to put the HUD of the upper most layer (in this case 4):
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h06m51s_006_show-picture.png?w=645With the position X:0 and Y:0 the pictures will be in the upper left corner. Repeat that for the other three pictures. Remember to give each of them a new number. The HUD picture must have the highest number.
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h07m33s_007_.png?w=645
The first common event is now finished. And we can move on with the second with the following settings:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h39m34s_033_.png?w=645
Now we have to setup how our bars will behave. With each step the hunger, thirst and sleep needs will increase. Because of that we set the variable difference hunger on the value of the steps:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h10m26s_008_control-variables.png?w=645http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_22h14m30s_039_game-data.png?w=645
Of that variable we must subtract the steps the player has made:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h11m13s_009_control-variables.png?w=645
Because each bar should behave different we’ll devide the variable through a different figure for hunger, thirst and sleep. (in this case 4)
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h11m29s_010_control-variables.png?w=645
Our system needs to have the variable fixed in another variable because of that we’ll create the variable Hunger2. Otherwise our system won’t work properly.
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h17m18s_011_control-variables.png?w=645
In this step we will subtract the variable Difference hunger of the variable Hunger:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h17m29s_012_control-variables.png?w=645
Now it should look like so:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h17m56s_013_.png?w=645
Repeat that for thirst and sleep.
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h19m16s_014_.png?w=645http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h19m31s_015_.png?w=645
Remember to divide the through different numbers.
Now our pictures should be able to move so we can setup this:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h24m22s_018_move-picture.png?w=645 We name a variable Y for the Y value. Because it will be 0 there is now need to give that variable a value. You can only name it and put it in for the Y value. Repeat that for thirst and sleep as well:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h22m02s_017_.png?w=645
Now we need to ensure that the varables won’t exeed their limit (upper and under):
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h28m42s_020_conditional-branch.png?w=645
Now click the free line inside the conditonal branch an insert the following:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h28m50s_021_control-variables.png?w=645
Repieat that for thirst and sleep.
Now we make this conditional branch again for the lower part:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h30m56s_022_conditional-branch.png?w=645
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h31m07s_023_control-variables.png?w=645
Repeat that again for thirst and sleep.
This should look like so.
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h31m55s_024_.png?w=645
Now we are nearly finished with the second common event. We only need to tell the maker what should happen when the bar is empty (in our case -160 our deficite max.)
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h35m02s_025_conditional-branch.png?w=645 If our hunger is less or equal to our deficite maximum we’ll die.
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_22h37m03s_041_.png?w=645
If you like you can insert a message, this message should be above the Game Over command.
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h35m14s_026_show-text.png?w=645
Repeat that for thirst and sleep:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h37m43s_027_.png?w=645
And that’s it for this common event. Now we have only left to activate the switch no. 1 and to call our predefinition common event.
Make on the map where you like to start the hunger thirst and sleep system a new event: on the first page:
Set this page on autorun.
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h38m08s_028_control-switches.png?w=321&h=240
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h38m21s_029_call-common-event.png?w=301&h=111
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h38m33s_030_control-self-switch.png?w=301&h=162 This self switch switches to the secon page.
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h38m56s_031_edit-event-id-001.png?w=645&h=522http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-03_21h39m06s_032_edit-event-id-001.png?w=645&h=522This page must have the trigger of Action button and as a condition the self switch A.
Now our Hud will function.
But we still need items to refill our storage.
 
First you need to create a new item. Go in your database on the tab Items. In this example I’ll make a small water bottle which decreases thirst about 50%. It’s nearly exact the same for hunger, thirst and sleep. Let’s start:http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-08_18h51m46s_012_database.png?w=645&h=516We’ll create the common event later.
Name the item as you wish (in my case “little water bottle”) and select an icon (doubleclick on the field the window with the icons will open. Select the one you wish and click OK.). Then give it a description like: “decreases thirst about 50%”. Item type is normal, give it a price as you like. It should be consumable – so set the consume to yes. Scope must be none and Occasion should be on always – except you wish it different. In the part of Invocation you need to do nothing as well as in Damage.
But we need to insert a common event in Effects: Now we’ll create this common event:
Switch to the tab Common Event in your Database and do the following: Name the common event as you wish and let the Trigger on “None”. Set the variable Steps thirst to the amount of steps.
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-08_18h40m11s_005_control-variables.png?w=645
Then increase the variable Thirst about the half (in this case 80 (160 / 2 = 80)) Please remember that our bars are 160 pixel long.
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-08_18h40m24s_006_control-variables.png?w=645
Now we need a conditional branch to check if the variable thirst is greater than 0 to ensure that the number never exceeds the 0. Otherwise our system woudn’t work anymore.
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-08_18h40m57s_008_conditional-branch.png?w=645Uncheck “Set handling when conditions do not apply” (the else case).
In that conditional branch you have to insert that the variable Thirst is set to 0, if the condition is true:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-08_18h41m11s_009_control-variables.png?w=645
Under the conditional branch you have to set the variable Thirst2 to the value of variable thirst,to ensure that the bar won’t go every time full again.
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-08_18h43m45s_010_control-variables.png?w=645
And that’s it for this common event:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-08_18h39m28s_004_database.png?w=645&h=516
Now we can call this common event in the items. Go back to the tab Items and doubleclick in the effects part  under “Kind” to open the following window:
http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-08_18h44m02s_011_effects.png?w=645
Switch to the last tab “Others” and put in the common event we’ve created before.
 
.
Now you can build in the items in your game. You’ll need for each item an common event except 2 or more items do exactly the same. Here’s an example for bread.  http://cleos683.files.wordpress.com/2012/12/ashampoo_snap_2012-12-08_19h13m59s_013_.png?w=645
 
It’s the same for sleep with the according variables and common events.


本贴来自国际rpgmaker官方论坛作者:Nefertari83处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/hunger-thirst-sleepsystem-without-scripting.11073/
页: [1]
查看完整版本: Hunger, Thirst, Sleepsystem without Scripting