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.

Edit This Script For Me Please!

The following script is really good and I like it. Its a New Pause Menu Interface script however, it can only hold up to two players (as in, I can only have two players displayed in the menu). I want any one of you guys to edit the script so that it may show up to four players at least!

Thank you in advance!

#============================================================
# Custom Menu System
# created by: Constance
# created on: Dec. 26, 2005
# version: 2.2
# credits: Acedent Prone, Diego, Dubealex, Catchm
# special thanks credits goes to: SephirothSpawn, couldn't have done it without you
# RMXP - Underground - The Underground Gaming Zone
#============================================================
class Window_Base < Window

def draw_actor_level(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x + 4, y + 20, 24, 32, actor.level.to_s, 2)
end

def draw_actor_battler(actor, x, y)
bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end

def draw_sprite(x, y, name, hue, pose, frame)
bitmap = RPG::Cache.character(name, hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
case pose
when 0;a = 0
when 1;a = ch
when 2;a = ch * 3
when 3;a = ch * 2
end

case frame
when 0;b = 0
when 1;b = cw
when 2;b = cw * 2
when 3;b = cw * 3
end
src_rect = Rect.new(b, a, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end

def draw_actor_hp(actor, x, y, width = 144)
self.contents.font.name = "Tahoma"
self.contents.font.size = 20
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x + 30, y, 48, 32, actor.hp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 30 + 48, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 30 + 60, y, 48, 32, actor.maxhp.to_s)
end
end
#============================================
def draw_actor_sp(actor, x, y, width = 144)
self.contents.font.name = "Tahoma"
self.contents.font.size = 20
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
self.contents.font.color = Color.new(74, 230, 51, 225)
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x + 30, y, 48, 32, actor.sp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 30 + 48, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 30 + 60, y, 48, 32, actor.maxsp.to_s)
end
end

