CODE
#==============================================================================
# ** Oni Feed Me
#----------------------------------
# Developed by Onidsouza
# Do not redestribute without permission
#==============================================================================
module FeedMe
#========================================
# <<<<<<<<< NEED TO CONFIGURE >>>>>>>>>>
#========================================
Time = 1 # Minutes to increase the Hungry and Thirst +1
ShowMenu = true # Show Hungry and Thirst in the Status Menu
HungryColor = Color.new(255, 0, 0) # If in menu, what's the
#color to represent hungry?
ThirstColor = Color.new(0, 0, 255) # If in menu, what's the
#color to represent thirst?
RecoverHungry = {21 => 3, # Items that change the Hungry Value
# Item ID => Value
# To increase Hungry, use a negative value
# To decrease Hungry, use a positive value
23 => -3}
RecoverThirst = {22 => 3, # Items that change the Thirst Value
# Item ID => Value
# To increase Thirst, use a negative value
# To decrease Thirst, use a positive value
23 => -3}
#========================================
# <<<<<<<<< NEED TO CONFIGURE >>>>>>>>>>
#========================================
end
class Game_Actor < Game_Battler
alias feedMeInitialize initialize
alias feedMeExecute execute_damage
alias feedMeItemEffect item_effect
attr_reader :hungry
attr_reader :thirst
attr_reader :time
def initialize(actor_id)
feedMeInitialize(actor_id)
@hungry = 0
@thirst = 0
@time = 0
end
def update
@time += 1
unless (@time / Graphics.frame_rate) < (FeedMe::Time * 60)
@time = 0
@hungry = [@hungry + 1, 10].min
@thirst = [@thirst + 1, 10].min
end
end
def food(level)
@hungry = [[(@hungry - level), 0].max, 10].min
end
def drink(level)
@thirst = [[(@thirst - level), 0].max, 10].min
end
def execute_damage(user)
unless @hp_damage < 0 and @thirst == 10
feedMeExecute(user)
end
end
def item_effect(user, item)
unless FeedMe::RecoverHungry[item.id] == nil
food(FeedMe::RecoverHungry[item.id])
end
unless FeedMe::RecoverThirst[item.id] == nil
drink(FeedMe::RecoverThirst[item.id])
end
unless item.hp_recovery != 0 and @hungry == 10
feedMeItemEffect(user, item)
end
end
end
class Game_Player < Game_Character
alias feedMeDash dash?
def dash?
return false if $game_party.members[0].thirst == 10
feedMeDash
end
end
class Scene_Map < Scene_Base
alias feedMeUpdate update
def update
feedMeUpdate
for actor in $game_party.members
actor.update
end
end
end
class Window_Status < Window_Base
alias feedMeRefresh refresh
def refresh
feedMeRefresh
draw_hunger_status(300, 300)
end
def draw_hunger_status(x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 100, WLH, "Hunger")
self.contents.draw_text(x, y + 30, 100, WLH, "Thirst")
self.contents.font.color = normal_color
self.contents.fill_rect(x + 100, y, 100, WLH, Color.new(0, 0, 0))
self.contents.fill_rect(x + 100, y + 30, 100, WLH, Color.new(0, 0, 0))
xx = x + 100
@actor.hungry.times do
self.contents.fill_rect(xx, y, 10, WLH, FeedMe::HungryColor)
xx += 10
end
xx = x + 100
yy = y + 30
@actor.thirst.times do
self.contents.fill_rect(xx, yy, 10, WLH, FeedMe::ThirstColor)
xx += 10
end
end
end
class Window_FeedMe_HUD < Window_Base
def initialize
super(0, 0, 544, 416)
self.opacity = 0
@actor = $game_party.members[0]
end
def refresh
self.contents.clear
draw_hunger_status(300, 0)
end
def draw_hunger_status(x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 100, WLH, "Hunger")
self.contents.draw_text(x, y + 30, 100, WLH, "Thirst")
self.contents.font.color = normal_color
self.contents.fill_rect(x + 100, y, 100, WLH, Color.new(0, 0, 0))
self.contents.fill_rect(x + 100, y + 30, 100, WLH, Color.new(0, 0, 0))
xx = x + 100
@actor.hungry.times do
self.contents.fill_rect(xx, y, 10, WLH, FeedMe::HungryColor)
xx += 10
end
xx = x + 100
yy = y + 30
@actor.thirst.times do
self.contents.fill_rect(xx, yy, 10, WLH, FeedMe::ThirstColor)
xx += 10
end
end
end
class Scene_Map < Scene_Base
alias fmhudinit start
alias fmhuddis terminate
alias fmhudupdate update
def start
fmhudinit
@fmhud = Window_FeedMe_HUD.new
end
def terminate
fmhuddis
@fmhud.dispose
end
def update
fmhudupdate
@fmhud.refresh
end
end