Hunger with Huds
Compatibility: Just RMVxACE
How to use: paste it in the scripts sections
Resume:Set the time to increase hunger;
Set value that hunger increases for each actors;
Create items that reduce or increase hunger;
Hud for all Characters (Actors);
Hud simple and small to not pollute the screen;
Character dies when hunger reaches 100.
Screens
Huds in Screen(Last Actor died)
Increased Hunger, Hunger Current(Translated)
Script
CODE
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Hunger for Actors
#|Autor: RD12|
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# The hunger will 0-100.
# If fome arrive in 100, the actor dies
#
# For an item decreases hunger, insert in your Nota: -huger value
# Increases: +huger value
module Fome
#Time that decreases hunger
Segundos = 5
#Value that will increase the hunger
Actor = []#Var Initialization
Actor[0] = 9 #First Actor
Actor[1] = 6 #Second
Actor[2] = 4 #Third
Actor[3] = 11#Fourth
#Actor[4] = 11#Fifth
#Hud Position
HUDs_x = 1
HUDs_y = 190
end
#===============================================================================
#Hud da fome dos jogadores
class Hud_Fome < Sprite
def initialize
super
self.bitmap = bitmap = Bitmap.new(100,300)
self.bitmap.font.size = 14
self.bitmap.font.name = "Segoe UI"
self.x = Fome::HUDs_x
self.y = Fome::HUDs_y
refresh
end
def update
super
refresh
end
def refresh
self.bitmap.clear
for i in 0..$game_party.members.size-1
@actor = $game_party.members
base = Cache.picture("Fome_Base")
rect = Rect.new(0,0,base.width,base.height)
self.bitmap.blt(10,21+30*i,base,rect)
self.bitmap.draw_text(10, 30*i, 100, 32, @actor[i].name, 0)
if @actor[i].fome >= 100
@actor[i].hp = 0
hud_name = "Fome_100"
else
hud_name = "Fome_Hud"
end
base = Cache.picture(hud_name)
rect = Rect.new(0,0,base.width * @actor[i].fome / 100,base.height)
self.bitmap.blt(10,21+30*i,base,rect)
end
end
end
#===============================================================================
#Atualiza a Hud e Aumenta a fome de acordo com o tempo configurado
class Scene_Map
alias rd12_main main
def main
$Fome = Hud_Fome.new
@segundos = 0
rd12_main
$Fome.dispose
end
alias rd12_update update
def update
if Graphics.frame_count % 60 == 0
@segundos += 1
end
if @segundos == Fome::Segundos
for i in 0..$game_party.members.size-1
$game_party.members[i].fome = (Fome::Actor[i])
end
@segundos = 0
end
rd12_update
end
end
#===============================================================================
#Adiciona a fome nos personagens
class Game_Actor < Game_Battler
alias rd12_initialize initialize
def initialize(actor_id)
@fome = 0
rd12_initialize(actor_id)
end
def fome=(arg)
@fome = 0 if @fome == nil
@fome += arg
@fome = 0 if @fome < 0
$Fome.refresh
end
def fome
@fome
end
end
#===============================================================================
#Modifica o m�ƒ©todo para poder usar o item de fome
class Game_Battler < Game_BattlerBase
def item_test(user, item)
return false if item.for_dead_friend? != dead?
return true if $game_party.in_battle
return true if item.for_opponent?
return true if item.damage.recover? && item.damage.to_hp? && hp < mhp
return true if item.damage.recover? && item.damage.to_mp? && mp < mmp
return true if item_has_any_valid_effects?(user, item)
arg = item.note.split
return true if arg[0] == "-fome" or arg[0] == "+fome"
return false
end
end
#===============================================================================
#Modifica o m�ƒ©todo para ganhar ou perder Fome
class Scene_Item < Scene_ItemBase
def use_item_to_actors
item_target_actors.each do |target|
arg = item.note.split
if arg[0] == "-hunger"
target.fome = -arg[1].to_i
#Mostra mensagem com a fome atual
msgbox("Hunger decreases in -#{arg[1]}\n","Hunger current: #{target.fome}/100")
end
if arg[0] == "+hunger"
target.fome = arg[1].to_i
#Mostra mensagem com a fome atual
msgbox("Hunger increases in +#{arg[1]}\n","Hunger current: #{target.fome}/100")
end
item.repeats.times { target.item_apply(user, item) }
end
end
end
#===============================================================================
PicturesPlace in the folder picture

>
http://i.imgur.com/Y9VWt.pngName:
Fome_Base
>
http://i.imgur.com/HOlyh.pngName:
Fome_Hud
>
http://i.imgur.com/5Wtfn.pngName:
Fome_100Instructions:1. To set the HUD position, modify these lines:
CODE
HUDs_x = 1
HUDs_y = 190
Replace 1 with the desired X and 190 with the desired Y.
2. To create an item which modifies hunger, write whether
+hunger value or
-hunger value in the item's notes, where
value must be replaced with the amount of hunger that item will increase or decrease respectively.
3. To set the time interval from an hunger's increase to the following one, modify this line:
CODE
Segundos = 5
Replace 5 with the number of seconds which should pass between two increases.
4. To set how much hunger will increase each time interval, modify these values:
CODE
Actor[0] = 9 #First Actor
Actor[1] = 6 #Second
Actor[2] = 4 #Third
Actor[3] = 11#Fourth
Replace 9 with the hunger increment intended for the first party member, 4 with the hunger increment for the second party member and so on.
I'm don't speak english very well. I'm learning English.Credits
Script by Lucas RD12