def draw_actor_level3(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
end

def draw_actor_hp2(actor, x, y, width = 144)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
end
end

def draw_actor_sp2(actor, x, y, width = 144)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
end
end

def draw_actor_name(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 144, 32, actor.name)
end

def draw_actor_parameter2(actor, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
when 2
parameter_name = "Magic Defense"
parameter_value = actor.mdef
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
end
self.contents.font.color = system_color
self.contents.font.size = 20
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
end

def draw_actor_barz(actor,x, y, type, length, thick, e1, e2, c1 = Color.new(255,0,0,255), c2 = Color.new(0,0,0,255))
if type == "horizontal"
width = length
height = thick
self.contents.fill_rect(x-1, y - 1, width + 1, height + 3, Color.new(0, 0, 0, 255))
self.contents.fill_rect(x, y, width + 1, height + 1, Color.new(0, 0, 0, 255))
w = width * e1.to_f / e2.to_f
for i in 0..height
r = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/height
g = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/height
b = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/height
a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
end
end
end
end

class Window_Selectable2 < Window_Base

attr_reader :index
attr_reader :help_window

def initialize(x, y, width, height)
super(x, y, width, height)
@item_max = 1
@column_max = 1
@index = -1
end

def index=(index)
@index = index
if self.active and @help_window != nil
update_help
end
update_cursor_rect
end

def row_max
return (@item_max + @column_max - 1) / @column_max
end

def top_row
return self.oy / 32
end

def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 32
end

def page_row_max
return (self.height - 32) / 32
end
def page_item_max
return page_row_max * @column_max
end

def help_window=(help_window)
@help_window = help_window
if self.active and @help_window != nil
update_help
end
end

def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
if row < self.top_row
self.top_row = row
end

if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
cursor_width = self.width / @column_max - 32
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 32 - self.oy
self.cursor_rect.set(x, y, 65, 32)
end

def update
super
if self.active and @item_max > 0 and @index >= 0
if Input.repeat?(Input::DOWN)
if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
@index < @item_max - @column_max
$game_system.se_play($data_system.cursor_se)
@index = (@index + @column_max) % @item_max
end
end
if Input.repeat?(Input::UP)
if (@column_max == 1 and Input.trigger?(Input::UP)) or
@index >= @column_max
$game_system.se_play($data_system.cursor_se)
@index = (@index - @column_max + @item_max) % @item_max
end
end
if Input.repeat?(Input::RIGHT)
if @column_max >= 2 and @index < @item_max - 1
$game_system.se_play($data_system.cursor_se)
@index += 1
end
end

if Input.repeat?(Input::LEFT)
if @column_max >= 2 and @index > 0
$game_system.se_play($data_system.cursor_se)
@index -= 1
end
end
if Input.repeat?(Input::R)
if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
$game_system.se_play($data_system.cursor_se)
@index = [@index + self.page_item_max, @item_max - 1].min
self.top_row += self.page_row_max
end
end

if Input.repeat?(Input::L)
if self.top_row > 0
$game_system.se_play($data_system.cursor_se)
@index = [@index - self.page_item_max, 0].max
self.top_row -= self.page_row_max
end
end
end
if self.active and @help_window != nil
update_help
end
update_cursor_rect
end
end

class Window_Command2 < Window_Selectable2

attr_accessor :commands

def initialize(commands)
super(0, 0, 270, 101)
self.contents = Bitmap.new(width - 32, height - 32)
@commands = commands
@width = width
@item_max = 6
@column_max = 3
@commands = commands
self.index = 0
end
end

class Dummy_Window_Command < Window_Base

def initialize
super(0, 0, 270, 101)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 22
refresh
end

def refresh
self.contents.clear
self.contents.draw_text(-35, 0, 124, 32, $data_system.words.item, 1)
self.contents.draw_text(50, 0, 124, 32, $data_system.words.skill, 1)
self.contents.draw_text(145, 0, 124, 32, $data_system.words.equip, 1)
self.contents.draw_text(-35, 35, 124, 32, "Load", 1)
self.contents.draw_text(50, 35, 124, 32, "Save", 1)
self.contents.draw_text(140, 35, 124, 32, "Exit", 1)
end
end


class Dummy_Window_Command2 < Window_Base

def initialize
super(0, 0, 270, 101)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 22
refresh
end

def refresh
self.contents.clear
bitmap = RPG::Cache.icon("034-Item03")
self.contents.blt(35, 4, bitmap, Rect.new(0, 0, 24, 24))

bitmap = RPG::Cache.icon("050-Skill07")
self.contents.blt(115, 4, bitmap, Rect.new(0, 0, 24, 24))

bitmap = RPG::Cache.icon("013-Body01")
self.contents.blt(205, 4, bitmap, Rect.new(0, 0, 24, 24))

bitmap = RPG::Cache.icon("033-Item02")
self.contents.blt(35, 39, bitmap, Rect.new(0, 0, 24, 24))

bitmap = RPG::Cache.icon("037-Item06")
self.contents.blt(115, 39, bitmap, Rect.new(0, 0, 24, 24))

bitmap = RPG::Cache.icon("039-Item08")
self.contents.blt(205, 39, bitmap, Rect.new(0, 0, 24, 24))
end
end

class Scene_Title
$map_infos = load_data("Data/MapInfos.rxdata")
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
end

class Game_Actor < Game_Battler
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end

end

class Game_Map

def name
$map_infos[@map_id]
end

end

class Window_PlayTime < Window_Base

def initialize
super(0, 0, 150, 101)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end

def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.font.size = 20
self.contents.draw_text(4, 0, 120, 32, "Playtime:")
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(-15, 32, 120, 32, text, 2)
end

def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end

class Window_Location < Window_Base
def initialize
super(0, 0, 220,101)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 22
refresh
end

def refresh
bitmap = RPG::Cache.icon("032-Item01")
self.contents.blt(165, y + 40, bitmap, Rect.new(0, 0, 24, 24))
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = normal_color
self.contents.font.size = 20
self.contents.draw_text(44, 40, 120-cx-2, 32, $game_party.gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(164-cx, 40, cx, 32, $data_system.words.gold, 2)
lx = contents.text_size("Location:").width
self.contents.draw_text(4, -55, lx, 144, "Location:", 1)
self.contents.font.color = normal_color
self.contents.font.size = 20
self.contents.draw_text(10 + lx, 1, lx + 40, 32, $game_map.name.to_s, 1)
end

end

class Window_GraphicCharacter1 < Window_Base
def initialize
super(0, 0, 200,180)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 22
@pose, @frame = 0, 0
refresh
end

def refresh
self.contents.clear
actor = $game_party.actors[0]
draw_sprite(25, 55, actor.character_name, actor.character_hue , @pose, @frame)
end

def frame_update
@frame == 3 ? @frame = 0 : @frame += 1
refresh
end

def update_pose(direction)
if direction == 0
@pose == 0 ? @pose = 3 : @pose -= 1
else
@pose == 3 ? @pose = 0 : @pose += 1
end
refresh
end
end

class Window_GraphicCharacter2 < Window_Base
def initialize
super(0, 0, 200,180)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 22
@pose, @frame = 0, 0
refresh
end

def refresh
self.contents.clear
if $game_party.actors.size < 2
self.contents.draw_text(25, 55, 50, 28, "Empty")
else
actor = $game_party.actors[1]
draw_sprite(25, 55, actor.character_name, actor.character_hue , @pose, @frame)
end
end

def frame_update
@frame == 3 ? @frame = 0 : @frame += 1
refresh
end

def update_pose(direction)
if direction == 0
@pose == 0 ? @pose = 3 : @pose -= 1
else
@pose == 3 ? @pose = 0 : @pose += 1
end
refresh
end
end

class Window_Character1 < Window_Base

def initialize
super(0, 0, 200,180)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 22
@pose, @frame = 0, 0
refresh
end

def refresh
self.contents.clear
actor = $game_party.actors[0]
draw_actor_hp(actor, x + 4, y + 55, 144)
draw_actor_barz(actor, x + 4, y + 81, "horizontal", 160, 4, actor.hp, actor.maxhp, Color.new(102, --200, 160, 0), Color.new(0, 0, 0, 0))
draw_actor_sp(actor, x + 4, y + 110, 144)
draw_actor_barz(actor, x + 4, y + 136, "horizontal", 160, 4, actor.sp, actor.maxsp, Color.new(0, 0, 0, 0), Color.new(-102, 160, -200, 0))
self.contents.font.size = 20
self.contents.draw_text(x + 50, y - 55, 144, 144, "Class:")
draw_actor_class(actor, x + 100, y + 1)
self.contents.draw_text(x + 50, y - 62, 144, 170, "_____________________")
self.contents.draw_text(x + 80, y - 30, 144, 144, "Lv:")
draw_actor_level(actor, x + 95, y + 6)
end

end

class Window_Character2 < Window_Base

def initialize
super(0, 0, 200,200)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 22
refresh
end

def refresh
self.contents.clear
if $game_party.actors.size < 2
self.contents.draw_text(25, 55, 50, 28, "Empty")
else
actor = $game_party.actors[1]
draw_actor_hp(actor, x + 4, y + 55, 144)
draw_actor_barz(actor, x + 4, y + 81, "horizontal", 160, 4, actor.hp, actor.maxhp, Color.new(102, --200, 160, 0), Color.new(0, 0, 0, 0))
draw_actor_sp(actor, x + 4, y + 110, 144)
draw_actor_barz(actor, x + 4, y + 136, "horizontal", 160, 4, actor.sp, actor.maxsp, Color.new(0, 0, 0, 0), Color.new(-102, 160, -200, 0))
self.contents.font.size = 20
self.contents.draw_text(x + 50, y - 55, 144, 144, "Class:")
draw_actor_class(actor, x + 100, y + 1)
self.contents.draw_text(x + 50, y - 62, 144, 170, "_____________________")
self.contents.draw_text(x + 80, y - 30, 144, 144, "Lv:")
draw_actor_level(actor, x + 95, y + 6)
end
end

end

class Window_Character_Selection2 < Window_Base

def initialize
super(0, 0, 640, 51)
self.contents = Bitmap.new(width - 32, height - 32)
self.visible = false
self.z = 2000
refresh
end

def refresh
self.contents.clear
self.contents.font.color = system_color
cx = contents.text_size("Which Character would you like to select?").width
self.contents.draw_text(145, -6, cx, 32, "Which Character would you like to select?", 2)
end
end

#==============================================================================
# ** Window_Selectable
#------------------------------------------------------------------------------
# This window class contains cursor movement and scroll functions.
#==============================================================================

class Window_Selectable3 < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :index # cursor position
attr_reader :help_window # help window
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
@item_max = 1
@column_max = 1
@index = -1
end
#--------------------------------------------------------------------------
# * Set Cursor Position
# index : new cursor position
#--------------------------------------------------------------------------
def index=(index)
@index = index
# Update Help Text (update_help is defined by the subclasses)
if self.active and @help_window != nil
update_help
end
# Update cursor rectangle
update_cursor_rect
end
#--------------------------------------------------------------------------
# * Get Row Count
#--------------------------------------------------------------------------
def row_max
# Compute rows from number of items and columns
return (@item_max + @column_max - 1) / @column_max
end
#--------------------------------------------------------------------------
# * Get Top Row
#--------------------------------------------------------------------------
def top_row
# Divide y-coordinate of window contents transfer origin by 1 row
# height of 32
return self.oy / 32
end
#--------------------------------------------------------------------------
# * Set Top Row
# row : row shown on top
#--------------------------------------------------------------------------
def top_row=(row)
# If row is less than 0, change it to 0
if row < 0
row = 0
end
# If row exceeds row_max - 1, change it to row_max - 1
if row > row_max - 1
row = row_max - 1
end
# Multiply 1 row height by 32 for y-coordinate of window contents
# transfer origin
self.oy = row * 32
end
#--------------------------------------------------------------------------
# * Get Number of Rows Displayable on 1 Page
#--------------------------------------------------------------------------
def page_row_max
# Subtract a frame height of 32 from the window height, and divide it by
# 1 row height of 32
return (self.height - 32) / 32
end
#--------------------------------------------------------------------------
# * Get Number of Items Displayable on 1 Page
#--------------------------------------------------------------------------
def page_item_max
# Multiply row count (page_row_max) times column count (@column_max)
return page_row_max * @column_max
end
#--------------------------------------------------------------------------
# * Set Help Window
# help_window : new help window
#--------------------------------------------------------------------------
def help_window=(help_window)
@help_window = help_window
# Update help text (update_help is defined by the subclasses)
if self.active and @help_window != nil
update_help
end
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
# If cursor position is less than 0
if @index < 0
self.cursor_rect.empty
return
end
# Get current row
row = @index / @column_max
# If current row is before top row
if row < self.top_row
# Scroll so that current row becomes top row
self.top_row = row
end
# If current row is more to back than back row
if row > self.top_row + (self.page_row_max - 1)
# Scroll so that current row becomes back row
self.top_row = row - (self.page_row_max - 1)
end
# Calculate cursor width
cursor_width = self.width / @column_max - 32
# Calculate cursor coordinates
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 32 - self.oy
# Update cursor rectangle
if $game_party.actors.size < 2
self.cursor_rect.set(250 + @index * 140, y, 100, 20)
else
self.cursor_rect.set(160 + @index * 140, y, 150, 20)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# If cursor is movable
if self.active and @item_max > 0 and @index >= 0
# If pressing down on the directional buttons
if Input.repeat?(Input::DOWN)
# If column count is 1 and directional button was pressed down with no
# repeat, or if cursor position is more to the front than
# (item count - column count)
if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
@index < @item_max - @column_max
# Move cursor down
$game_system.se_play($data_system.cursor_se)
@index = (@index + @column_max) % @item_max
end
end
# If the up directional button was pressed
if Input.repeat?(Input::UP)
# If column count is 1 and directional button was pressed up with no
# repeat, or if cursor position is more to the back than column count
if (@column_max == 1 and Input.trigger?(Input::UP)) or
@index >= @column_max
# Move cursor up
$game_system.se_play($data_system.cursor_se)
@index = (@index - @column_max + @item_max) % @item_max
end
end
# If the right directional button was pressed
if Input.repeat?(Input::RIGHT)
# If column count is 2 or more, and cursor position is closer to front
# than (item count -1)
if @column_max >= 2 and @index < @item_max - 1
# Move cursor right
$game_system.se_play($data_system.cursor_se)
@index += 1
end
end
# If the left directional button was pressed
if Input.repeat?(Input::LEFT)
# If column count is 2 or more, and cursor position is more back than 0
if @column_max >= 2 and @index > 0
# Move cursor left
$game_system.se_play($data_system.cursor_se)
@index -= 1
end
end
# If R button was pressed
if Input.repeat?(Input::R)
# If bottom row being displayed is more to front than bottom data row
if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
# Move cursor 1 page back
$game_system.se_play($data_system.cursor_se)
@index = [@index + self.page_item_max, @item_max - 1].min
self.top_row += self.page_row_max
end
end
# If L button was pressed
if Input.repeat?(Input::L)
# If top row being displayed is more to back than 0
if self.top_row > 0
# Move cursor 1 page forward
$game_system.se_play($data_system.cursor_se)
@index = [@index - self.page_item_max, 0].max
self.top_row -= self.page_row_max
end
end
end
# Update help text (update_help is defined by the subclasses)
if self.active and @help_window != nil
update_help
end
# Update cursor rectangle
update_cursor_rect
end
end

class Window_StatusCharacter1 < Window_Base

def initialize
super(0, 0, 440,180)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 22
refresh
end

def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.font.size = 20
self.contents.draw_text(215, -63, 144, 144, "Current State:")
self.contents.draw_text(190, 114, 120, 32, "Experience:")
self.contents.draw_text(0, -7, 120, 32, "Name:")
actor = @actor
@actor = $game_party.actors[0]
draw_actor_name(@actor, x + 55, y - 7)
draw_actor_state(@actor, 325, -8, 144)
draw_actor_parameter2(@actor, 0, 15 + 10, 0)
draw_actor_parameter2(@actor, 0, 15 + 40, 1)
draw_actor_parameter2(@actor, 0, 15 + 70, 2)
draw_actor_parameter2(@actor, 0, 15 + 100, 3)
draw_actor_parameter2(@actor, 190, 15 + 10, 4)
draw_actor_parameter2(@actor, 190, 15 + 40, 5)
draw_actor_parameter2(@actor, 190, 15 + 70, 6)
draw_actor_barz(@actor, 0, 15 + 37, "horizontal", 168, 1, @actor.atk, 999, Color.new(242, 2, 6, 255), Color.new(253, 53, 56, 255))
draw_actor_barz(@actor, 0, 15 + 67, "horizontal", 168, 1, @actor.pdef, 999, Color.new(228, 253, 48, 255), Color.new(238, 254, 124, 255))
draw_actor_barz(@actor, 0, 15 + 97, "horizontal", 168, 1, @actor.mdef, 999, Color.new(229, 78, 253, 255), Color.new(237, 134, 254, 255))
draw_actor_barz(@actor, 0, 15 + 127, "horizontal", 168, 1, @actor.str, 999, Color.new(254, 209, 154, 255), Color.new(253, 163, 53, 255))
draw_actor_barz(@actor, 190, 15 + 37, "horizontal", 168, 1, @actor.dex, 999, Color.new(222, 222, 222, 255), Color.new(255, 255, 255, 255))
draw_actor_barz(@actor, 190, 15 + 67, "horizontal", 168, 1, @actor.agi, 999, Color.new(8, 160, 253, 255), Color.new(119, 203, 254, 255))
draw_actor_barz(@actor, 190, 15 + 97, "horizontal", 168, 1, @actor.int, 999, Color.new(33, 253, 86, 255), Color.new(124, 254, 155, 255))
draw_actor_barz(@actor, 190, 15 + 127, "horizontal", 168, 1, @actor.now_exp.to_f, @actor.next_exp, Color.new(-255, 200, -86, 255), Color.new(-168, -157, 184, 255))
end

end

class Window_StatusCharacter2 < Window_Base

def initialize
super(0, 0, 440,200)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 22
refresh
end

def refresh
self.contents.clear
if $game_party.actors.size < 2
self.contents.draw_text(25, 55, 50, 28, "Empty")
else
self.contents.font.color = system_color
self.contents.font.size = 20
self.contents.draw_text(215, -63, 144, 144, "Current State:")
self.contents.draw_text(190, 114, 120, 32, "Experience:")
self.contents.draw_text(0, -7, 120, 32, "Name:")
actor = @actor
@actor = $game_party.actors[1]
draw_actor_name(@actor, x + 55, y - 7)
draw_actor_state(@actor, 325, -8, 144)
draw_actor_parameter2(@actor, 0, 15 + 10, 0)
draw_actor_parameter2(@actor, 0, 15 + 40, 1)
draw_actor_parameter2(@actor, 0, 15 + 70, 2)
draw_actor_parameter2(@actor, 0, 15 + 100, 3)
draw_actor_parameter2(@actor, 190, 15 + 10, 4)
draw_actor_parameter2(@actor, 190, 15 + 40, 5)
draw_actor_parameter2(@actor, 190, 15 + 70, 6)
draw_actor_barz(@actor, 0, 15 + 37, "horizontal", 168, 1, @actor.atk, 999, Color.new(242, 2, 6, 255), Color.new(253, 53, 56, 255))
draw_actor_barz(@actor, 0, 15 + 67, "horizontal", 168, 1, @actor.pdef, 999, Color.new(228, 253, 48, 255), Color.new(238, 254, 124, 255))
draw_actor_barz(@actor, 0, 15 + 97, "horizontal", 168, 1, @actor.mdef, 999, Color.new(229, 78, 253, 255), Color.new(237, 134, 254, 255))
draw_actor_barz(@actor, 0, 15 + 127, "horizontal", 168, 1, @actor.str, 999, Color.new(254, 209, 154, 255), Color.new(253, 163, 53, 255))
draw_actor_barz(@actor, 190, 15 + 37, "horizontal", 168, 1, @actor.dex, 999, Color.new(222, 222, 222, 255), Color.new(255, 255, 255, 255))
draw_actor_barz(@actor, 190, 15 + 67, "horizontal", 168, 1, @actor.agi, 999, Color.new(8, 160, 253, 255), Color.new(119, 203, 254, 255))
draw_actor_barz(@actor, 190, 15 + 97, "horizontal", 168, 1, @actor.int, 999, Color.new(33, 253, 86, 255), Color.new(124, 254, 155, 255))
draw_actor_barz(@actor, 190, 15 + 127, "horizontal", 168, 1, @actor.now_exp.to_f, @actor.next_exp, Color.new(-255, 200, -86, 255), Color.new(-168, -157, 184, 255))
end
end

end

class Scene_Load2 < Scene_File

def initialize
$game_temp = Game_Temp.new
$game_temp.last_file_index = 0
latest_time = Time.at(0)
for i in 0..3
filename = make_filename(i)
if FileTest.exist?(filename)
file = File.open(filename, "r")
if file.mtime > latest_time
latest_time = file.mtime
$game_temp.last_file_index = i
end
file.close
end
end
super("Which file would you like to load?")
end

def on_decision(filename)
unless FileTest.exist?(filename)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.load_se)
file = File.open(filename, "rb")
read_save_data(file)
file.close
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
$game_map.update
$scene = Scene_Map.new
end

def on_cancel
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(3)
end

def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)

if $game_system.magic_number != $data_system.magic_number
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
$game_party.refresh
end
end

class Window_EquipLeft2 < Window_Base

def initialize(actor)
super(0, 64, 272, 192)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
end

def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_level3(@actor, 4, 32)
draw_actor_parameter(@actor, 4, 64, 0)
draw_actor_parameter(@actor, 4, 96, 1)
draw_actor_parameter(@actor, 4, 128, 2)
if @new_atk != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 64, 40, 32, "->", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2)
end
if @new_pdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 96, 40, 32, "->", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2)
end
if @new_mdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 128, 40, 32, "->", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
end
end

