• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Resource icon

Hunger and Saturation Script 1.0

Pokémon Essentials Version
v17.2 ➖
I wrote this script as part of a small project I had an idea of, it's a simple hunger system that includes Minecraft-styled saturation
#Health System
#Hunger
Events.onStepTakenTransferPossible+=proc {
if $game_switches[52] #hunger Switch if ON you need to survive
case $game_variables[31]
when 0
$game_variables[26] -= 1 if rand(10) == 0 #take from hunger like normal
else
$game_variables[31] -= 1 if rand(10) == 0 #take from saturation
# Starve Check
case $game_variables[26]
when 0
$game_variables[26]=100
pbFadeOutIn(99999)
Kernel.pbStartOver(true)
end
end
end
}
#Eating Food
def pbPickAndEatBerry
berry=0
pbFadeOutIn(99999){
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene,$PokemonBag)
berry = screen.pbChooseItemScreen(Proc.new{|item| pbIsBerry?(item) })
}
if berry>0
$PokemonBag.pbDeleteItem(berry,1)
Kernel.pbMessage(_INTL("You cook and eat the {1}. ",PBItems.getName(berry)))
if isConst?(berry,PBItems,:ORANBERRY)
$game_variables[26]+=7
$game_variables[31]+=3
elsif isConst?(berry,PBItems,:LEPPABERRY)
$game_variables[26]+=9
$game_variables[31]+=1
elsif isConst?(berry,PBItems,:SITRUSBERRY)
$game_variables[26]+=10
$game_variables[31]+=7
elsif isConst?(berry,PBItems,:REDAPRICORN)
$game_variables[26]+=6
$game_variables[31]+=4
#You can add more if you want
else
#IDK what you just eat
$game_variables[26]+=10
$game_variables[31]+=10

#full belly
$game_variables[26]=100 if $game_variables[26]>100
end
end
end
this script makes that each step it will do a random "dice roll" that will probably decrease a variable, that is "hunger" it also adds "saturation" on top of that, you need to call pbPickAndEatBerry somewhere to eat berries to survive trough.
please say if this script has any bugs because I am not exactly a scripter this is kinda the first script I wrote?
Credits
Vendily for helping me write this script
Author
Maurili
Views
1,817
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Maurili

Back
Top