Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Non-SDK version of this..

Can someone make this independant of the SDK?

Life System by ChaoSG1

#===============================================================================
# ** Life System: Setup Module
#-------------------------------------------------------------------------------
# Author : Chaosg1
# Version: 0.80
# Date : 21-02-07
#===============================================================================
SDK.log('Life System','Chaosg1',0.30, 21-02-07)
SDK.check_requirements(2.0, [1,2])

#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.enabled?('Life System')
module LS
Version = 0.80 #Do not change
module Setup
#-------------------------------------------------------------------------
# UNITS: VERSION 1.0
#-------------------------------------------------------------------------
Base_Height = 1.75
Height_Units = "Meters"
Base_Weight = 75
Weight_Units = "Kg"
Water_Tag = 2
#Update Time
Update_Time = 1
#-------------------------------------------------------------------------
# FEATURES: VERSION 1.0
#-------------------------------------------------------------------------
Animated = true
Dehidratation = true
Change_Stats = true
Heart_Attack = true
Warn_Player = true
Stamina = true
Trown_Up = true
Starve = true
Sleep = true
#-------------------------------------------------------------------------
# FEATURES: WEIGHT
#-------------------------------------------------------------------------
Weight_Increase = 0.03 #Weight_Gain X Actor Hungry Level/20
Weight_Lose = 0.05 #Weight_Lose X Actor Hungry Level/20
Weight_Hungry = [0,10] #Min and Max Level of Actor hungry, that wont change weight(Normal Hungry Level)
#-------------------------------------------------------------------------
# FEATURES: DEHYDRATATION
#-------------------------------------------------------------------------
#Set Only if Dehidration is true
Dehi_Move = 0.5 #How much to add Moving
Dehi_Stop = 0.3 #How much to add Stoped
Dehi_State = 1 #State ID in Database
Dehi_Message = " is Dehydrated."
Dehi_Message_s = 100
#-------------------------------------------------------------------------
# FEATURES: STARVE
#-------------------------------------------------------------------------
Starve_Move = 0.3 #How much to add Moving
Starve_Stop = 0.2 #How much to add Stoped
Starve_State = 1 #State ID in Database
Starve_Message = " is Starving."
Starve_Message_s = 100
#-------------------------------------------------------------------------
# FEATURES: HEART ATTACK
#-------------------------------------------------------------------------
Heart_Message = " just suffered and Heart Attack!"
Heart_State = 6 #The stat the actor must be to suffer heart attacks, see STATES.
#-------------------------------------------------------------------------
# FEATURES: TROWN UP
#-------------------------------------------------------------------------
Trow_Up_Message = " just trown up."
#-------------------------------------------------------------------------
# FEATURES: STAMINA
#-------------------------------------------------------------------------
#Set Only if Stamina is true
Stamina_Move = 0.7 #Negative to recover
Stamina_Stop = -0.7 #Positve for losing
Stamina_Cm = true #if the Stamina should change with the move speed
Stamina_State = 1
Stamina_Message = " is getting tired and must stop a little."
Stamina_Warning = 90
Stamina_Inflict = 100 #Over this Value it Inflicts the Stamina STATE
#-------------------------------------------------------------------------
# FEATURES: SLEEP
#-------------------------------------------------------------------------
Sleep_Plus = 1 #How much it does increase for second(Real Life)
Sleep_State = 1 #ID IN database
Sleep_Message = "is asleep."
Sleep_Message_S = 100 # Level of Sleep Need to show the Message and Change Stats
#-------------------------------------------------------------------------
# STATS PART: VERSION 1.0
#-------------------------------------------------------------------------
#Config: Stats[ID] = ["STAT NAME", MINIMUM_VALUE,STAT INFLICTED,ANIMATION SUFIX]
Stats = {}
Stats[0] = ["Skeleton" ,0 ,1 ,"_skeleton"]
Stats[1] = ["Under Weight" ,14.4 ,1 ,"_under" ]
Stats[2] = ["Below Average" ,16.6 ,1 ,"_below" ]
Stats[3] = ["Normal" ,20.7 ,1 ,"" ]
Stats[4] = ["Above Average" ,26.4 ,1 ,"_above" ]
Stats[5] = ["Over-Weight" ,27.8 ,1 ,"_over" ]
Stats[6] = ["Obese" ,31.1 ,1 ,"_obese" ]
#STATS MESSAGE[STATE_ID] = "Message"
Stats_Message = {}
Stats_Message[0] = " is a Skeleton."
Stats_Message[1] = " is almost a skeleton."
Stats_Message[2] = " is getting thiner."
Stats_Message[3] = " is Normal Weighted."
Stats_Message[4] = " is getting fat."
Stats_Message[5] = " is Over-Weighted"
Stats_Message[5] = " is Obese! He might Suffer Heart Attacks."
#-------------------------------------------------------------------------
# STATUS SCREEN PART: VERSION 1.0
#-------------------------------------------------------------------------
HUNGRY_BAR = "014-Reds01"
THIRSTY_BAR = "013-Blues01"
STAMINA_BAR = "020-Metallic01"
SLEEP_BAR = "020-Metallic01"
#-------------------------------------------------------------------------
# ITENS PART: VERSION 1.0
#-------------------------------------------------------------------------
#Itens For Eating and Drinkin
#SETUP: FOOD[ITEM_ID] = AMOUNT GIVEN
#SETUP: DRINK[ITEM_ID] = AMOUNT GIVEN
Food = {}
Food[32] = 10
Drink = {}
Drink[32] = 15
end
end
end
#--------------------------------------------------------------------------
# End SDK Enabled Check
#--------------------------------------------------------------------------
#===============================================================================
# ** Life System: Life_System
#-------------------------------------------------------------------------------
# Author : Chaosg1
# Version: 0.80
# Date : 21-02-07
#===============================================================================
#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.enabled?('Life System')
module LS