def set_new_parameters(new_atk, new_pdef, new_mdef)
if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef
@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
refresh
end
end
end

class Window_EquipRight2 < Window_Selectable

def initialize(actor)
super(272, 64, 368, 192)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
self.index = 0
end

def item
return @data[self.index]
end

def refresh
self.contents.clear
@data = []
@data.push($data_weapons[@actor.weapon_id])
@data.push($data_armors[@actor.armor1_id])
@data.push($data_armors[@actor.armor2_id])
@data.push($data_armors[@actor.armor3_id])
@data.push($data_armors[@actor.armor4_id])
@item_max = @data.size
self.contents.font.color = system_color
self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
draw_item_name(@data[0], 92, 32 * 0)
draw_item_name(@data[1], 92, 32 * 1)
draw_item_name(@data[2], 92, 32 * 2)
draw_item_name(@data[3], 92, 32 * 3)
draw_item_name(@data[4], 92, 32 * 4)
end

def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end

class Window_Character_Selection1 < Window_Selectable3

attr_accessor :commands

def initialize(commands)
super(0, 50, 640, 50)
self.contents = Bitmap.new(width - 32, height - 32)
@commands = commands
@width = width
if $game_party.actors.size < 2
@item_max = 1
@column_max = 1
else
@item_max = 2
@column_max =2
end
@commands = 2
self.visible = false
self.active = false
self.index = -1
self.z = 2000
refresh
end


