here's the code I forgot who wrote it
#============================================================
# Custom Menu System (1-Person)
# created by: Constance
# created on: March 29, 2006
# version: 1.0
# 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
#============================================================
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#How to Install
#Copy and paste this whole script right before main. That's it. If you have any questions you may
#post them but I prefer them to be posted at rmxp.invisionplus.net or contact me through email
#at constance_avixen@hotmail.com. The script is totally customizable, and no credit is needed.
#Thanks for testing this script out!
#P.S. If things get confusing go to the Scenes section at line 573. I've made comments there so
#you can go through and mess with stuff it if you get lost.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#----------------------
#Windows Section
#----------------------
class Window_NewCommand < Window_Selectable
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 Window_Commands < 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 Window_Icons < 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 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_level2(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_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_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_Character < 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
@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_StatusCharacter < 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
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_Battler < Window_Base
def initialize
super(0, 0, 280, 240)
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_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 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_level2(@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_Sprite < 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_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 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
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#----------------------
#Scenes Section
#----------------------
#==============================================================================
# ** Scene_Skill2
#------------------------------------------------------------------------------
# This class performs skill screen processing.
#==============================================================================
class Scene_Skill2
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Get actor
@actor = $game_party.actors[@actor_index]
# Make help window, status window, and skill window
@help_window = Window_Help.new
@status_window = Window_SkillStatus.new(@actor)
@skill_window = Window_Skill.new(@actor)
# Associate help window
@skill_window.help_window = @help_window
# Make target window (set to invisible / inactive)
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@help_window.dispose
@status_window.dispose
@skill_window.dispose
@target_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@help_window.update
@status_window.update
@skill_window.update
@target_window.update
# If skill window is active: call update_skill
if @skill_window.active
update_skill
return
end
# If skill target is active: call update_target
if @target_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if skill window is active)
#--------------------------------------------------------------------------
def update_skill
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(1)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the skill window
@skill = @skill_window.skill
# If unable to use
if @skill == nil or not @actor.skill_can_use?(@skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# If effect scope is ally
if @skill.scope >= 3
# Activate target window
@skill_window.active = false
@target_window.x = (@skill_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
# Set cursor position to effect scope (single / all)
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
# If effect scope is other than ally
else
# If common event ID is valid
if @skill.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = @skill.common_event_id
# Play use skill SE
$game_system.se_play(@skill.menu_se)
# Use up SP
@actor.sp -= @skill.sp_cost
# Remake each window content
@status_window.refresh
@skill_window.refresh
@target_window.refresh
# Switch to map screen
$scene = Scene_Map.new
return
end
end
return
end
# If R button was pressed
if Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To next actor
@actor_index += 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_Skill.new(@actor_index)
return
end
# If L button was pressed
if Input.trigger?(Input::L)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To previous actor
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_Skill.new(@actor_index)
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when target window is active)
#--------------------------------------------------------------------------
def update_target
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Erase target window
@skill_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If unable to use because SP ran out
unless @actor.skill_can_use?(@skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If target is all
if @target_window.index == -1
# Apply skill use effects to entire party
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
# If target is user
if @target_window.index <= -2
# Apply skill use effects to target actor
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
# If single target
if @target_window.index >= 0
# Apply skill use effects to target actor
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
# If skill was used
if used
# Play skill use SE
$game_system.se_play(@skill.menu_se)
# Use up SP
@actor.sp -= @skill.sp_cost
# Remake each window content
@status_window.refresh
@skill_window.refresh
@target_window.refresh
# If entire party is dead
if $game_party.all_dead?
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If command event ID is valid
if @skill.common_event_id > 0
# Command event call reservation
$game_temp.common_event_id = @skill.common_event_id
# Switch to map screen
$scene = Scene_Map.new
return
end
end
# If skill wasn't used
unless used
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs equipment screen processing.
#==============================================================================
class Scene_Equip2
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
# equip_index : equipment index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@equip_index = equip_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Get actor
@actor = $game_party.actors[@actor_index]
# Make windows
@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)
# Associate help window
@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
# Set cursor position
@right_window.index = @equip_index
refresh
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@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
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Set item window to visible
@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)
# Get currently equipped item
item1 = @right_window.item
# Set current item window to @item_window
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 is active
if @right_window.active
# Erase parameters for after equipment change
@left_window.set_new_parameters(nil, nil, nil)
end
# If item window is active
if @item_window.active
# Get currently selected item
item2 = @item_window.item
# Change equipment
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
# Get parameters for after equipment change
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
# Return equipment
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# Draw in left window
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@left_window.update
@right_window.update
@item_window.update
refresh
# If right window is active: call update_right
if @right_window.active
update_right
return
end
# If item window is active: call update_item
if @item_window.active
update_item
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when right window is active)
#--------------------------------------------------------------------------
def update_right
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(2)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If equipment is fixed
if @actor.equip_fix?(@right_window.index)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Activate item window
@right_window.active = false
@item_window.active = true
@item_window.index = 0
return
end
# If R button was pressed
if Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To next actor
@actor_index += 1
@actor_index %= $game_party.actors.size
# Switch to different equipment screen
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
# If L button was pressed
if Input.trigger?(Input::L)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To previous actor
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# Switch to different equipment screen
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when item window is active)
#--------------------------------------------------------------------------
def update_item
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Activate right window
@right_window.active = true
@item_window.active = false
@item_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play equip SE
$game_system.se_play($data_system.equip_se)
# Get currently selected data on the item window
item = @item_window.item
# Change equipment
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
# Activate right window
@right_window.active = true
@item_window.active = false
@item_window.index = -1
# Remake right window and item window contents
@right_window.refresh
@item_window.refresh
return
end
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
# This class performs load screen processing.
#==============================================================================
class Scene_Load2 < Scene_File
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Remake temporary object
$game_temp = Game_Temp.new
# Timestamp selects new file
$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
#--------------------------------------------------------------------------
# * Decision Processing
#--------------------------------------------------------------------------
def on_decision(filename)
# If file doesn't exist
unless FileTest.exist?(filename)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play load SE
$game_system.se_play($data_system.load_se)
# Read save data
file = File.open(filename, "rb")
read_save_data(file)
file.close
# Restore BGM and BGS
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
# Update map (run parallel process event)
$game_map.update
# Switch to map screen
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Cancel Processing
#--------------------------------------------------------------------------
def on_cancel
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to title screen
$scene = Scene_Menu.new(3)
end
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
def read_save_data(file)
# Read character data for drawing save file
characters = Marshal.load(file)
# Read frame count for measuring play time
Graphics.frame_count = Marshal.load(file)
# Read each type of game object
$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 magic number is different from when saving
# (if editing was added with editor)
if $game_system.magic_number != $data_system.magic_number
# Load map
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
# Refresh party members
$game_party.refresh
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
#*************Character Coding****************
#Character's Small Status Window
@window_character = Window_Character.new
@window_character.y =280
#-----------------------
#Character's Large Status Window
@window_status_character = Window_StatusCharacter.new
@window_status_character.x =200
@window_status_character.y =280
#-----------------------
#Character's Animated Sprite Window
@window_sprite = Window_Sprite.new
@window_sprite.y =280
@window_sprite.frame_update
@window_sprite.opacity = 0
@window_sprite.back_opacity = 0
#-----------------------
#Character's Battler Window
@window_battler = Window_Battler.new
@window_battler.x = 240
@window_battler.y = 252
@window_battler.z = 501
@window_battler.opacity = 0
@window_battler.back_opacity = 0
@window_battler.contents_opacity = 100
#================================
#**********Command Window Coding************
#The command window which bases it's commands off of @commands
@commands = ["Item", "Skill", "Equip", "Load", "Save", "Quit"]
@command_window = Window_NewCommand.new(@commands)
#Dummy Window containing the command's words
@window_commands = Window_Commands.new
@window_commands.z = 500
@window_commands.opacity = 0
@window_commands.back_opacity = 0
#Dummy Window containing the pictures of the icons
@window_icons = Window_Icons.new
@window_icons.opacity = 0
@window_icons.back_opacity = 0
@window_icons.contents_opacity = 100
#================================
#************Miscellaneous Coding**************
#Creates the Sprite's Frame
@update_frame = 0
#-----------------------
#Location Window
@window_location = Window_Location.new
@window_location.x =420
#-----------------------
#Playtime Window
@playtime_window = Window_PlayTime.new
@playtime_window.x = 270
#-----------------------
#Map in the Background
@spriteset = Spriteset_Map.new
#Holds ALL windows in one instance variable for better management
@windows =[@window_location, @window_character, @window_status_character,
@playtime_window, @command_window, @window_battler, @window_commands,
@window_icons, @window_sprite, @spriteset]
#================================
# Execute transition
Graphics.transition
# Main Loop
loop do
# Update game screen
Graphics.update
#Update input information
Input.update
#**********Frame Updates for Sprite*************
@update_frame += 1
if @update_frame == 5
@update_frame = 0
@window_sprite.frame_update
end
#**********Frame Updates for Sprite*************
# Frame update
update
#Abort Loop if Screen is Changed
if $scene != self
break
end
end
#Dispose of Windows
Graphics.freeze
@windows.each {|windows| windows.dispose}
end
#================================
#Update Method
def update
@playtime_window.update
@command_window.update
#Sets a Condition for Command Window
if @command_window.active
update_command
return
end
end
#Update Command Method
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 for Command Window's Index
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)
$scene = Scene_Skill2.new(0)
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip2.new(0)
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
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#End of Script >-< Sorry, but it was longer before! lol
and this isn't my sprite but it is the size I will be using