class Life_System
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@animated = LS::Setup::Animated
@dehidra = LS::Setup::Dehidratation
@change_stats = LS::Setup::Change_Stats
@heart_attack = LS::Setup::Heart_Attack
@warn = LS::Setup::Warn_Player
@trown = LS::Setup::Trown_Up
@starve = LS::Setup::Starve
@stamina = LS::Setup::Stamina
@sleep = LS::Setup::Sleep
@dehi_mov = LS::Setup::Dehi_Move
@dehi_stop = LS::Setup::Dehi_Stop
@dehi_state = LS::Setup::Dehi_State
@dehi_message = LS::Setup::Dehi_Message
@dehi_message_s = LS::Setup::Dehi_Message_s
@starve_mov = LS::Setup::Starve_Move
@starve_stop = LS::Setup::Starve_Stop
@starve_state = LS::Setup::Starve_State
@starve_message = LS::Setup::Starve_Message
@starve_message_s = LS::Setup::Starve_Message_s
@stamina_mov = LS::Setup::Stamina_Move
@stamina_stop = LS::Setup::Stamina_Stop
@stamina_Cm = LS::Setup::Stamina_Cm
@stamina_state = LS::Setup::Stamina_State
@sleep_plus = LS::Setup::Sleep_Plus
@sleep_state = LS::Setup::Sleep_State
@weight_gain = LS::Setup::Weight_Increase
@weight_lose = LS::Setup::Weight_Lose
@weight_hungry = LS::Setup::Weight_Hungry
@heart_message = LS::Setup::Heart_Message
@trow_up_message = LS::Setup::Trow_Up_Message
@time = 0
@old_time = 0
end
#--------------------------------------------------------------------------
# * Update - This was broken in several parts all the method logs are displayed
# like * Update - Method Name
#--------------------------------------------------------------------------
def update
@time = Graphics.frame_count/Graphics.frame_rate
if @time-@old_time >= LS::Setup::Update_Time
@old_time = @time
$game_party.actors.each do |i|
check_up(i)
thirsty(i) if @dehidra
starve(i) if @starve
heart(i) if @heart_attack
trown(i) if @trown
fatigue(i) if @stamina
end
end
end
#-------------------------------------------------------------------------
# * Update - Check Up
#-------------------------------------------------------------------------
def check_up(actor)
ims = actor.weight / actor.height**2
status = LS::Setup::Stats
#prevent_animation_errors
if not actor.stats_id.nil?
text = status[actor.stats_id][3]
actor.character_name = actor.character_name.gsub(/#{text}/) {|s| "" }
end
if actor.stats_id.nil? or !ims.between(status[actor.stats_id][1],status[actor.stats_id+1][1])
for i in 0...status.size
if ims.between(status[1],status[i+1][1])
actor.stats_id = i
actor.state = status[0]
break
end
end
end
message = actor.name + LS::Setup::Stats_Message[actor.stats_id]
$game_player.character_name = actor.character_name + status[actor.stats_id][3] if actor == $game_party.actors[0] and @animated
actor.character_name = actor.character_name + status[actor.stats_id][3] if @animated
state = status[actor.stats_id][2] if @status_change
actor.add_state(state) if @status_change
#Shows Message if the State change and @warn is set to true
if actor.old_state != actor.state and @warn
$game_temp.message_text = message
$game_temp.message_window_showing = true
actor.old_state = actor.state
end
#Weight Lose and Weight Gain
actor.weight -= @weight_lose * actor.hungry/20 if actor.hungry <= @weight_hungry[0]
actor.weight += @weight_gain * actor.hungry/20 if actor.hungry >= @weight_hungry[0]
actor.sleep += @sleep_plus
if actor.sleep > LS::Setup::Sleep_Message_S and
actor.state != @sleep_state
actor.add_state(@sleep_state) if @change_stats
message = actor.name + LS::Setup::Sleep_Message if @warn
$game_temp.message_text = message if @warn
$game_temp.message_window_showing = true if @warn
end
end
#--------------------------------------------------------------------------
# * Update - Thirsty
#--------------------------------------------------------------------------
def thirsty(actor)
actor.thirst += @dehi_mov if $game_player.moving?
actor.thirst += @dehi_stop if !$game_player.moving?
if actor.thirst >= @dehi_message_s and actor.state != @dehi_state
message = actor.name + @dehi_message if @warn
$game_temp.message_text = message if @warn
$game_temp.message_window_showing = true if @warn
color = Color.new(255,0,0,255)
$game_screen.start_flash(color, 3)
actor.add_state(@dehi_state) if @change_stats
end
end
#--------------------------------------------------------------------------
# * Update - Starve
#--------------------------------------------------------------------------
def starve(actor)
actor.hungry += @starve_mov if $game_player.moving?
actor.hungry += @starve_stop if !$game_player.moving?
if actor.hungry >= @starve_message_s and actor.state != @starve_state
message = actor.name + @starve_message if @warn
$game_temp.message_text = message if @warn
$game_temp.message_window_showing = true if @warn
color = Color.new(255,0,0,255)
$game_screen.start_flash(color, 3)
actor.add_state(@starve_state) if @change_stats
end
end
#--------------------------------------------------------------------------
# * Update - Heart
#--------------------------------------------------------------------------
def heart(actor)
a = rand(100)
return if actor.states == 1
if a == 5 and actor.stats_id == LS::Setup::Heart_State
color = Color.new(255,50,50,255)
$game_screen.start_flash(color, 3)
message = actor.name + @heart_message if @warn
$game_temp.message_text = message if @warn
$game_temp.message_window_showing = true if @warn
actor.hp -= 10
end
end
#--------------------------------------------------------------------------
# * Update - Trown
#--------------------------------------------------------------------------
def trown(actor)
a = rand(100)
if a < 30 and actor.hungry < 0
message = actor.name + @trow_up_message if @warn
$game_temp.message_text = message if @warn
$game_temp.message_window_showing = true if @warn
color = Color.new(50,255,50,255)
$game_screen.start_flash(color, 3)
actor.hungry = 0
end
end
#--------------------------------------------------------------------------
# * Update - Stamina
#--------------------------------------------------------------------------
def fatigue(actor)
if $game_player.moving?
actor.fatigue += @stamina_mov if actor.fatigue <= 100
else
actor.fatigue += @stamina_stop if actor.fatigue >= 0
end
if actor.fatigue == LS::Setup::Stamina_Warning
message = actor.name + LS::Setup::Stamina_Message if @warn
$game_temp.message_text = message if @warn
$game_temp.message_window_showing = true if @warn
elsif actor.fatigue >= LS::Setup::Stamina_Inflict
actor.add_state(@stamina_state) if @change_stats
end
end
#-------------------------------------------------------------------------
# * Sleep
#-------------------------------------------------------------------------
def sleep(amount)
$game_party.actors.each do |i|
if i.sleep - amount >= 0
i.sleep - amount
else
i.sleep = 0
end
end
end
end
end
end
#--------------------------------------------------------------------------
# End SDK Enabled Check
#--------------------------------------------------------------------------

#==============================================================================
# ** Life System: Interactive Objects - Food, Water
#------------------------------------------------------------------------------
# Author : Chaosg1
# Version: 0.80
# Date : 21-02-07
#==============================================================================
#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.enabled?('Life System')
module LS

class Interactive
#------------------------------------------------------------------------
# * Object Initialization
#------------------------------------------------------------------------
def initialize(event,id_item,restore,min,max,initial = 50,graphic = nil)
@restore = restore
@min = min
@max = max
@amount = initial
@id = id_item
@event = $game_map.events[event]
@graphic = graphic
@player = $game_player
end
#------------------------------------------------------------------------
# * Update
#------------------------------------------------------------------------
def update
@amount += @restore
@amount = @max if @amount > @max
dx = (@player.x - @event.x)**2
dy = (@player.y - @event.y)**2
d = Math.sqrt (dx + dy)
return if d != 1 or !player_facing?(@event)
if Input.trigger?(Input::C)
$game_party.gain_item(@id,@amount)
message = "You took: #{@amount}x #{$data_itens[@id].name}"
$game_temp.message_text = message
$game_temp.message_window_showing = true
end
end
#------------------------------------------------------------------------
# * Player_Facing?(Object)
#------------------------------------------------------------------------
def player_facing?(object)
case @player.direction
when 4
return true if @player.x > object.x
when 6
return true if @player.x < object.x
when 8
return true if @player.y > object.y
when 2
return true if @player.y < object.y
end
return false
end
end
end
end
#--------------------------------------------------------------------------
# End SDK Enabled Check
#--------------------------------------------------------------------------
#===============================================================================
# ** Life System: Windows
#-------------------------------------------------------------------------------
# Author : Chaosg1
# Version: 1.00
# Date : 21-02-07
#===============================================================================
#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.enabled?('Life System')

module SL
#--------------------------------------------------------------------------
# * * Window To show the character Faces
#--------------------------------------------------------------------------
class Window_Picture < Window_Base
attr_accessor :active
attr_accessor :bitmap
def initialize(x,y,bitmap)
@oy = y
super(x,y,112,112)
@bitmap = bitmap
self.contents = Bitmap.new(self.width - 32, self.height-32)
self.opacity = 0
bitmaps = RPG::Cache.faces(bitmap)
src_rect = Rect.new(0, 0, 80, 80)
cx = self.contents.text_size(@bitmap).width
@x = 80/2-cx/2
self.contents.blt(0,0, bitmaps, src_rect)
self.contents.draw_text(@x,-10,80,32,@bitmap)
@open = false
@active = false
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
super()
hide if not @active and @open == true
end
#--------------------------------------------------------------------------
# * Moves Up
#--------------------------------------------------------------------------
def show
@open = true
move(self.x,@oy-10,5)
self.contents.clear
bitmaps = RPG::Cache.faces(@bitmap)
src_rect = Rect.new(0, 0, 80, 80)
self.contents.blt(0,0, bitmaps, src_rect)
cx = self.contents.text_size(@bitmap).width
@x = 80/2-cx/2
self.contents.draw_text(@x,80-32,80,32,@bitmap)
end
#--------------------------------------------------------------------------
# * Moves Down
#--------------------------------------------------------------------------
def hide
@open = false
move(self.x,@oy+48,5)
self.contents.clear
src_rect = Rect.new(0, 0, 80, 80)
bitmaps = RPG::Cache.faces(@bitmap)
self.contents.blt(0,0, bitmaps, src_rect)
cx = self.contents.text_size(@bitmap).width
@x = 80/2-cx/2
self.contents.draw_text(@x,-10,80,32,@bitmap)
end
end
#--------------------------------------------------------------------------
# * * Window To show the character Stats
#--------------------------------------------------------------------------
class Window_Stats2 < Window_Base
attr_accessor :actor
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(640,80,(4*80)+32,320)
@actor = $game_party.actors[actor]
x = 340 - self.width/2
self.move( x,80,5)
self.contents = Bitmap.new(self.width - 32, self.height-32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh Method : Draw all The Info
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.underline = true
draw_actor_name(@actor, 0, 0)
cx = self.contents.text_size(@actor.name).width
self.contents.draw_text(cx,0,100,32,"'s Info:")
self.contents.font.underline = false

cw = self.contents.text_size("Weight Stats:").width
self.contents.draw_text(20,50,cw,32,"Weight Stats:")
cy = self.contents.text_size(@actor.state).width
self.contents.draw_text(25+cw,50,cy,32,@actor.state)

cx = self.contents.text_size("Weight:").width
self.contents.draw_text(20,25,cw,32,"Weight:")
cy = self.contents.text_size(@actor.weight.round.to_s).width
self.contents.draw_text(25+cw,25,cy,32,@actor.weight.round.to_s)
cz = self.contents.text_size(LS::Setup::Weight_Units).width
self.contents.draw_text(25+cw + cy ,25,cz,32,LS::Setup::Weight_Units)

cx = self.contents.text_size("Height:").width
self.contents.draw_text(20,75,cx,32,"Height:")
cy = self.contents.text_size(@actor.height.to_s).width
self.contents.draw_text(20+cw,75,cy,32,@actor.height.to_s)
cz = self.contents.text_size(LS::Setup::Height_Units).width
self.contents.draw_text(20+cw + cy+2 ,75,cz,32,LS::Setup::Height_Units)

self.contents.font.underline = true
draw_actor_name(@actor, 0,120)
cx = self.contents.text_size(@actor.name).width
self.contents.draw_text(cx,120,100,32,"'s status:")
self.contents.font.underline = false

y = 70
cx = self.contents.text_size("Hungry:").width
self.contents.draw_text(20,y+75,cx,32,"Hungry:")
bar = LS::Setup::HUNGRY_BAR
self.contents.draw_trick_gradient_bar(20 + cx +18, y+88, @actor.hungry, 100, bar)

cx = self.contents.text_size("Thirst:").width
self.contents.draw_text(20,y+100,cx,32,"Thirst:")
bar = LS::Setup::THIRSTY_BAR
self.contents.draw_trick_gradient_bar(20+cx+30,y+ 113, @actor.thirst, 100, bar)

bar = LS::Setup::SLEEP_BAR
cx = self.contents.text_size("Sleep:").width
self.contents.draw_text(20,y+125,cx,32,"Sleep:")
cy = self.contents.text_size(@actor.sleep.round.to_s).width
self.contents.draw_trick_gradient_bar(20+cx+27, y+113+25, @actor.sleep, 100, bar)

bar = LS::Setup::STAMINA_BAR
cx = self.contents.text_size("Fatigue:").width
self.contents.draw_text(20,y+150,cx,32,"Fatigue:")
self.contents.draw_trick_gradient_bar(20+cx+14, y+163, @actor.fatigue, 100, bar)

end
end
end
end
#--------------------------------------------------------------------------
# End SDK Enabled Check
#--------------------------------------------------------------------------
#==============================================================================
# ** Life System: Class edits
#------------------------------------------------------------------------------
# Author : Chaosg1
# Version: 0.80
# Date : 21-02-07
#==============================================================================
#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.enabled?('Life System')
#==============================================================================
# ** Game_Battler (part 1)
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass for the Game_Actor
# and Game_Enemy classes.
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :height # Height used for Life System
attr_accessor :weight # Weight used for Life System
attr_accessor :eek:verweight
attr_accessor :underweight
attr_accessor :state
attr_accessor :eek:ld_state
attr_accessor :thirst
attr_accessor :hungry
attr_accessor :fatigue
attr_accessor :sleep
attr_accessor :stats_id
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias cg1_ls_gb_init initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
#Sets the Default Variables
@height = LS::Setup::Base_Height
@weight = LS::Setup::Base_Weight
@hungry = 15 - rand(10)
@thirst = 0
@overweight = false
@underweight = false
@state = "Normal"
@old_state = @state
@fatigue = 0
@sleep = 0
@stats_id = nil
cg1_ls_gb_init
end
alias cg1_ls_gb_item_effect item_effect
#--------------------------------------------------------------------------
# * Application of Item Effects
# item : item
#--------------------------------------------------------------------------
def item_effect(item)
if not LS::Setup::Food[item.id].nil? or not LS::Setup::Drink[item.id].nil?
@hungry -= LS::Setup::Food[item.id] if not LS::Setup::Food[item.id].nil?
@thirst -= LS::Setup::Drink[item.id] if not LS::Setup::Drink[item.id].nil?
else
cg1_ls_gb_item_effect(item)
end
end
end
#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
# This class handles the player. Its functions include event starting
# determinants and map scrolling. Refer to "$game_player" for the one
# instance of this class.
#==============================================================================
class Game_Player < Game_Character
attr_accessor :character_name
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :character_name
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias cg1_sm_updt update
def update
$life_system = LS::Life_System.new if $life_system.nil?
$life_system.update if not $life_system.nil?
cg1_sm_updt
end
end

class Numeric
#--------------------------------------------------------------------------
# * Between x as Integer, y as Integer
#--------------------------------------------------------------------------
def between(x,y)
return true if self > x and self < y
return false
end
end
#--------------------------------------------------------------------------
# * Load Gradient from RPG::Cache
#--------------------------------------------------------------------------
module RPG
module Cache
def self.gradient(filename, hue = 0)
self.load_bitmap("Graphics/Gradients/", filename, hue)
end
def self.faces(filename,hue = 0)
self.load_bitmap("Graphics/Faces/", filename, hue)
end
end
end
class Window_Base < Window
OUTLINE = 1
BORDER = 1
#--------------------------------------------------------------------------
# * Draw Gradient Bar
#--------------------------------------------------------------------------
def draw_gradient_bar(x, y, min, max, file, width = nil, height = nil, hue = 0, back = "Back", back2 = "Back2")
bar = RPG::Cache.gradient(file, hue)
back = RPG::Cache.gradient(back)
back2 = RPG::Cache.gradient(back2)
cx = BORDER
cy = BORDER
dx = OUTLINE
dy = OUTLINE
zoom_x = width != nil ? width : back.width
zoom_y = height != nil ? height : back.height
percent = min / max.to_f if max != 0
percent = 0 if max == 0
back_dest_rect = Rect.new(x,y,zoom_x,zoom_y)
back2_dest_rect = Rect.new(x+dx,y+dy,zoom_x -dx*2,zoom_y-dy*2)
bar_dest_rect = Rect.new(x+cx,y+cy,zoom_x * percent-cx*2,zoom_y-cy*2)
back_source_rect = Rect.new(0,0,back.width,back.height)
back2_source_rect = Rect.new(0,0,back2.width,back2.height)
bar_source_rect = Rect.new(0,0,bar.width* percent,bar.height)
self.contents.stretch_blt(back_dest_rect, back, back_source_rect)
self.contents.stretch_blt(back2_dest_rect, back2, back2_source_rect)
self.contents.stretch_blt(bar_dest_rect, bar, bar_source_rect)
end

def draw_vertical_gradient_bar(x, y, min, max, file, width = nil, height = nil, hue = 0, back = "Back", back2 = "Back2")
bar = RPG::Cache.gradient(file, hue)
back = RPG::Cache.gradient(back)
back2 = RPG::Cache.gradient(back2)
cx = BORDER
cy = BORDER
dx = OUTLINE
dy = OUTLINE
zoom_x = width != nil ? width : back.width
zoom_y = height != nil ? height : back.height
percent = min / max.to_f if max != 0
percent = 0 if max == 0
bar_y = (zoom_y - zoom_y * percent).ceil
source_y = bar.height - bar.height * percent
back_dest_rect = Rect.new(x,y,zoom_x,zoom_y)
back2_dest_rect = Rect.new(x+dx,y+dy,zoom_x -dx*2,zoom_y-dy*2)
bar_dest_rect = Rect.new(x+cx,y+bar_y+cy,zoom_x-cx*2,(zoom_y * percent).to_i-cy*2)
back_source_rect = Rect.new(0,0,back.width,back.height)
back2_source_rect = Rect.new(0,0,back2.width,back2.height)
bar_source_rect = Rect.new(0,source_y,bar.width,bar.height * percent)
self.contents.stretch_blt(back_dest_rect, back, back_source_rect)
self.contents.stretch_blt(back2_dest_rect, back2, back2_source_rect)
self.contents.stretch_blt(bar_dest_rect, bar, bar_source_rect)
end
end

end
#--------------------------------------------------------------------------
# End SDK Enabled Check
#--------------------------------------------------------------------------
#==============================================================================
# ** Life System: Check_Status
#------------------------------------------------------------------------------
# Author : Chaosg1
# Version: 0.80
# Date : 21-02-07
#==============================================================================
#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.enabled?('Life System')
module SL
class Scene_Check_Status < SDK::Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def main_variable
super
@old_index = 0
@index = 0
@window_pics = []
for i in 0...$game_party.actors.size
next if i > 4
@window_pics = SL::Window_Picture.new(640,0,$game_party.actors.name)
@window_pics.hide
@window_pics.z = 0
end
@window_status = SL::Window_Stats2.new(0)
end
#-------------------------------------------------------------------------
# * Spritset
#-------------------------------------------------------------------------
def main_spriteset
super
@spriteset = Spriteset_Map.new
end
#-------------------------------------------------------------------------
# * Main Update
#-------------------------------------------------------------------------
def update
super
for i in 0...@window_pics.size
x = @window_status.x + (83*i)-5
@window_pics.x = x
end
@index -=1 if Input.repeat?(Input::LEFT)
@index +=1 if Input.repeat?(Input::RIGHT)
@index = $game_party.actors.size-1 if @index < 0
@index = 0 if @index > $game_party.actors.size-1
if @index < 4
@window_pics[@index].show
@window_pics[@index].bitmap = $game_party.actors[@index].name
else
@window_pics[@index%4].show
@window_pics[@index%4].bitmap = $game_party.actors[@index].name
end
@window_status.actor = $game_party.actors[@index]
if @old_index != @index
@window_status.refresh
@old_index = @index
end
return $scene = Scene_Map.new if Input.trigger?(Input::B)
end
end
end
end
#--------------------------------------------------------------------------
# End SDK Enabled Check
#--------------------------------------------------------------------------


Please?
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top