def refresh
self.contents.clear
self.contents.font.color = system_color
if $game_party.actors.size < 2
self.contents.draw_text(180, -6, 144, 32, $game_party.actors[0].name, 2)
else
self.contents.draw_text(120, -6, 144, 32, $game_party.actors[0].name, 2)
self.contents.draw_text(240, -6, 144, 32, $game_party.actors[1].name, 2)
end
end
end

class Scene_Equip2

def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@equip_index = equip_index
end

def main
@actor = $game_party.actors[@actor_index]
@help_window = Window_Help.new
@left_window = Window_EquipLeft2.new(@actor)
@right_window = Window_EquipRight2.new(@actor)
@item_window1 = Window_EquipItem.new(@actor, 0)
@item_window2 = Window_EquipItem.new(@actor, 1)
@item_window3 = Window_EquipItem.new(@actor, 2)
@item_window4 = Window_EquipItem.new(@actor, 3)
@item_window5 = Window_EquipItem.new(@actor, 4)
@right_window.help_window = @help_window
@item_window1.help_window = @help_window
@item_window2.help_window = @help_window
@item_window3.help_window = @help_window
@item_window4.help_window = @help_window
@item_window5.help_window = @help_window
@right_window.index = @equip_index
refresh
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@left_window.dispose
@right_window.dispose
@item_window1.dispose
@item_window2.dispose
@item_window3.dispose
@item_window4.dispose
@item_window5.dispose
end

