Resource icon

Hunger and Saturation Script

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
488
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Maurili

Top