def refresh
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
item1 = @right_window.item
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
end

if @right_window.active
@left_window.set_new_parameters(nil, nil, nil)
end
if @item_window.active
item2 = @item_window.item
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
end
end

def update
@left_window.update
@right_window.update
@item_window.update
refresh
if @right_window.active
update_right
return
end

if @item_window.active
update_item
return
end
end

def update_right
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(2)
return
end

if Input.trigger?(Input::C)
if @actor.equip_fix?(@right_window.index)
$game_system.se_play($data_system.buzzer_se)
return
end

$game_system.se_play($data_system.decision_se)
@right_window.active = false
@item_window.active = true
@item_window.index = 0
return
end

if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Equip2.new(@actor_index, @right_window.index)
return
end

if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Equip2.new(@actor_index, @right_window.index)
return
end
end

def update_item
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@right_window.active = true
@item_window.active = false
@item_window.index = -1
return
end

if Input.trigger?(Input::C)
$game_system.se_play($data_system.equip_se)
item = @item_window.item
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
@right_window.active = true
@item_window.active = false
@item_window.index = -1
@right_window.refresh
@item_window.refresh
return
end
end
end

class Window_Graphic1 < Window_Base

def initialize
super(0, 0, 280, 200)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end

def refresh
self.contents.clear
actor = $game_party.actors[0]
draw_actor_battler(actor, x + 130, y + 200)
end
end

class Window_Graphic2 < Window_Base

def initialize
super(0, 0, 280, 220)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end

def refresh
self.contents.clear
if $game_party.actors.size < 2
self.contents.clear
else
actor = $game_party.actors[1]
draw_actor_battler(actor, x + 130, y + 200)
end
end
end

class Window_SkillStatus < Window_Base

def initialize(actor)
super(0, 64, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
end

def refresh
self.contents.clear
draw_actor_name(@actor, 0, 0)
draw_actor_state(@actor, 150, 0)
draw_actor_hp2(@actor, 270, 0)
draw_actor_sp2(@actor, 440, 0)
end
end

class Scene_Skill2

def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end

def main
@actor = $game_party.actors[@actor_index]
@help_window = Window_Help.new
@status_window = Window_SkillStatus.new(@actor)
@skill_window = Window_Skill.new(@actor)
@skill_window.help_window = @help_window
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@status_window.dispose
@skill_window.dispose
@target_window.dispose
end

def update
@help_window.update
@status_window.update
@skill_window.update
@target_window.update
if @skill_window.active
update_skill
return
end

if @target_window.active
update_target
return
end
end

def update_skill
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(1)
return
end

if Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill == nil or not @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)

if @skill.scope >= 3
@skill_window.active = false
@target_window.x = (@skill_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
if @skill.scope == 4 || @skill.scope == 6
@target_window.index = -1
elsif @skill.scope == 7
@target_window.index = @actor_index - 10
else
@target_window.index = 0
end
else
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
@status_window.refresh
@skill_window.refresh
@target_window.refresh
$scene = Scene_Map.new
return
end
end
return
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill.new(@actor_index)
return
end

if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill.new(@actor_index)
return
end
end

def update_target
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@skill_window.active = true
@target_window.visible = false
@target_window.active = false
return
end

if Input.trigger?(Input::C)
unless @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end

if @target_window.index == -1
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end

if @target_window.index <= -2
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end

if @target_window.index >= 0
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end

if used
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
@status_window.refresh
@skill_window.refresh
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$scene = Scene_Map.new
return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end


class Scene_Menu

def initialize(menu_index = 0)
@menu_index = menu_index
end

def main
@update_frame = 0

@window_location = Window_Location.new
@window_location.x =420

@window_character_selection1 = Window_Character_Selection1.new(@commands)
@window_character_selection1.y = 50

@window_character_selection2 = Window_Character_Selection2 .new


@window_character1_graphic = Window_GraphicCharacter1.new
@window_character1_graphic.y =100
@window_character1_graphic.frame_update
@window_character1_graphic.opacity = 0
@window_character1_graphic.back_opacity = 0

@window_character2_graphic = Window_GraphicCharacter2.new
@window_character2_graphic.y =280
@window_character2_graphic.frame_update
@window_character2_graphic.opacity = 0
@window_character2_graphic.back_opacity = 0

@window_character1 = Window_Character1.new
@window_character1.y =100

@window_character2 = Window_Character2.new
@window_character2.y =280

@window_status_character1 = Window_StatusCharacter1.new
@window_status_character1.x =200
@window_status_character1.y =100

@window_status_character2 = Window_StatusCharacter2.new
@window_status_character2.x =200
@window_status_character2.y =280

@playtime_window = Window_PlayTime.new
@playtime_window.x = 270

@graphic1 = Window_Graphic1.new
@graphic1.x = 240
@graphic1.y = 92
@graphic1.z = 501
@graphic1.opacity = 0
@graphic1.back_opacity = 0
@graphic1.contents_opacity = 100

@graphic2 = Window_Graphic2.new
@graphic2.x = 240
@graphic2.y = 272
@graphic2.z = 501
@graphic2.opacity = 0
@graphic2.back_opacity = 0
@graphic2.contents_opacity = 100

@command_window = Window_Command2.new(["Item", "Skill", "Equip", "Load", "Save", "Quit"])
@command_window.index = @menu_index

@dummy_window = Dummy_Window_Command.new
@dummy_window.z = 500
@dummy_window.opacity = 0
@dummy_window.back_opacity = 0

@dummy_window_icons = Dummy_Window_Command2.new
@dummy_window_icons.opacity = 0
@dummy_window_icons.back_opacity = 0
@dummy_window_icons.contents_opacity = 100

Graphics.transition
loop do
Graphics.update
Input.update
@update_frame += 1
if @update_frame == 5
@update_frame = 0
@window_character2_graphic.frame_update
@window_character1_graphic.frame_update
end

update
if $scene != self
break
end
end

Graphics.freeze
@window_location.dispose
@window_character1.dispose
@window_status_character1.dispose
@window_character2.dispose
@window_status_character2.dispose
@playtime_window.dispose
@command_window.dispose
@graphic1.dispose
@graphic2.dispose
@dummy_window.dispose
@dummy_window_icons.dispose
@window_character1_graphic.dispose
@window_character2_graphic.dispose
@window_character_selection1.dispose
@window_character_selection2.dispose
end

def update
@playtime_window.update
@command_window.update
@window_character_selection1.update

if @command_window.active
update_command
return
end

if @window_character_selection1.active
update_character
return
end
end

def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end

if Input.trigger?(Input::C)
if $game_party.actors.size == 0 and @command_window.index < 4
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
when 1
$game_system.se_play($data_system.decision_se)
@window_character_selection1.visible = true
@window_character_selection2.visible = true
@window_character_selection1.active = true
@window_character_selection1.index = 0
@command_window.active = false
when 2
$game_system.se_play($data_system.decision_se)
@window_character_selection1.visible = true
@window_character_selection1.active = true
@window_character_selection2.visible = true
@window_character_selection1.index = 0
@command_window.active = false
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Load2.new
when 4
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save.new
when 5
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
end
return
end
end

def update_character
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@window_character_selection1.visible = false
@window_character_selection1.active = false
@window_character_selection2.visible = false
@window_character_selection1.index = -1
return
end

if Input.trigger?(Input::C)
if $game_party.actors.size == 0 and @command_window.index < 4
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 1
$game_system.se_play($data_system.decision_se)
case @window_character_selection1.index
when 0
$scene = Scene_Skill2.new(@window_character_selection1.index)
when 1
$scene = Scene_Skill2.new(@window_character_selection1.index)
end
when 2
$game_system.se_play($data_system.decision_se)
case @window_character_selection1.index
when 0
$scene = Scene_Equip2.new(@window_character_selection1.index)
when 1
$scene = Scene_Equip2.new(@window_character_selection1.index)
end
end
return
end
end
end
 

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