VX 스크립트

 I installed the lufia script and working fine sofar now i wanne know how i can add extra menu items in the script
시작

#=========================================================================
=====
# ** TDS Lufia Rise of the Sinistrals CMS v 1.0
# Version: 1.0
#------------------------------------------------------------------------------
# This script allows for the creation of objects trough a menu using other
# objects and alchemic methods as the base for their creation.
#==============================================================================
# WARNING:
#
# Do not release, distribute or change my work without my expressed written
# consent, doing so violates the terms of use of this work.
#
# * Not Knowing English or understanding these terms will not excuse you in any
# way from the consequenses.
#
# * This applies to all of my work whether they have thiss notice or not.
#
# Contact Email: Sephirothtds@hotmail.com
#==============================================================================
# This is a system replication in no way meant to be used or distributed in any
# game or for any profit monetary or other.
#==============================================================================

#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This is a superclass of all windows in the game.
#==============================================================================

class Window_Base < Window
#--------------------------------------------------------------------------
# * Constants
#--------------------------------------------------------------------------
WLH = 24 # Window Line Height
#--------------------------------------------------------------------------
# * Draw HP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : Width
# no_bar : drawing bar flag
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y, width = 120, no_bar = false)
if no_bar == false
draw_actor_hp_gauge(actor, x, y, width)
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 30, WLH, Vocab::hp_a)
self.contents.font.color = hp_color(actor)
last_font_size = self.contents.font.size
xr = x + width
if width < 120
self.contents.draw_text(xr - 44, y, 44, WLH, actor.hp, 2)
else
self.contents.draw_text(xr - 99, y, 44, WLH, actor.hp, 2)
self.contents.font.color = normal_color
self.contents.draw_text(xr - 55, y, 11, WLH, "/", 2)
self.contents.draw_text(xr - 44, y, 44, WLH, actor.maxhp, 2)
end
end
#--------------------------------------------------------------------------
# * Draw MP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : Width
# no_bar : drawing bar flag
#--------------------------------------------------------------------------
def draw_actor_mp(actor, x, y, width = 120, no_bar = false)
if no_bar == false
draw_actor_mp_gauge(actor, x, y, width)
end
self.contents.font.color = power_up_color
self.contents.draw_text(x, y, 30, WLH, Vocab::mp_a)
self.contents.font.color = mp_color(actor)
last_font_size = self.contents.font.size
xr = x + width
if width < 120
self.contents.draw_text(xr - 44, y, 44, WLH, actor.mp, 2)
else
self.contents.draw_text(xr - 99, y, 44, WLH, actor.mp, 2)
self.contents.font.color = normal_color
self.contents.draw_text(xr - 55, y, 11, WLH, "/", 2)
self.contents.draw_text(xr - 44, y, 44, WLH, actor.maxmp, 2)
end
end
end


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

class Window_Selectable < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :item_max # item count
attr_reader :column_max # digit count
attr_reader :index # cursor position
attr_reader :help_window # help window
# Custom cursor values
attr_accessor :use_custom_cursor # Custom cursor flag
attr_accessor :cursor_visible # Cursor visibility flag
attr_accessor :cursor_offsets # Cursor offsets values
attr_accessor :wait_cursor_offsets # Cursor offsets values
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y coordinate
# width : window width
# height : window height
# spacing : width of empty space when items are arranged horizontally
#--------------------------------------------------------------------------
def initialize(x, y, width, height, spacing = 32)
@item_max = 1
@column_max = 1
@index = -1
@spacing = spacing
# Cursor variables
@use_custom_cursor = false #true
@cursor_offsets = [0, 0]
@wait_cursor_offsets = [0, 0]
@cursor_visible = nil
super(x, y, width, height)
create_custom_cursor
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
self.contents.dispose
@sprite.bitmap.dispose
@sprite.dispose
super
end
#--------------------------------------------------------------------------
# * Create Custom Cursor
#--------------------------------------------------------------------------
def create_custom_cursor
@sprite = Sprite.new
@sprite.bitmap = Cache.system("Cursor")
@sprite.src_rect.width = @sprite.bitmap.width / 6
@sprite.x = self.x + 16
@sprite.y = self.y + 16 + 4
@sprite.visible = @use_custom_cursor
@sprite.z = 9999
update_cursor_graphic
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if cursor_movable?
last_index = @index
if Input.repeat?(Input::DOWN)
cursor_down(Input.trigger?(Input::DOWN))
end
if Input.repeat?(Input::UP)
cursor_up(Input.trigger?(Input::UP))
end
if Input.repeat?(Input::RIGHT)
cursor_right(Input.trigger?(Input::RIGHT))
end
if Input.repeat?(Input::LEFT)
cursor_left(Input.trigger?(Input::LEFT))
end
if Input.repeat?(Input::R)
cursor_pagedown
end
if Input.repeat?(Input::L)
cursor_pageup
end
if @index != last_index
Sound.play_cursor
end
end
update_cursor
call_update_help
if @use_custom_cursor == true
update_cursor_graphic
end
end

#--------------------------------------------------------------------------
# * Change cursor visibility
# value : true or false visibility
#--------------------------------------------------------------------------
def change_cursor_visibility(value)
@sprite.visible = value
end
#--------------------------------------------------------------------------
# * Update Cursor Graphic
#--------------------------------------------------------------------------
def update_cursor_graphic
@sprite.visible = @use_custom_cursor if @cursor_visible == nil
@sprite.visible = @cursor_visible if @cursor_visible != nil

if @use_custom_cursor == true
if self.visible == false or @index < 0
@sprite.opacity = 0
elsif self.visible == true or @index >= 0
@sprite.opacity = 255
end

if self.active
@sprite.bitmap = Cache.system("Cursor")
@sprite.src_rect.width = @sprite.bitmap.width / 6
else
@sprite.bitmap = Cache.system("Wait Cursor")
@sprite.src_rect.width = @sprite.bitmap.width / 7
end

if self.active
dx = self.x + self.cursor_rect.x + 16 + @cursor_offsets[0]
dy = self.y + self.cursor_rect.y + self.cursor_rect.height / 2 + 3 + @cursor_offsets[1]
else
dx = self.x + self.cursor_rect.x + 16 + @wait_cursor_offsets[0]
dy = self.y + self.cursor_rect.y + self.cursor_rect.height / 2 + 3 + @wait_cursor_offsets[1]
end
@sprite.x = dx
@sprite.y = dy
update_cursor_animation
end
end
#--------------------------------------------------------------------------
# * Update Cursor Animation
#--------------------------------------------------------------------------
def update_cursor_animation
@duration = -1 if @duration == nil
if self.active
@duration += 1
@duration %= 8
if @duration == 8 -1
@sprite.src_rect.x += 24
@sprite.src_rect.x %= 6 * 24
end
else
@duration += 1
@duration %= 8
if @duration == 8 - 1
@sprite.src_rect.x -= 24
@sprite.src_rect.x %= 7 * 24
end
end
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
self.contents.dispose
@sprite.dispose if @sprite != nil
super
end
#--------------------------------------------------------------------------
# * Update cursor
#--------------------------------------------------------------------------
def update_cursor
if @index < 0 # If the cursor position is less than 0
self.cursor_rect.empty # Empty cursor
else # If the cursor position is 0 or more
row = @index / @column_max # Get current row
if row < top_row # If before the currently displayed
self.top_row = row # Scroll up
end
if row > bottom_row # If after the currently displayed
self.bottom_row = row # Scroll down
end
rect = item_rect(@index) # Get rectangle of selected item
rect.y -= self.oy # Match rectangle to scroll position
self.cursor_rect = rect # Refresh cursor rectangle
end
end
#--------------------------------------------------------------------------
# * Call help window update method
#--------------------------------------------------------------------------
def call_update_help
if self.active and @help_window != nil
update_help
end
end
#--------------------------------------------------------------------------
# * Update help window (contents are defined by the subclasses)
#--------------------------------------------------------------------------
def update_help
end
end


#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
# This window deals with general command choices.
#==============================================================================

class TDS_Window_Command < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :commands # command
#--------------------------------------------------------------------------
# * Object Initialization
# width : window width
# commands : command string array
# column_max : digit count (if 2 or more, horizontal selection)
# row_max : row count (0: match command count)
# spacing : blank space when items are arrange horizontally
#--------------------------------------------------------------------------
def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)
if row_max == 0
row_max = (commands.size + column_max - 1) / column_max
end
super(0, 0, width, row_max * WLH + 32, spacing)
self.windowskin = Cache.system("TDS-Lufia Window")
self.back_opacity = 255
@use_custom_cursor = true
@cursor_offsets = [-4, 0]
@commands = commands
@item_max = commands.size
@column_max = column_max
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Return_Command_Name
#--------------------------------------------------------------------------
def return_command_name(index)
return @commands[index]
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# enabled : enabled flag. When false, draw semi-transparently.
#--------------------------------------------------------------------------
def draw_item(index, enabled = true)
rect = item_rect(index)
rect.x += 26
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(rect, @commands[index])
end
end


#============== ================================================================
# ** TDS Lufia Menu
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================

class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
# Flag variables
@viewing_spell_information_window = false
@viewing_item_information_window = false
@viewing_scenario_information_window = false
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
# Create Menu Back Sprite
@menuback_sprite = Sprite.new
@menuback_sprite.bitmap = Cache.system("Lufia Menu Back")
# Create Scene Header
@scene_header = Window_Base.new(20, 198, 140, 56)
@scene_header.windowskin = Cache.system("TDS-Lufia Window")
@scene_header.back_opacity = 255
@scene_header.contents = Bitmap.new(140-32,56-32)
@scene_header.contents.font.color = @scene_header.text_color(0)
@scene_header.contents.draw_text(0,0,140-32, 24, "ITEM",1)
@scene_header.visible = false
# Create Dummy Help Window
@dummy_help_window = Window_Base.new(20, 305, 505, 101)
@dummy_help_window.windowskin = Cache.system("TDS-Lufia Window")
@dummy_help_window.contents = Bitmap.new(505-32,56-32)
@dummy_help_window.contents.font.color = @dummy_help_window.text_color(0)
@dummy_help_window.contents.draw_text(0, 0 , 505-32, 24, "HELP",1)
@dummy_help_window.back_opacity = 255
@dummy_help_window.visible = false
# Create Help Window Header
@scene_help_header = Window_Base.new(20, 254, 505, 56)
@scene_help_header.windowskin = Cache.system("TDS-Lufia Window")
@scene_help_header.back_opacity = 255
@scene_help_header.contents = Bitmap.new(505-32,56-32)
@scene_help_header.contents.font.color = @scene_help_header.text_color(0)
@scene_help_header.contents.draw_text(0, 0 , 505-32, 24, "Item name",1)
@scene_help_header.visible = false
# Create Scenario header
@scenario_header = Window_Base.new(20, 198, 300, 56)
@scenario_header.windowskin = Cache.system("TDS-Lufia Window")
@scenario_header.back_opacity = 255
@scenario_header.contents = Bitmap.new(300-32,56-32)
@scenario_header.contents.font.color = @scene_header.text_color(0)
@scenario_header.contents.draw_text(0,0,300-32, 24, "SCENARIO ITEMS",1)
@scenario_header.visible = false
# Create command windows
create_command_window
# Create Gold Window
@gold_time_window = Window_Gold_Time.new(265, 326)
# Create Main Status Window
@status_window = Window_MenuStatus.new(0, 0)
@status_window.active = false
# Activate main status window normal mode
@status_window.change_mode(0, true)
# Create Item Window
@item_window = TDS_Lufia_Window_Item.new(20, 254, 505, 152)
@item_window.index = 0
@item_window.active = false
@item_window.visible = false
# Create Skill Window
@skill_window = TDS_Lufia_Window_Skill.new(20, 254, 505, 152, $game_party.members[0])
@skill_window.active = false
@skill_window.visible = false
# Flag variables
@viewing_item_information_window = false
@viewing_spell_information_window = false
@viewing_scenario_information_window = false
# Update flag values
@update_item_processing = false
@update_spell_processing = false
@update_scenario_mode_processing = false
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
# Create Command Window
@command_window = TDS_Window_Command.new(390, ["ITEM", "STATUS", "SPELL",
"EQUIP", "SCENARIO", "FRIENDLIST", "SAVE", "END"], 2)
# Set command window x position
@command_window.x = 135
# Set command window y position
@command_window.y = 198
# Set command window index
@command_window.index = @menu_index
# If game party size is 0
if $game_party.members.size == 0 # If number of party members is 0
@command_window.draw_item(0, false) # Disable item
@command_window.draw_item(1, false) # Disable skill
@command_window.draw_item(2, false) # Disable equipment
@command_window.draw_item(3, false) # Disable status
end
# If saving disable
if $game_system.save_disabled # If save is forbidden
@command_window.draw_item(4, false) # Disable save
end
# Create Item Command Window
@item_command_window = TDS_Window_Command.new(365, ["USE", "ALL", "DROP"],3)
# Set item command window x
@item_command_window.x = 160
# Set item command window y
@item_command_window.y = 198
# Set item command visibility
@item_command_window.visible = false
# Set item command window active to false
@item_command_window.active = false
# Create Spell Command Window
@spell_command_window = TDS_Window_Command.new(365, ["USE", "ALL"],2)
# Set spell command window x
@spell_command_window.x = 160
# Set spell command window y
@spell_command_window.y = 198
# Set spell command window visible to false
@spell_command_window.visible = false
# Set Spell command window active to false
@spell_command_window.active = false
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# Update command windows
@command_window.update
@spell_command_window.update
@item_command_window.update
# Update windows
@gold_time_window.update
@status_window.update
@item_window.update
@skill_window.update
# If command window active
if @command_window.active
update_command_selection
end

# If status window is active and it's on normal mode
if @status_window.active and @status_window.normal_mode
# Update main menu actor selection
update_main_actor_selection
end
# If item processing flag is true update item methods
if @update_item_processing
# Update Item Choosing if Item window is active or viewing item information
if @item_window.active == true or @viewing_item_information_window
update_item_choosing
end
# Update Item Command Arrange Choosing if Item Command window is active
if @item_command_window.active
update_item_command_choosing
end
# If status window is active and it's on item mode
if @status_window.active and @status_window.item_mode
update_item_target_choosing
end
end
# If skill prcoessing flag is true update skill methods
if @update_spell_processing
# Update skill arrange choosing if spell command window is active
if @spell_command_window.active
update_skill_command_choosing
end
# Update skill choosing if skill window is active or viewing skill information
if @skill_window.active or @viewing_spell_information_window
update_skill_choosing
end
# If status window is active and it's on skill mode
if @status_window.active and @status_window.skill_mode
update_skill_target_choosing
end
end

# If scenario processing flag is true update Scenario methods
if @update_scenario_mode_processing

# Update sceneario item viewing pro
update_scenario_item_choosing
end

end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
return
end
# If Input trigger Confirm
if Input.trigger?(Input::C)
case @command_window.return_command_name(@command_window.index)
when "ITEM"
# Play desicion sound
Sound.play_decision
# Start item scene processing
start_item_scene
# Update input
Input.update
return
when "STATUS"
start_main_actor_selection
when "SPELL"
start_main_actor_selection
when "EQUIP"
start_main_actor_selection
when "SCENARIO"
# Play desicion sound
Sound.play_decision
# Start scenario scene processing
start_scenario_mode
return
when "FRIENDLIST"
# Play desicion sound
Sound.play_decision
# Start scenario scene processing
start_scenario_mode
return
when "SAVE"
# Play desicion sound
Sound.play_decision
$scene = Scene_File.new(true, false, false)
return
when "END"
# Play desicion sound
Sound.play_decision
$scene = Scene_End.new
return
end
end
end
#--------------------------------------------------------------------------
# * Start Main Actor Selection
#--------------------------------------------------------------------------
def start_main_actor_selection
if $game_party.members.size == 0
Sound.play_buzzer
return
end
# Play desicion sound
Sound.play_decision
# Deactivate command window
@command_window.active = false
# Activate status window and make cursor visible
@status_window.active = true
@status_window.index = 0
# Input update
Input.update
return
end
#--------------------------------------------------------------------------
# * End Main Actor Selection
#--------------------------------------------------------------------------
def end_main_actor_selection
# Deactivate status window and make cursor invisible
@status_window.active = false
@status_window.index = -1
# Activate command window
@command_window.active = true
return
end
#--------------------------------------------------------------------------
# * Update Actor Selection
#--------------------------------------------------------------------------
def update_main_actor_selection
# If input trigger is cancel
if Input.trigger?(Input::B)
# Play cancel sound
Sound.play_cancel
# End main actor selection
end_main_actor_selection
return
end
# If input trigger confirm
if Input.trigger?(Input::C)
# Play desicion sound
Sound.play_decision
case @command_window.return_command_name(@command_window.index)
when "STATUS"
# Change scene to Scene Status
$scene = Scene_Status.new(@status_window.index)
return
when "SPELL"
# Start skill methods
start_skill_scene
when "EQUIP"
# Change scene to Scene Equip
$scene = Scene_Equip.new(@status_window.index)
return
end
end
end


#==============================================================================
# ** Item Methods
#------------------------------------------------------------------------------
# These methods performs the item screen processing.
#==============================================================================

#--------------------------------------------------------------------------
# * Start Item Scene
#--------------------------------------------------------------------------
def start_item_scene
# Start updating item processing
@update_item_processing = true
# Set intial value for item for information
@item = nil
# Activate main status window normal mode
@status_window.change_mode(1, true)
# Deactivate status window
@status_window.active = false
# Set Old Index initial value
@old_item_command_index = 0
# Change item status window visibility
@command_window.visible = false
@command_window.active = false
# Changing visibily of gold window
@gold_time_window.visible = false
# Change scene header text color, text and visibility
@scene_header.contents.font.color = @scene_header.text_color(0)
@scene_header.contents.clear
@scene_header.contents.draw_text(0,0,140-32,56-32, "ITEM",1)
@scene_header.visible = true
# Activate the item command window
@item_command_window.visible = true
@item_command_window.index = 0
# Determining item index and activity
if @item_window.item_max == 0
@item_window.index = -1
@item_window.active = false
@item_command_window.active = true
else
@item_window.index = 0
@item_window.active = true
@item_command_window.active = false
end
# Changing command window visibility
@item_window.visible = true
end
#--------------------------------------------------------------------------
# * End Item Scene
#--------------------------------------------------------------------------
def end_item_scene
# Set value for item for information
@item = nil
# Activate main status window normal mode
@status_window.change_mode(0, true)
# Set Old Index value
@old_item_command_index = 0
# Changing item window visibility and active
@item_command_window.visible = false
@item_window.active = false
# Changing command window visibility and active
@item_window.visible = false
@item_window.active = false
# Change scene header visibility
@scene_header.contents.clear
@scene_header.visible = false
# Activating command window
@command_window.visible = true
@command_window.active = true
# Changing visibily of gold window
@gold_time_window.visible = true
# Deactivate status window and change index
@status_window.active = false
@status_window.index = -1
# Change viewing item information flag to false
@viewing_item_information_window = false
# End item processing
@update_item_processing = false
# Update Input
Input.update
return
end
#--------------------------------------------------------------------------
# * Update Item Command Choosing
#--------------------------------------------------------------------------
def update_item_command_choosing
# If old index is not equal to item command window idex
if @old_item_command_index != @item_command_window.index
# Update window display mode
update_item_window_display_mode
end
# If Input Trigger Cancel
if Input.trigger?(Input::B)
# Play cancel sound
Sound.play_cancel
# End item processing
end_item_scene
# Update Input
Input.update
return
end
# If Input trigger Confirm
if Input.trigger?(Input::C)
# If item window item max is 0
if @item_window.item_max == 0
# Play buzzer sound
Sound.play_buzzer
# Activate item command window
@item_command_window.active = true
# Deactivate item window
@item_window.active = false
# Update input
Input.update
return
end
# PLay desicion sound
Sound.play_decision
# Deactivate the command window
@item_command_window.active = false
# Activate the item window
@item_window.active = true
return
end
end
#--------------------------------------------------------------------------
# * Update Item Choosing
#--------------------------------------------------------------------------
def update_item_choosing
# If Input Trigger Cancel
if Input.trigger?(Input::B)
# Play cancel sound
Sound.play_cancel
# If viewing item information flag is true
if @viewing_item_information_window == true
# View item information
view_item_information(@item_window.item)
return
end
# Deactivate the item window
@item_window.active = false
# Set old index value to the item window index value
@old_item_window_index = @item_window.index
# Activate the command window
@item_command_window.active = true
# If item quantity is 0
if $game_party.item_number(@item) == 0
# Refresh item window
@item_window.refresh
end
# Update Input
Input.update
return
end
# If Input trigger Confirm not viewing item information
if Input.trigger?(Input::C) and @viewing_item_information_window == false
# Item command window index
case @item_command_window.index
when 0, 1 # Use or all items
use_item
when 2 # Drop
drop_item
end
end
# If Input Trigger CTRL
if Input.trigger?(Input::CTRL)
# PLay desicion sound
Sound.play_decision
# View item information
view_item_information(@item_window.item)
return
end
end
#--------------------------------------------------------------------------
# * Update Item Target Choosing
#--------------------------------------------------------------------------
def update_item_target_choosing
# If Input Trigger Cancel
if Input.trigger?(Input::B)
# Play cancel sound
Sound.play_cancel
# Deactivate status window
@status_window.active = false
# Change status window index making it invisible
@status_window.index = -1
# Activate the command window
@item_window.active = true
# If item quantity is 0
if $game_party.item_number(@item) == 0
# Refresh item window
@item_window.refresh
# Activate item command window
@item_command_window.active = true
# Deactivate item window
@item_window.active = false
end
# Set value for item for information
@item = nil
return
end
# If Input trigger Confirm
if Input.trigger?(Input::C)
if $game_party.item_can_use?(@item) == false
Sound.play_buzzer
else
determine_item_target
end
return
end
end
#--------------------------------------------------------------------------
# * Update Item Window Display Mode
#--------------------------------------------------------------------------
def update_item_window_display_mode
case @item_command_window.index
when 0
# Change item window mode to true and to display only use items
@item_window.only_items_mode(true)
# Change item window mode to false and to display all items
@item_window.all_items_mode(false)
# Change item window mode to drop items to false
@item_window.drop_items_mode(false)
# Refresh item window
@item_window.refresh
# Change cursor index to 0
@item_window.index = 0
when 1, 2
# Set old mode value for refresh
old_mode_value = @item_window.all_mode
# Change item window mode to false and to display only use items
@item_window.only_items_mode(false)
# Change item window mode to true and to display all items
@item_window.all_items_mode(true)
# Set item window index to 0 if the items in the window are more
if old_mode_value == false
# Refresh item window
@item_window.refresh
# Change cursor index to 0
@item_window.index = 0
end
end
# Set old command index to be the same as the
@old_item_command_index = @item_command_window.index
end
#--------------------------------------------------------------------------
# * Use Item
#--------------------------------------------------------------------------
def use_item
# Set item variable information
@item = @item_window.item
return Sound.play_buzzer if $game_party.item_can_use?(@item) == false
# PLay desicion sound
Sound.play_decision
# Deactivate the item window
@item_window.active = false
# Activate status window
@status_window.active = true
# Change status window index making it visible depending on the item scope
if @item.scope == 8 and $game_party.members.size > 1
@status_window.index = 100
else
@status_window.index = 0
end
# Update input
Input.update
return
end
#--------------------------------------------------------------------------
# * Drop Item
#--------------------------------------------------------------------------
def drop_item
# If Item window Item max is 0
if @item_window.item_max == 0
# Activate item command window
@item_command_window.active = true
# Deactivate item window
@item_window.active = false
else
# Set old item index
old_index = @item_window.index
# Play equip sound
Sound.play_equip
# Drop item
@item_window.drop_item(@item_window.item)
# Refresh item window
@item_window.refresh
# Set old index to the item window index if it's not 0
old_index %= @item_window.item_max if @item_window.item_max != 0
# Set item window index to old index
@item_window.index = old_index
# If item window item max is not 0
if @item_window.item_max == 0
# Play cancel sound
Sound.play_cancel
# Activate item command window
@item_command_window.active = true
end
# Update input
Input.update
return
end
end
#--------------------------------------------------------------------------
# * Confirm Item Target
# If there is no effect (such as using a potion on an incapacitated
# character), play a buzzer SE.
#--------------------------------------------------------------------------
def determine_item_target
# Item used is set to false
used = false
# if item is for all
if @item.for_all?
for target in $game_party.members
target.item_effect(target, @item)
used = true unless target.skipped
end
else
$game_party.last_target_index = @status_window.index
target = $game_party.members[@status_window.index]
target.item_effect(target, @item)
used = true unless target.skipped
end
# If use is true
if used
# Use item
use_item_nontarget
else
# Play buzzer sound
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# * Use Item (apply effects to non-ally targets)
#--------------------------------------------------------------------------
def use_item_nontarget
# Play item use sound
Sound.play_use_item
# Consume item
$game_party.consume_item(@item)
# Draw used item
@item_window.draw_item(@item_window.index)
# Refresh status window
@status_window.refresh
# If the party is all dead
if $game_party.all_dead?
# Change to scene game over
$scene = Scene_Gameover.new
# If item common event ID is more than 0
elsif @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$scene = Scene_Map.new
end
end
#--------------------------------------------------------------------------
# * View Item Information
# item : item from which to read data from
#--------------------------------------------------------------------------
def view_item_information(item)
# If viewing item information flag is false
if @viewing_item_information_window == false
item_info = item
# Change item window visibility and active
@item_window.visible = false
@item_window.active = false
# Change scene help header visibility, add text and change text color
@scene_help_header.visible = true
@scene_help_header.contents.font.color = @scene_help_header.text_color(0)
@scene_help_header.contents.clear
@scene_help_header.contents.draw_text(0, 0 , 505-32, 24, item_info.name,1)
# Change dummy help window visibility, add text and color
@dummy_help_window.visible = true
@dummy_help_window.contents.font.color = @dummy_help_window.text_color(0)
@dummy_help_window.contents.clear
@dummy_help_window.contents.font.size = 22
@dummy_help_window.contents.draw_text(0, -24, 505-32, 100-32, item_info.description.capitalize)
# Change viewing item information flag to true
@viewing_item_information_window = true
else
# Change item window visibility and active
@item_window.visible = true
@item_window.active = true
# Change help header window visibilty and clear text
@scene_help_header.visible = false
@scene_help_header.contents.clear
# Change dummy help window visibily and clear text
@dummy_help_window.visible = false
@dummy_help_window.contents.clear
# Change viewing item information flag to false
@viewing_item_information_window = false
return
end
end


#==============================================================================
# ** Skill Methods
#------------------------------------------------------------------------------
# These methods performs the Spell screen processing.
#==============================================================================


#--------------------------------------------------------------------------
# * Start Skill Scene
#--------------------------------------------------------------------------
def start_skill_scene
# Start updating spell processing
@update_spell_processing = true
# Set initial value for skill information
@skill = nil
# Activate main status window spell mode
@status_window.change_mode(2, true)
# Set old index initia value
@old_spell_value_command_index = 0
# Change command window visibility and active
@command_window.visible = false
@command_window.active = false
# Deactivate status window
@status_window.active = false
# Change spell command window visibility and active
@spell_command_window.visible = true
@spell_command_window.active = true
# Change spell command window to 0
@spell_command_window.index = 0
# Change skill window mode to show only usable skills
@skill_window.only_use_skill_mode(true)
# Change scene header text, color, visibility and add text
@scene_header.contents.font.color = @scene_header.text_color(0)
@scene_header.contents.clear
@scene_header.contents.draw_text(0,0,140-32,56-32, "SPELL",1)
@scene_header.visible = true
# Changing visibily of gold window
@gold_time_window.visible = false
# Refresh window contents
@skill_window.refresh($game_party.members[@status_window.index])
# Change skill window visibility
@skill_window.visible = true
# Change skill window index to 0
@skill_window.index = 0
# Input update
Input.update
return
end
#--------------------------------------------------------------------------
# * End Skill Scene
#--------------------------------------------------------------------------
def end_skill_scene
# End updating spell processing
@update_spell_processing = false
# Set value for skill information
@skill = nil
# Activate main status window normal mode
@status_window.change_mode(0, true)
# Set old index initia value
@old_spell_value_command_index = 0
# Deactivate status window and change index
@status_window.active = false
@status_window.index = -1
# Change skill window visibility
@skill_window.visible = false
# Change spell command window visibility and active
@spell_command_window.visible = false
@spell_command_window.active = false
# Change spell command window to 0
@spell_command_window.index = 0
# Change scene header visibility
@scene_header.contents.clear
@scene_header.visible = false
# Change command window visibility and active
@command_window.visible = true
@command_window.active = true
# Changing visibily of gold window
@gold_time_window.visible = true
# Update Input
Input.update
return
end
#--------------------------------------------------------------------------
# * Update Skill Command Choosing
#--------------------------------------------------------------------------
def update_skill_command_choosing
# If old index is not equal to item command window idex
if @old_spell_value_command_index != @spell_command_window.index
# Update window display mode
update_skill_window_display_mode
end
# If Input Trigger Cancel
if Input.trigger?(Input::B)
# Play cancel sound
Sound.play_cancel
# End spell processing
end_skill_scene
# Update Input
Input.update
return
end
# If not viewing spell information window
if @viewing_spell_information_window == false
# If Input trigger R
if Input.trigger?(Input::R)
# Play cursor sound
Sound.play_cursor
# Next actor
next_spell_actor
# If Input trigger L
elsif Input.trigger?(Input::L)
# Play cursor sound
Sound.play_cursor
# Previous actor
prev_spell_actor
end
end
# If Input trigger Confirm
if Input.trigger?(Input::C)
# If item window item max is 0
if @skill_window.item_max == 0
# Play buzzer sound
Sound.play_buzzer
# Activate spell command window
@spell_command_window.active = true
# Deactivate skill window
@skill_window.active = false
# Update input
Input.update
return
end
# Change skill window index to 0 if skill window index is more than skill window item max
@skill_window.index = 0 if @skill_window.index > @skill_window.item_max
# PLay desicion sound
Sound.play_decision
# Deactivate the command window
@spell_command_window.active = false
# Activate the skill window
@skill_window.active = true
# Update input
Input.update
return
end
end
#--------------------------------------------------------------------------
# * Update Skill Choosing
#--------------------------------------------------------------------------
def update_skill_choosing
# If Input Trigger Cancel
if Input.trigger?(Input::B)
# Play cancel sound
Sound.play_cancel

if @viewing_spell_information_window == true
# View skill information
view_skill_information(@skill_window.skill)
return
end
# Deactivate the skill window
@skill_window.active = false
# Activate spell command window
@spell_command_window.active = true
# Update Input
Input.update
return
end
# If not viewing spell information window
if @viewing_spell_information_window == false
# If Input trigger R
if Input.trigger?(Input::R)
# Play cursor sound
Sound.play_cursor
# Next actor
next_spell_actor
# If Input trigger L
elsif Input.trigger?(Input::L)
# Play cursor sound
Sound.play_cursor
# Previous actor
prev_spell_actor
end
end
# If Input trigger Confirm and not viewing skill information
if Input.trigger?(Input::C) and @viewing_spell_information_window == false
# Use skill
use_skill
# Update Input
Input.update
return
end


# If Input Trigger CTRL
if Input.trigger?(Input::CTRL)
# PLay desicion sound
Sound.play_decision
# View skill information
view_skill_information(@skill_window.skill)
return
end
end
#--------------------------------------------------------------------------
# * Update Skill Target Choosing
#--------------------------------------------------------------------------
def update_skill_target_choosing
# If Input Trigger Cancel
if Input.trigger?(Input::B)
# Play cancel sound
Sound.play_cancel
# Deactivate status window
@status_window.active = false
# Change status window index to the return index
@status_window.index = @return_status_index
# Activate the skill window
@skill_window.active = true
# Set value for skill information
@skill = nil
# Update input
Input.update
return
end
# If input trigger confirm
if Input.trigger?(Input::C)
# If actor can use skill
if @skill_window.actor.skill_can_use?(@skill)
# Determine if skill further usable
determine_skill
else
# Play buzzer sound
Sound.play_buzzer
end
end
end
#--------------------------------------------------------------------------
# * Update Skill Window Display Mode
#--------------------------------------------------------------------------
def update_skill_window_display_mode
case @spell_command_window.index
when 0
# Change skill window mode to show only usable skills
@skill_window.only_use_skill_mode(true)
# Change display of all skills mode to false
@skill_window.all_skill_display_mode(false)
when 1
# Change display of only usable skills to false
@skill_window.only_use_skill_mode(false)
# Change skill window mode to show all skills
@skill_window.all_skill_display_mode(true)
end
# Change old spell index value to spell window command index
@old_spell_value_command_index = @spell_command_window.index
# Refresh command window
@skill_window.refresh(@skill_window.actor)
# Change skill window index to 0 if skill window index is more than skill window item max
@skill_window.index = 0 if @skill_window.index > @skill_window.item_max
return
end
#--------------------------------------------------------------------------
# * Next Spell Actor
#--------------------------------------------------------------------------
def next_spell_actor
@actor_index = @status_window.index if @actor_index == nil
@actor_index += 1
@actor_index %= $game_party.members.size
@status_window.index = @actor_index
@skill_window.index = 0 if @skill_window.item_max != 0
@skill_window.refresh($game_party.members[@actor_index])
return @skill_window.active = false, @spell_command_window.active = true if @skill_window.actor.dead?
return @skill_window.active = false, @spell_command_window.active = true if @skill_window.item_max == 0
end
#--------------------------------------------------------------------------
# * Prev Spell Actor
#--------------------------------------------------------------------------
def prev_spell_actor
@actor_index = @status_window.index if @actor_index == nil
@actor_index += $game_party.members.size - 1
@actor_index %= $game_party.members.size
@status_window.index = @actor_index
@skill_window.index = 0 if @skill_window.item_max != 0
@skill_window.refresh($game_party.members[@actor_index])
return @skill_window.active = false, @spell_command_window.active = true if @skill_window.actor.dead?
return @skill_window.active = false, @spell_command_window.active = true if @skill_window.item_max == 0
end
#--------------------------------------------------------------------------
# * Use Skill
#--------------------------------------------------------------------------
def use_skill
# Set skill variable value to the currently used skill
@skill = @skill_window.skill
# If actor can use the skill
if @skill_window.actor.skill_can_use?(@skill)
# Play desicion sound
Sound.play_decision
# Change skill window active to false
@skill_window.active = false
# Set return status index to the current status index
@return_status_index = @status_window.index
# Change status window active to true
@status_window.active = true
# If skill scope covers all characters and there are more tnan 1 party members
if @skill.scope == 8 and $game_party.members.size > 1
# Make cursor select eveveryone
@status_window.index = 100
else
# Change status window index to 1
@status_window.index = 0
end
else
# Play buzzer sound
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# * Confirm Target
# If there is no effect (such as using a potion on an incapacitated
# character), play a buzzer SE.
#--------------------------------------------------------------------------
def determine_skill
# Set used value to false
used = false
# If skill is for all
if @skill.for_all?
for target in $game_party.members
target.skill_effect(@skill_window.actor, @skill)
used = true unless target.skipped
end
elsif @skill.for_user?
target = $game_party.members[@status_window.index]
target.skill_effect(target, @skill)
used = true unless target.skipped
else
$game_party.last_target_index = @status_window.index
target = $game_party.members[@status_window.index]
target.skill_effect(target, @skill)
used = true unless target.skipped
end
# If used is true
if used
use_skill_nontarget
else
# Play buzzer sound
Sound.play_buzzer
end
end
#--------------------------------------------------------------------------
# * Use Skill (apply effects to non-ally targets)
#--------------------------------------------------------------------------
def use_skill_nontarget
# Play use skill sound
Sound.play_use_skill
# Detract MP equal to the skill MP cost
@skill_window.actor.mp -= @skill_window.actor.calc_mp_cost(@skill)
# Refresh status window
@status_window.refresh
# Refresh skill window
@skill_window.refresh(@skill_window.actor)
# If the whole party is dead
if $game_party.all_dead?
$scene = Scene_Gameover.new
elsif @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$scene = Scene_Map.new
end
end
#--------------------------------------------------------------------------
# * View Skill Information
# skill : skill from which to read data from
#--------------------------------------------------------------------------
def view_skill_information(skill)
# If viewing spell information flag is false
if @viewing_spell_information_window == false
skill_info = skill
# Change skill window visibility and active
@skill_window.visible = false
@skill_window.active = false
# Change scene help header visibility, add text and change text color
@scene_help_header.visible = true
@scene_help_header.contents.font.color = @scene_help_header.text_color(0)
@scene_help_header.contents.clear
@scene_help_header.contents.draw_text(0, 0 , 505-32, 24, skill_info.name,1)
# Change dummy help window visibility, add text and color
@dummy_help_window.visible = true
@dummy_help_window.contents.font.color = @dummy_help_window.text_color(0)
@dummy_help_window.contents.clear
@dummy_help_window.contents.font.size = 22
@dummy_help_window.contents.draw_text(0, -24, 505-32, 100-32, skill_info.description.capitalize)
# Change viewing spell information flag to true
@viewing_spell_information_window = true
else
# Change skill window visibility and active
@skill_window.visible = true
@skill_window.active = true
# Change help header window visibilty and clear text
@scene_help_header.visible = false
@scene_help_header.contents.clear
# Change dummy help window visibily and clear text
@dummy_help_window.visible = false
@dummy_help_window.contents.clear
# Change viewing spell information flag to false
@viewing_spell_information_window = false
return
end
end

#==============================================================================
# ** Scenario Methods
#------------------------------------------------------------------------------
# These methods performs the scenario screen processing.
#==============================================================================

#--------------------------------------------------------------------------
# * Start Scenario Mode
#--------------------------------------------------------------------------
def start_scenario_mode
# Start updating scenario processing
@update_scenario_mode_processing = true
# Change command window visibility
@command_window.visible = false
@command_window.active = false
# Deactivate status window
@status_window.active = false
# Changing visibily of gold window
@gold_time_window.visible = false
# Change sceneraio header visibility to true
@scenario_header.visible = true
# Determining item index and activity
if @item_window.item_max == 0
@item_window.index = -1
@item_window.active = false
else
@item_window.index = 0
@item_window.active = true
end
# Change item window mode to display scenenario items
@item_window.scenario_items_mode(true)
@item_window.only_items_mode(false)
@item_window.all_items_mode(false)
# Changing command window visibility
@item_window.visible = true
# Refresh item window
@item_window.refresh
# Update Input
Input.update
return
end
#--------------------------------------------------------------------------
# * End Scenario Scene
#--------------------------------------------------------------------------
def end_scenario_scene
# End scenario processing
@update_scenario_mode_processing = false
# Change sceneraio header visibility to false
@scenario_header.visible = false
# Change item window mode to display normal items
@item_window.active = false
@item_window.only_items_mode(true)
@item_window.all_items_mode(false)
@item_window.scenario_items_mode(false)
# Change item window index
@item_window.index = -1
# Changing command window visibility
@item_window.visible = false
# Refresh item window
@item_window.refresh
# Change command window visibility
@command_window.visible = true
@command_window.active = true
# Deactivate status window
@status_window.active = false
# Changing visibily of gold window
@gold_time_window.visible = true
# Update Input
Input.update
return
end
#--------------------------------------------------------------------------
# * Update Scenario Item Choosing
#--------------------------------------------------------------------------
def update_scenario_item_choosing
# If Input Trigger Cancel
if Input.trigger?(Input::B)
# Play cancel sound
Sound.play_cancel
# If viewing sceneario information flag is true
if @viewing_scenario_information_window == true
# View scenario_ information
view_scenario_item_information(@item_window.item)
return
end
# End scenario scene processing
end_scenario_scene
return
end

# If Input Trigger CTRL
if Input.trigger?(Input::CTRL)
# PLay desicion sound
Sound.play_decision
# View item information
view_scenario_item_information(@item_window.item)
return
end
end
#--------------------------------------------------------------------------
# * View Scenario Item Information
# item : item from which to read data from
#--------------------------------------------------------------------------
def view_scenario_item_information(item)
# If viewing scenario information flag is false
if @viewing_scenario_information_window == false
item_info = item
# Change item window visibility and active
@item_window.visible = false
@item_window.active = false
# Change scene help header visibility, add text and change text color
@scene_help_header.visible = true
@scene_help_header.contents.font.color = @scene_help_header.text_color(0)
@scene_help_header.contents.clear
@scene_help_header.contents.draw_text(0, 0 , 505-32, 24, item_info.name,1)
# Change dummy help window visibility, add text and color
@dummy_help_window.visible = true
@dummy_help_window.contents.font.color = @dummy_help_window.text_color(0)
@dummy_help_window.contents.clear
@dummy_help_window.contents.font.size = 22
@dummy_help_window.contents.draw_text(0, -24, 505-32, 100-32, item_info.description.capitalize)
# Change viewing item information flag to true
@viewing_scenario_information_window = true
else
# Change item window visibility and active
@item_window.visible = true
@item_window.active = true
# Change help header window visibilty and clear text
@scene_help_header.visible = false
@scene_help_header.contents.clear
# Change dummy help window visibily and clear text
@dummy_help_window.visible = false
@dummy_help_window.contents.clear
# Change viewing scenario information flag to false
@viewing_scenario_information_window = false
return
end
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
# Dipose of back sprite
@menuback_sprite.dispose
@menuback_sprite.bitmap.dispose
# Dispose command windows
@command_window.dispose
@item_command_window.dispose
@spell_command_window.dispose
# Dispose of windows
@gold_time_window.dispose
@status_window.dispose
@item_window.dispose
@skill_window.dispose
# Dispose of headers and dummy windows
@scene_header.dispose
@dummy_help_window.dispose
@scene_help_header.dispose
@scenario_header.dispose
end
end

#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#==============================================================================

class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :normal_mode # Normal Mode flag
attr_reader :item_mode # Item Mode Flag
attr_reader :skill_mode # skill Mode Flag
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y coordinate
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 544, 416)
self.active = false
self.contents.font.size = 18
self.opacity = 0
self.index = -1
@normal_mode = true
@item_mode = false
@skill_mode = false
refresh
end
#--------------------------------------------------------------------------
# * Change Mode
# mode : mode to modify 0 = Normal, 1 = Item, 2 = Skill
# value : true or false value
#--------------------------------------------------------------------------
def change_mode(mode, value)
# Modes array
@normal_mode = (mode == 0 ? value : false )
@item_mode = (mode == 1 ? value : false )
@skill_mode = (mode == 2 ? value : false )
return
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.members.size
@column_max = 2
for actor in $game_party.members
y = 0
if actor.index > 1
x = 260 #272
draw_actor_graphic(actor, 19 + actor.index * x - actor.index - @column_max * x, 90)
draw_actor_name(actor, 96 + actor.index * x - actor.index - @column_max * x, 90)
draw_actor_hp(actor, 96 + actor.index * x - actor.index - @column_max * x, y + 84 + WLH * 1 , 120, true)
draw_actor_mp(actor, 96 + actor.index * x - actor.index - @column_max * x, y + 84 + WLH * 2 , 120, true)
draw_actor_level(actor, 174 + actor.index * x - actor.index - @column_max * x, 90)
else
x = 260 #272
draw_actor_graphic(actor, 20 + actor.index * x, 8)

draw_actor_name(actor, 96 + actor.index * x, 10)
draw_actor_hp(actor, 96 + actor.index * x, y + WLH * 1 + 4, 120, true)
draw_actor_mp(actor, 96 + actor.index * x, y + WLH * 2 + 4, 120, true)
draw_actor_level(actor, 174 + actor.index * x, 10)
end
x = actor.index * 96 + WLH / 2
y = 0
end
end
#--------------------------------------------------------------------------
# * Draw Level
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_level(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, WLH, Vocab::level_a)
self.contents.font.color = normal_color
self.contents.draw_text(x + 18, y, 24, WLH, actor.level, 2)
end
#--------------------------------------------------------------------------
# * Draw Actor Walking Graphic
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_graphic(actor, x, y)
character_name = actor.character_name
bitmap = Cache.character(character_name)
sign = character_name[/^[!$]./]
if sign != nil and sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = actor.character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
dest_rect = Rect.new(x, y, 80, 80)
dest_rect = Rect.new(x, y, 65, 65)
self.contents.stretch_blt(dest_rect, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# * Draw Name
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_name(actor, x, y)
self.contents.font.color = hp_color(actor)
self.contents.draw_text(x, y, 75, WLH, actor.name)
end
#--------------------------------------------------------------------------
# * Update cursor
#--------------------------------------------------------------------------
def update_cursor
if @index < 0 # No cursor
self.cursor_rect.empty
end
case @index
when 0, 1
self.cursor_rect.set(19 + @index * 258, 0, 210, 86)
when 2, 3
self.cursor_rect.set(19 + @index * 258 - @index - @column_max * 258, 80, 210, 86)
when 100
self.cursor_rect.set(16, 0, contents.width-38, 163)

end
end
end

#==============================================================================
# ** Window_Gold & Time
#------------------------------------------------------------------------------
# This window displays the amount of gold and played time.
#==============================================================================

class Window_Gold_Time < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y coordinate
#--------------------------------------------------------------------------
def initialize(x, y, width = 260, height = 80)
super(x, y, width, height)
self.windowskin = Cache.system("TDS-Lufia Window")
self.back_opacity = 255
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.size = 25
draw_playtime(0, 0, self.width-32, 0)
draw_currency_value($game_party.gold, 0, 26, self.width-32)
end
#--------------------------------------------------------------------------
# * Draw Play Time
# x : Draw spot X coordinate
# y : Draw spot Y coordinate
# width : Width
# align : Alignment
#--------------------------------------------------------------------------
def draw_playtime(x, y, width, align)
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(x + 12, y, width, WLH, "TIME")
self.contents.draw_text(x, y, width - 12, WLH + 2, time_string, 2)
end
#--------------------------------------------------------------------------
# * Draw number with currency unit
# value : Number (gold, etc)
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : Width
#--------------------------------------------------------------------------
def draw_currency_value(value, x, y, width)
cx = contents.text_size(Vocab::gold).width
self.contents.font.color = normal_color
self.contents.draw_text(x, y, width-12, WLH, value, 2)
self.contents.draw_text(x + 12, y, width, WLH, "GOLD")
end
end

#==============================================================================
# ** TDS_Lufia_Window_Item
#------------------------------------------------------------------------------
# This window displays a list of inventory items for the item screen, etc.
#==============================================================================

class TDS_Lufia_Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :drop_mode # Drop flag
attr_reader :item_mode # Item display flag
attr_reader :all_mode # All item display flag
attr_reader :scenario_mode # Scenario display flag
#--------------------------------------------------------------------------
# * 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)
@use_custom_cursor = true
@column_max = 1
self.index = 0
self.back_opacity = 255
self.windowskin = Cache.system("TDS-Lufia Window")
@drop_mode = false
@item_mode = true
@all_mode = false
@scenario_mode = false
refresh
end
#--------------------------------------------------------------------------
# * Only Items Mode
#--------------------------------------------------------------------------
def all_items_mode(value)
@all_mode = value
end
#--------------------------------------------------------------------------
# * Only Items Mode
#--------------------------------------------------------------------------
def only_items_mode(value)
@item_mode = value
end
#--------------------------------------------------------------------------
# * Drop Items Mode
#--------------------------------------------------------------------------
def drop_items_mode(value)
@drop_mode = value
end
#--------------------------------------------------------------------------
# * Scenario Items Mode
#--------------------------------------------------------------------------
def scenario_items_mode(value)
@scenario_mode = value
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Whether or not to include in item list
# item : item
#--------------------------------------------------------------------------
def include?(item)
return false if item == nil
if $game_temp.in_battle
return false unless item.is_a?(RPG::Item)
end
return true
end
#--------------------------------------------------------------------------
# * Whether or not to display in enabled state
# item : item
#--------------------------------------------------------------------------
def enable?(item)
return $game_party.item_can_use?(item)
end
#--------------------------------------------------------------------------
# * Drop item
# item : item
#--------------------------------------------------------------------------
def drop_item(item)
$game_party.lose_item(item, $game_party.item_number(item))
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@data = []
for item in $game_party.items
next unless include?(item)
next if @item_mode == true and !$game_party.item_can_use?(item)
next if @scenario_mode == true and !item.element_set.include?(17)
if @item_mode == true
if $game_party.item_can_use?(item) and !item.element_set.include?(17)
@data.push(item)
end
end
if @scenario_mode == true
if item.element_set.include?(17)
@data.push(item)
end
end
if @all_mode
if !item.element_set.include?(17)
@data.push(item)
end
end
if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
self.index = @data.size - 1
end
end
@data.push(nil) if include?(nil)
@item_max = @data.size
create_contents
if @data.empty?
@cursor_visible = false
else
@cursor_visible = true
end
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
enabled = enable?(item)
rect.width -= 30
draw_item_name(item, rect.x += 26, rect.y, enabled)
rect.x -= 20
self.contents.draw_text(rect, sprintf(":%2d", number), 2)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
enabled = enable?(item)
rect.width -= 30
draw_item_name(item, rect.x += 26, rect.y, enabled)
rect.x -= 20
if @scenario_mode != true
self.contents.draw_text(rect, sprintf(":%2d", number), 2)
end
end
end
#--------------------------------------------------------------------------
# * Update Help Text
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(item == nil ? "" : item.description)
end
end


#==============================================================================
# ** TDS_Lufia_Window_Skill
#------------------------------------------------------------------------------
# This window displays a list of usable skills on the skill screen, etc.
#==============================================================================

class TDS_Lufia_Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :use_skill_mode # Use skill display flag
attr_reader :all_skill_mode # All skill display flag
attr_reader :actor # Actor information
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
# actor : actor
#--------------------------------------------------------------------------
def initialize(x, y, width, height, actor)
super(x, y, width, height)
@actor = actor
@column_max = 2
@use_custom_cursor = true
self.index = 0
self.back_opacity = 255
self.windowskin = Cache.system("TDS-Lufia Window")
self.index = 0
@use_skill_mode = true
@all_skill_mode = false
refresh(@actor)
end
#--------------------------------------------------------------------------
# * Only Use Skill Mode
#--------------------------------------------------------------------------
def only_use_skill_mode(value)
@use_skill_mode = value
end
#--------------------------------------------------------------------------
# * All skill display mode
#--------------------------------------------------------------------------
def all_skill_display_mode(value)
@all_skill_mode = value
end
#--------------------------------------------------------------------------
# * Get Skill
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(actor)
@item_max = @data.size if @data != nil
@data = []
@actor = actor
for skill in @actor.skills
next if @use_skill_mode == true and skill_can_use?(skill) == false
if @use_skill_mode == true
@data.push(skill) if skill_can_use?(skill)
end
if @all_skill_mode == true
@data.push(skill)
end
if skill.id == @actor.last_skill_id
self.index = @data.size - 1
end
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
if @data.empty?
@cursor_visible = false
else
@cursor_visible = true
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
rect.width -= 4
enabled = skill_can_use?(skill, true) # @actor.skill_can_use?(skill)

draw_item_name(skill, rect.x + 26, rect.y, enabled)
self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
end
end
#--------------------------------------------------------------------------
# * Determine Usable Skills
# skill : skill
#--------------------------------------------------------------------------
def skill_can_use?(skill,dead = false)
skill = @data[index] if skill == nil
return false unless skill.is_a?(RPG::Skill)
return false unless @actor.movable? if dead == true
return false if @actor.silent? and skill.spi_f > 0
return false if @actor.calc_mp_cost(skill) > @actor.mp if dead == true
return skill.menu_ok?
end
#--------------------------------------------------------------------------
# * Update Help Text
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(skill == nil ? "" : skill.description)
end
end

#==============================================================================
# ** Scene_Status
#------------------------------------------------------------------------------
# This class performs the status screen processing.
#==============================================================================

class Scene_Status < Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
# Create Menu Back Sprite
@menuback_sprite = Sprite.new
@menuback_sprite.bitmap = Cache.system("Lufia Menu Back")
@actor = $game_party.members[@actor_index]
# Create Status Header Window
@status_header = Window_Base.new(14, 330, 140, 56)
@status_header.windowskin = Cache.system("TDS-Lufia Window")
@status_header.back_opacity = 255
@status_header.contents = Bitmap.new(140-32,56-32)
@status_header.contents.font.color = @status_header.text_color(0)
@status_header.contents.draw_text(0,0,140-32,56-32, "STATUS",1)
# Create Status Window
@status_window = Window_Status.new(@actor)
# Create command window
@command_window = TDS_Window_Command.new(370, ["NEXT", "PREVIOUS", "RETURN"],
3, 0)
@command_window.active = true
@command_window.x = 154 #120 + 14
@command_window.y = 330
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
@menuback_sprite.dispose
@menuback_sprite.bitmap.dispose
@status_window.dispose
@status_header.dispose
@command_window.dispose
end
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(1)
end
#--------------------------------------------------------------------------
# * Switch to Next Actor Screen
#--------------------------------------------------------------------------
def next_actor
@actor_index += 1
@actor_index %= $game_party.members.size
@status_window.refresh($game_party.members[@actor_index])
end
#--------------------------------------------------------------------------
# * Switch to Previous Actor Screen
#--------------------------------------------------------------------------
def prev_actor
@actor_index += $game_party.members.size - 1
@actor_index %= $game_party.members.size
@status_window.refresh($game_party.members[@actor_index])
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@command_window.update
@status_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
end
if Input.trigger?(Input::C)
case @command_window.index
when 0
Sound.play_cursor
next_actor
when 1
Sound.play_cursor
prev_actor
when 2
Sound.play_cancel
return_scene
end
end
super
end
end


#==============================================================================
# ** Window_Status
#------------------------------------------------------------------------------
# This window displays full status specs on the status screen.
#==============================================================================

class Window_Status < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 544, 416)
self.opacity = 0
self.contents.font.size = 20
@actor = actor
refresh(@actor)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(actor)
@actor = actor
self.contents.clear
draw_actor_name(@actor, 78, 24)
self.contents.font.color = system_color
self.contents.draw_text(260, 24, 80, WLH, "CLASS")
self.contents.draw_text(260, 48, 80, WLH, "STATES")
self.contents.font.color = normal_color
draw_actor_class(@actor, 308 + 30, 24)
draw_actor_graphic(@actor, 8, 24)
draw_basic_info(128, 24)
draw_parameters(55, 110)
draw_exp_info(60, 218)
draw_equipments(262, 110)
end
#--------------------------------------------------------------------------
# * Draw Basic Information
# x : Draw spot X coordinate
# y : Draw spot Y coordinate
#--------------------------------------------------------------------------
def draw_basic_info(x, y)
draw_actor_level(@actor, x + 25, y + WLH * 0)
draw_actor_state(@actor, x + 180 + 30, y + WLH * 1)
draw_actor_hp(@actor, 78, y + WLH * 2 -24, 120, true)
draw_actor_mp(@actor, 78, y + WLH * 3 -24, 120, true)
end
#--------------------------------------------------------------------------
# * Draw Parameters
# x : Draw spot X coordinate
# y : Draw spot Y coordinate
#--------------------------------------------------------------------------
def draw_parameters(x, y)
draw_actor_parameter(@actor, x, y + WLH * 0, 0)
draw_actor_parameter(@actor, x, y + WLH * 1, 1)
draw_actor_parameter(@actor, x, y + WLH * 2, 2)
draw_actor_parameter(@actor, x, y + WLH * 3, 3)
end
#--------------------------------------------------------------------------
# * Draw Experience Information
# x : Draw spot X coordinate
# y : Draw spot Y coordinate
#--------------------------------------------------------------------------
def draw_exp_info(x, y)
s1 = @actor.exp_s
s2 = @actor.next_rest_exp_s
s_next = sprintf(Vocab::ExpNext, Vocab::level)
self.contents.font.color = system_color
self.contents.draw_text(x, y + WLH * 0, 180, WLH, "NOW EXP")
self.contents.draw_text(x, y + WLH * 2 , 180, WLH, "NEXT LEVEL")
self.contents.font.color = normal_color
self.contents.draw_text(x - 30, y + WLH * 1, 180, WLH, s1, 2)
self.contents.draw_text(x - 30, y + WLH * 3 , 180, WLH, s2, 2)
end
#--------------------------------------------------------------------------
# * Draw Actor Walking Graphic
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_graphic(actor, x, y)
character_name = actor.character_name
bitmap = Cache.character(character_name)
sign = character_name[/^[!$]./]
if sign != nil and sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = actor.character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
dest_rect = Rect.new(x, y, 80, 80)
dest_rect = Rect.new(x, y, 65, 65)
self.contents.stretch_blt(dest_rect, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# * Draw State
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
def draw_actor_state(actor, x, y, width = 96)
count = 0
if actor.states.empty?
self.contents.draw_text(x, y, 80, WLH, "Fine")
end
for state in actor.states
draw_icon(state.icon_index, x + 24 * count, y)
count += 1
break if (24 * count > width - 24)
end
end
#--------------------------------------------------------------------------
# * Draw Level
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_level(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, WLH, Vocab::level_a)
self.contents.font.color = normal_color
self.contents.draw_text(x + 18, y, 24, WLH, actor.level, 2)
end
#--------------------------------------------------------------------------
# * Draw Name
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_name(actor, x, y)
self.contents.font.color = hp_color(actor)
self.contents.draw_text(x, y, 75, WLH, actor.name)
end
#--------------------------------------------------------------------------
# * Draw Equipment
# x : Draw spot X coordinate
# y : Draw spot Y coordinate
#--------------------------------------------------------------------------
def draw_equipments(x, y)
self.contents.font.color = system_color
for i in 0..4
self.contents.font.size = 25
if @actor.equips[i] == nil
self.contents.draw_text(x + 37, y + i * 32, 100, WLH, "No Equip")
end
draw_item_name(@actor.equips[i], x , y + i * 32)
end
self.contents.font.size = 20
end
#--------------------------------------------------------------------------
# * Draw Item Name
# item : Item (skill, weapon, armor are also possible)
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# enabled : Enabled flag. When false, draw semi-transparently.
#--------------------------------------------------------------------------
def draw_item_name(item, x, y, enabled = true)
if item != nil
draw_icon(item.icon_index, x + 2, y, enabled)
self.contents.font.color = Color.new(255, 255, 255, 255)
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(x + 31, y, 290, WLH, item.name)
end
end
end

#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs the equipment screen processing.
#==============================================================================

class Scene_Equip < Scene_Base
#--------------------------------------------------------------------------
# * Constants
#--------------------------------------------------------------------------
EQUIP_TYPE_MAX = 5 # Number of equip region
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
# equip_index : equipment index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0, command_index = 0)
@actor_index = actor_index
@equip_index = equip_index
@command_index = command_index
@viewing_item_window_info = false
@viewing_equip_window_info = false
@remove_item_mode = false
@drop_item_mode = false

@item_index_return = 0
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
# Create Menu Back Sprite
@menuback_sprite = Sprite.new
@menuback_sprite.bitmap = Cache.system("Lufia Menu Back")


# Actor information
@actor = $game_party.members[@actor_index]
# Create command window
@command_window = TDS_Window_Command.new(247, ["EQUIP", "STRONGEST",
"REMOVE", "REMOVE ALL", "DROP"])
@command_window.x = 250
@command_window.y = 247
@command_window.index = @command_index

if @actor.fix_equipment
for i in 0...@command_window.commands.size
@command_window.draw_item(i, false)
end
end

@equip_window = Window_Equip.new(228, 56, @actor)
@equip_window.index = @equip_index
@equip_window.active = false
@equip_window.change_cursor_visibility(false)
@status_window = Window_EquipStatus.new(0, 0, @actor)

create_item_windows
update_item_windows

# Create Dummy help window
@dummy_help_window = Window_Base.new(18, 298, 510, 101)

@dummy_help_window.windowskin = Cache.system("TDS-Lufia Window")
@dummy_help_window.contents = Bitmap.new(510-32,56-32)
@dummy_help_window.contents.font.color = @dummy_help_window.text_color(0)

@dummy_help_window.contents.font.size = 22
@dummy_help_window.contents.draw_text(0, -24, 510-32, 100-32, "Help window text test")

@dummy_help_window.back_opacity = 255
@dummy_help_window.visible = false
@dummy_help_window.z = 5000
# Create Help Window Header
@scene_help_header = Window_Base.new(18, 247, 510, 56)
@scene_help_header.windowskin = Cache.system("TDS-Lufia Window")
@scene_help_header.back_opacity = 255
@scene_help_header.contents = Bitmap.new(510-32,56-32)
@scene_help_header.contents.font.color = @scene_help_header.text_color(0)
@scene_help_header.contents.draw_text(0, 0 , 505-32,56-32, "Item name",1)
@scene_help_header.visible = false
@scene_help_header.z = 5000
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
@menuback_sprite.dispose
@menuback_sprite.bitmap.dispose
@command_window.dispose
@equip_window.dispose
@status_window.dispose
dispose_item_windows
@dummy_help_window.dispose
@scene_help_header.dispose
end
#--------------------------------------------------------------------------
# * Update Frame
#--------------------------------------------------------------------------
def update
super
# Update windows
@command_window.update
@equip_window.update
update_status_window
update_item_windows
# If not viewing any info and command window active
if @viewing_equip_window_info == false and @viewing_item_window_info == false and
@command_window.active == true
if Input.trigger?(Input::R)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::L)
Sound.play_cursor
prev_actor
end
end
# If command Window active
if @command_window.active
update_command_selection
end
# If equip window active or viewing equip item info
if @equip_window.active or @viewing_equip_window_info
update_equip_selection
@equip_window.change_cursor_visibility(true)
else
if @item_window.active == false and @viewing_item_window_info == false
@equip_window.change_cursor_visibility(false)
end
end
# If item window active or viewing item window info
if @item_window.active or @viewing_item_window_info
update_item_selection
end
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Menu.new(3)
end
# If input trigger
if Input.trigger?(Input::C)
if @actor.fix_equipment
Sound.play_buzzer
return
end
case @command_window.index
when 0 # Equip
Sound.play_decision
@command_window.active = false
@command_window.visible = false
@item_window.visible = true
@equip_window.active = true
@remove_item_mode = false
@drop_item_mode = false
Input.update
when 1 # Equip Strongest
Sound.play_equip

for i in 0...3
equip_strongest_armor(i, i+1)
end
for i in 0...5
@item_windows[i].refresh
end

equip_strongest_weapon

@status_window.refresh
Input.update
return
when 2 # Remove
Sound.play_decision
@command_window.active = false
@equip_window.active = true
@item_window.visible = false
@remove_item_mode = true
Input.update
when 3 # Remove all
Sound.play_equip
old_equip_index = @equip_window.index
for i in 0...5
@actor.change_equip(i, nil)
@equip_window.index = i
@item_windows[i].refresh
if @equip_window.item != nil
equip_redraw_index = @item_windows[i].return_item_index(@equip_window.item)
if equip_redraw_index != nil
@item_windows[i].draw_item(equip_redraw_index)
end
end
@status_window.refresh
end
@equip_window.index = old_equip_index
@equip_window.refresh
when 4 # Drop
Sound.play_decision
@command_window.active = false
@equip_window.active = true
@item_window.visible = false
@drop_item_mode = true
Input.update
end
return
end
end
#--------------------------------------------------------------------------
# * Update Equip Region Selection
#--------------------------------------------------------------------------
def update_equip_selection
if Input.trigger?(Input::B)
Sound.play_cancel
if @viewing_equip_window_info
if @drop_item_mode == true or @remove_item_mode == true
@dummy_help_window.visible = false
@scene_help_header.visible = false
@command_window.visible = true
@equip_window.active = true
@scene_help_header.contents.clear
@viewing_equip_window_info = false
return
end
@dummy_help_window.visible = false
@scene_help_header.visible = false
@item_window.visible = true
@equip_window.active = true
@scene_help_header.contents.clear
@viewing_equip_window_info = false
@remove_item_mode = false
@drop_item_mode = false
return
end
@item_window.visible = false
@equip_window.active = false
@equip_window.change_cursor_visibility(false)
@command_window.active = true
@command_window.visible = true
@remove_item_mode = false
@drop_item_mode = false
end

if Input.trigger?(Input::C) and @viewing_equip_window_info == false
if @remove_item_mode == true
if @actor.fix_equipment or @equip_window.item == nil
Sound.play_buzzer
Input.update
return
else
Sound.play_equip
draw_index = @item_window.return_item_index(@equip_window.item)
@actor.change_equip(@equip_window.index, nil)
if draw_index != nil
@item_window.draw_item(draw_index)
end
@item_window.refresh
@equip_window.refresh
@status_window.refresh
Input.update
return
end
end

if @drop_item_mode == true
if @actor.fix_equipment or @equip_window.item == nil
Sound.play_buzzer
Input.update
return
else
Sound.play_equip
draw_index = @item_window.return_item_index(@equip_window.item)
@actor.change_equip(@equip_window.index, nil)
$game_party.lose_item(@equip_window.item, 1, true)
@equip_window.refresh
if draw_index != nil
@item_window.draw_item(draw_index)
end
@item_window.refresh
@status_window.refresh
Input.update
return
end
end

if @actor.fix_equipment or @item_window.item_max == 0
Sound.play_buzzer
else
Sound.play_decision
@equip_window.active = false
@item_window.active = true
@item_window.index = 0
Input.update
end
end

if Input.trigger?(Input::CTRL)
if @viewing_equip_window_info == false
return Sound.play_buzzer if @equip_window.item == nil
Sound.play_decision
if @drop_item_mode == true or @remove_item_mode == true
@command_window.active = false
@command_window.visible = false
@equip_window.active = false
@dummy_help_window.visible = true
@scene_help_header.visible = true
@scene_help_header.contents.font.color = @scene_help_header.text_color(0)
@scene_help_header.contents.clear
@scene_help_header.contents.draw_text(0, 0 , 510-32,56-32, @equip_window.item.name,1)
@dummy_help_window.contents.font.color = @dummy_help_window.text_color(0)
@dummy_help_window.contents.clear
@dummy_help_window.contents.font.size = 22
@dummy_help_window.contents.draw_text(0, -24, 510-32, 100-32, @equip_window.item.description.capitalize)
@viewing_equip_window_info = true
return
end
@dummy_help_window.visible = true
@scene_help_header.visible = true
@item_window.visible = false
@equip_window.active = false
@item_index_return = @item_window.index
@scene_help_header.contents.font.color = @scene_help_header.text_color(0)
@scene_help_header.contents.clear
@scene_help_header.contents.draw_text(0, 0 , 510-32,56-32, @equip_window.item.name,1)
@dummy_help_window.contents.font.color = @dummy_help_window.text_color(0)
@dummy_help_window.contents.clear
@dummy_help_window.contents.font.size = 22
@dummy_help_window.contents.draw_text(0, -24, 510-32, 100-32, @equip_window.item.description.capitalize)
@item_window.index = -1
@viewing_equip_window_info = true
else
if @drop_item_mode == true or @remove_item_mode == true
Sound.play_decision
@dummy_help_window.visible = false
@scene_help_header.visible = false
@command_window.visible = true
@equip_window.active = true
@scene_help_header.contents.clear
@viewing_equip_window_info = false
return
end
Sound.play_decision
@dummy_help_window.visible = false
@scene_help_header.visible = false
@item_window.visible = true
@equip_window.active = true
@scene_help_header.contents.clear
@viewing_equip_window_info = false
end
return
end
end
#--------------------------------------------------------------------------
# * Update Item Selection
#--------------------------------------------------------------------------
def update_item_selection
if Input.trigger?(Input::B)
Sound.play_cancel
if @viewing_item_window_info
@dummy_help_window.visible = false
@scene_help_header.visible = false
@item_window.active = true
@item_window.visible = true
@item_window.index = @item_index_return
@scene_help_header.contents.clear
@viewing_item_window_info = false
return
end
@equip_window.active = true
@item_window.active = false
@item_window.index = -1
end

if Input.trigger?(Input::C) and @viewing_item_window_info == false
Sound.play_equip
@actor.change_equip(@equip_window.index, @item_window.item)
@equip_window.active = true
@item_window.active = false
@item_window.index = -1
@equip_window.refresh
for item_window in @item_windows
item_window.refresh
end
end

if Input.trigger?(Input::CTRL)
Sound.play_decision
if @viewing_item_window_info == false
@dummy_help_window.visible = true
@scene_help_header.visible = true
@item_window.visible = false
@item_window.active = false
@item_index_return = @item_window.index
@scene_help_header.contents.font.color = @scene_help_header.text_color(0)
@scene_help_header.contents.clear
@scene_help_header.contents.draw_text(0, 0 , 510-32,56-32, @item_window.item.name,1)
@dummy_help_window.contents.font.color = @dummy_help_window.text_color(0)
@dummy_help_window.contents.clear
@dummy_help_window.contents.font.size = 22
@dummy_help_window.contents.draw_text(0, -24, 510-32, 100-32, @item_window.item.description.capitalize)
@item_window.index = -1
@viewing_item_window_info = true
else
@dummy_help_window.visible = false
@scene_help_header.visible = false
@item_window.active = true
@item_window.visible = true
@item_window.index = @item_index_return

@scene_help_header.contents.clear
@viewing_item_window_info = false
end
return
end
end
#--------------------------------------------------------------------------
# * Update Status Window
#--------------------------------------------------------------------------
def update_status_window
if @equip_window.active
@status_window.set_new_parameters(nil, nil, nil, nil)
elsif @item_window.active
temp_actor = @actor.clone
temp_actor.change_equip(@equip_window.index, @item_window.item, true)
new_atk = temp_actor.atk
new_def = temp_actor.def
new_spi = temp_actor.spi
new_agi = temp_actor.agi
@status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi)
end
@status_window.update
end
#--------------------------------------------------------------------------
# * Equip Strongest Weapon
#--------------------------------------------------------------------------
def equip_strongest_weapon
# Owned weapons array
weapons = []
# Actor class weapon set
weapon_set = @actor.class.weapon_set
# Block
weapon_set.each do |i|
next if $game_party.has_item?($data_weapons[i]) == false
next if @actor.equippable?($data_weapons[i]) == false
# Push weapon values into weapons variable
weapons << $data_weapons[i]
end
# Return if weaponsa array is empty
return if weapons == []
# If actors currently equiped weapon is nil
if @actor.weapons[0] == nil
ver_weapon = weapons[0]
else
ver_weapon = @actor.weapons[0]
end

for weapon in weapons
next if weapon.two_handed
if ver_weapon.atk < weapon.atk
ver_weapon = weapon
end
end
# Equip Strongest Weapon
@actor.change_equip(0, ver_weapon)
# Reresh equip window
@equip_window.refresh

end

#--------------------------------------------------------------------------
# * Equip Strongest Armor
#--------------------------------------------------------------------------
def equip_strongest_armor(armor_kind , index)

# Owned armors array
armors = []
# Actor class armor set
armor_set = @actor.class.armor_set
# Block
armor_set.each do |i|
next if $data_armors[i].kind == 3
next if $game_party.has_item?($data_armors[i]) == false
next if @actor.armors[armor_kind] == $data_armors[i]

if $data_armors[i].kind == armor_kind
armors << $data_armors[i]
end
end
# Return if armors array is empty
return if armors == []

# If actor armor is nil
if @actor.armors[armor_kind] == nil
ver_armor = armors[0]
else
ver_armor = @actor.armors[armor_kind]
end

for armor in armors
if ver_armor.def < armor.def
ver_armor = armor
end
end
# Equip strongest armor
@actor.change_equip(index, ver_armor)
# Reresh equip window
@equip_window.refresh
end
#--------------------------------------------------------------------------
# * Create Item Window
#--------------------------------------------------------------------------
def create_item_windows
@item_windows = []
for i in 0...EQUIP_TYPE_MAX
@item_windows[i] = Window_EquipItem.new(18, 247, 510, 152, @actor, i)
@item_windows[i].visible = (@equip_index == i)
@item_windows[i].active = false
@item_windows[i].visible = false
@item_windows[i].index = -1
end
end
#--------------------------------------------------------------------------
# * Dispose of Item Window
#--------------------------------------------------------------------------
def dispose_item_windows
for window in @item_windows
window.dispose
end
end
#--------------------------------------------------------------------------
# * Switch to Next Actor Screen
#--------------------------------------------------------------------------
def next_actor
@actor_index += 1
@actor_index %= $game_party.members.size
@actor = $game_party.members[@actor_index]
@status_window.refresh(@actor)
@equip_window.refresh(@actor)


create_item_windows
update_item_windows

@viewing_item_window_info = false
@viewing_equip_window_info = false
@remove_item_mode = false
@drop_item_mode = false
end
#--------------------------------------------------------------------------
# * Switch to Previous Actor Screen
#--------------------------------------------------------------------------
def prev_actor
@actor_index += $game_party.members.size - 1
@actor_index %= $game_party.members.size
@actor = $game_party.members[@actor_index]
@status_window.refresh(@actor)
@equip_window.refresh(@actor)

create_item_windows
update_item_windows

@viewing_item_window_info = false
@viewing_equip_window_info = false
@remove_item_mode = false
@drop_item_mode = false
end
#--------------------------------------------------------------------------
# * Update Item Window
#--------------------------------------------------------------------------
def update_item_windows
for i in 0...EQUIP_TYPE_MAX
@item_windows[i].visible = false if @command_window.active == true
if @command_window.active == false and @remove_item_mode == false and
@drop_item_mode == false
@item_windows[i].visible = (@equip_window.index == i)
@item_windows[i].update
end
end
@item_window = @item_windows[@equip_window.index]
end
end

#==============================================================================
# ** Window_Equip
#------------------------------------------------------------------------------
# This window displays items the actor is currently equipped with on the
# equipment screen.
#==============================================================================

class Window_Equip < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y corrdinate
# actor : actor
#--------------------------------------------------------------------------
def initialize(x, y, actor)
super(x, y, 290, 200)
@actor = actor
@use_custom_cursor = true
self.windowskin = Cache.system("TDS-Lufia Window")
self.contents.font.color = Color.new(255, 255, 255, 255)
self.opacity = 0
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(actor = nil)
self.contents.clear
@actor = actor if actor != nil
@data = []
for item in @actor.equips do @data.push(item) end
@item_max = @data.size

for i in 0...@data.size
if @data[i] == nil
self.contents.font.color = Color.new(255, 255, 255, 255)
self.contents.draw_text(48, 32 * i , 172, 24, "No Equip")
end
self.contents.font.color = Color.new(255, 255, 255, 255)
draw_item_name(@data[i], 24, 32 * i)
end
end
#--------------------------------------------------------------------------
# * Draw Item Name
# item : Item (skill, weapon, armor are also possible)
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# enabled : Enabled flag. When false, draw semi-transparently.
#--------------------------------------------------------------------------
def draw_item_name(item, x, y, enabled = true)
if item != nil
draw_icon(item.icon_index, x + 2, y, enabled)
self.contents.font.color = Color.new(255, 255, 255, 255)
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(x + 31, y, 290, WLH, item.name)
end
end
#--------------------------------------------------------------------------
# * Get rectangle for displaying items
# index : item number
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = 25
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * 32
return rect
end
end

#==============================================================================
# ** Window_EquipItem
#------------------------------------------------------------------------------
# This window displays choices when opting to change equipment on the
# equipment screen.
#==============================================================================

class Window_EquipItem < Window_Item
#--------------------------------------------------------------------------
# * Object Initialization
# x : sindow X coordinate
# y : sindow Y corrdinate
# width : sindow width
# height : sindow height
# actor : actor
# equip_type : equip region (0-4)
#--------------------------------------------------------------------------
def initialize(x, y, width, height, actor, equip_type)
@actor = actor
if equip_type == 1 and actor.two_swords_style
equip_type = 0 # Change shield to weapon
end
@equip_type = equip_type
super(x, y, width, height)
@column_max = 1
@use_custom_cursor = true
@normal_color = normal_color
self.contents.font.color = @normal_color
self.windowskin = Cache.system("TDS-Lufia Window")
self.back_opacity = 255
refresh
end

#--------------------------------------------------------------------------
# * Whether to include item in list
# item : item
#--------------------------------------------------------------------------
def return_item_index(item)
item_index = item
item_index = @data.index(item)
return item_index
end
#--------------------------------------------------------------------------
# * Whether to include item in list
# item : item
#--------------------------------------------------------------------------
def include?(item)
return true if item == nil
if @equip_type == 0
return false unless item.is_a?(RPG::Weapon)
else
return false unless item.is_a?(RPG::Armor)
return false unless item.kind == @equip_type - 1
end
return @actor.equippable?(item)
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
@item_max = @data.size-1
rect = item_rect(index)
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
item = @data[index]
if item != nil
number = $game_party.item_number(item)
enabled = enable?(item)
rect.width -= 14
draw_item_name(item, rect.x + 26, rect.y, enabled)
self.contents.draw_text(rect, sprintf(":%2d", number), 2)
end
end

#--------------------------------------------------------------------------
# * Whether to display item in enabled state
# item : item
#--------------------------------------------------------------------------
def enable?(item)
return true
end
end

#==============================================================================
# ** Window_EquipStatus
#------------------------------------------------------------------------------
# This window displays actor parameter changes on the equipment screen, etc.
#==============================================================================

class Window_EquipStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y corrdinate
# actor : actor
#--------------------------------------------------------------------------
def initialize(x, y, actor)
super(x, y, 290, 300)
@actor = actor
self.opacity = 0
self.contents.font.size = 20
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(actor = nil)
self.contents.clear
@actor = actor if actor != nil
x = 128
y = 24
draw_actor_name(@actor, 78, y)
draw_actor_graphic(@actor, 8, y)

draw_actor_level(@actor, x + 25, y + WLH * 0)
draw_actor_state(@actor, x + 180 + 30, y + WLH * 1)
draw_actor_hp(@actor, 78, y + WLH * 2 -24, 120, true)
draw_actor_mp(@actor, 78, y + WLH * 3 -24, 120, true)

draw_parameter(55, 90 + WLH * 1, 0)
draw_parameter(55, 90 + WLH * 2, 1)
draw_parameter(55, 90 + WLH * 3, 2)
draw_parameter(55, 90 + WLH * 4, 3)

if self.active == false

end
end
#--------------------------------------------------------------------------
# * Set Parameters After Equipping
# new_atk : attack after equipping
# new_def : defense after equipping
# new_spi : spirit after equipping
# new_agi : agility after equipping
#--------------------------------------------------------------------------
def set_new_parameters(new_atk, new_def, new_spi, new_agi)
if @new_atk != new_atk or @new_def != new_def or
@new_spi != new_spi or @new_agi != new_agi
@new_atk = new_atk
@new_def = new_def
@new_spi = new_spi
@new_agi = new_agi
refresh
end
end
#--------------------------------------------------------------------------
# * Get Post Equip Parameter Drawing Color
# old_value : parameter before equipment change
# new_value : parameter after equipment change
#--------------------------------------------------------------------------
def new_parameter_color(old_value, new_value)
if new_value > old_value # Get stronger
return power_up_color
elsif new_value == old_value # No change
return normal_color
else # Get weaker
return power_down_color
end
end
#--------------------------------------------------------------------------
# * Draw Parameters
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# type : type of parameter (0 - 3)
#--------------------------------------------------------------------------
def draw_parameter(x, y, type)
case type
when 0
name = Vocab::atk
value = @actor.atk
new_value = @new_atk
when 1
name = Vocab::def
value = @actor.def
new_value = @new_def
when 2
name = Vocab::spi
value = @actor.spi
new_value = @new_spi
when 3
name = Vocab::agi
value = @actor.agi
new_value = @new_agi
end
self.contents.font.color = system_color
self.contents.draw_text(x + 4, y, 80, WLH, name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 50, y, 30, WLH, value, 2)
self.contents.font.color = system_color


stat_icons_positive = [120, 121, 122, 123]
stat_icons_negative = [124, 125, 126, 127]
if new_value != nil
if new_value > value
draw_icon(stat_icons_positive[type], x + 84, y-4, enabled = true)
elsif new_value < value
draw_icon(stat_icons_negative[type], x + 84, y, enabled = true)
else
draw_equal_icon(x + 84, y-2, enabled = true)
end
end

if new_value != nil
self.contents.font.color = new_parameter_color(value, new_value)
self.contents.draw_text(x + 110, y, 30, WLH, new_value, 2)
end
end
#--------------------------------------------------------------------------
# * Draw Actor Walking Graphic
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_graphic(actor, x, y)
character_name = actor.character_name
bitmap = Cache.character(character_name)
sign = character_name[/^[!$]./]
if sign != nil and sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = actor.character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
dest_rect = Rect.new(x, y, 80, 80)
dest_rect = Rect.new(x, y, 65, 65)
self.contents.stretch_blt(dest_rect, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# * Draw Equal Icon
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# enabled : Enabled flag. When false, draw semi-transparently.
#--------------------------------------------------------------------------
def draw_equal_icon(x, y, enabled = true)
bitmap = Cache.system("Equal Icon")
rect = Rect.new(0, 0, 24, 24)
self.contents.blt(x, y, bitmap, rect, enabled ? 255 : 128)
end
#--------------------------------------------------------------------------
# * Draw Name
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_name(actor, x, y)
self.contents.font.color = hp_color(actor)
self.contents.draw_text(x, y, 75, WLH, actor.name)
end
#--------------------------------------------------------------------------
# * Draw Level
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_level(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, WLH, Vocab::level_a)
self.contents.font.color = normal_color
self.contents.draw_text(x + 18, y, 24, WLH, actor.level, 2)
end
end

#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
# This class performs the save and load screen processing.
#==============================================================================

class Scene_File < Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
# saving : save flag (if false, load screen)
# from_title : flag: it was called from "Continue" on the title screen
# from_event : flag: it was called from the "Call Save Screen" event
# return_index : value index when returning to the scene
#--------------------------------------------------------------------------
def initialize(saving, from_title, from_event, return_index = nil)
@saving = saving
@from_title = from_title
@from_event = from_event
@return_index = return_index
@updating_exit = false
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
# Create Menu Back Sprite
@menuback_sprite = Sprite.new
@menuback_sprite.bitmap = Cache.system("Lufia Menu Back")
if @saving == false
load_database # Load databasee
else
# Create Scene Header
@scene_header = Window_Base.new(18, 32, 140, 56)
@scene_header.windowskin = Cache.system("TDS-Lufia Window")
@scene_header.back_opacity = 255
@scene_header.contents = Bitmap.new(140-32,56-32)
@scene_header.contents.font.color = @scene_header.text_color(0)
@scene_header.contents.draw_text(0,0,140-32,56-32, "SAVE",1)
end
create_savefile_windows
# Create Scene Header
@first_save_header = Window_Base.new(137, 32, 389, 56)
@first_save_header.windowskin = Cache.system("TDS-Lufia Window")
@first_save_header.back_opacity = 255
@first_save_header.contents = Bitmap.new(140-32,56-32)
@first_save_header.contents.font.color = @first_save_header.text_color(0)
@first_save_header.contents.draw_text(0,0,140-32,56-32, "Game Saved.",0)
@first_save_header.visible = false
if @saving
@index = $game_temp.last_file_index
else
@index = self.latest_file_index
end
if @return_index != nil
@index = @return_index
end
@savefile_windows[@index].selected = true
end
#--------------------------------------------------------------------------
# * Load Database
#--------------------------------------------------------------------------
def load_database
$data_actors = load_data("Data/Actors.rvdata")
$data_classes = load_data("Data/Classes.rvdata")
$data_skills = load_data("Data/Skills.rvdata")
$data_items = load_data("Data/Items.rvdata")
$data_weapons = load_data("Data/Weapons.rvdata")
$data_armors = load_data("Data/Armors.rvdata")
$data_enemies = load_data("Data/Enemies.rvdata")
$data_troops = load_data("Data/Troops.rvdata")
$data_states = load_data("Data/States.rvdata")
$data_animations = load_data("Data/Animations.rvdata")
$data_common_events = load_data("Data/CommonEvents.rvdata")
$data_system = load_data("Data/System.rvdata")
$data_areas = load_data("Data/Areas.rvdata")
end
#--------------------------------------------------------------------------
# * Command: New Game
#--------------------------------------------------------------------------
def command_new_game
confirm_player_location
Sound.play_decision
$game_party.setup_starting_members # Initial party
$game_map.setup($data_system.start_map_id) # Initial map position
$game_player.moveto($data_system.start_x, $data_system.start_y)
$game_player.refresh
$scene = Scene_Map.new
RPG::BGM.fade(1500)
Graphics.fadeout(60)
Graphics.wait(40)
Graphics.frame_count = 0
RPG::BGM.stop
$game_map.autoplay
end
#--------------------------------------------------------------------------
# * Check Player Start Location Existence
#--------------------------------------------------------------------------
def confirm_player_location
if $data_system.start_map_id == 0
print "Player start location not set."
exit
end
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_item_windows
if @saving == true
@scene_header.dispose
end
@menuback_sprite.dispose
@menuback_sprite.bitmap.dispose
@first_save_header.dispose
end
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
def return_scene
if @from_event
$scene = Scene_Map.new
else
if @saving == true
$scene = Scene_Menu.new(5)
end
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super

update_savefile_windows
if @updating_exit
updating_first_time_save_exit
return
end
update_savefile_selection
end
#--------------------------------------------------------------------------
# * Create Save File Window
#--------------------------------------------------------------------------
def create_savefile_windows
@savefile_windows = []
for i in 0..4
next if @saving == true and i == 0
@savefile_windows.push(Window_SaveFile.new(i, "Save#{i}.rvdata"))
end
@item_max = (@saving == true ? 4 : 5 )
end
#--------------------------------------------------------------------------
# * Dispose of Save File Window
#--------------------------------------------------------------------------
def dispose_item_windows
for window in @savefile_windows
window.dispose
end
end
#--------------------------------------------------------------------------
# * Update Save File Window
#--------------------------------------------------------------------------
def update_savefile_windows
for window in @savefile_windows
window.update
window.update_cursor_graphic
window.update_cursor_animation
end
end
#--------------------------------------------------------------------------
# * Update Save File Selection
#--------------------------------------------------------------------------
def update_savefile_selection
if Input.trigger?(Input::C)
determine_savefile
elsif Input.trigger?(Input::B)
if @saving == false
return
end
Sound.play_cancel
return_scene
else
last_index = @index


return if @updating_exit

if Input.repeat?(Input::DOWN)
cursor_down(Input.trigger?(Input::DOWN))
end
if Input.repeat?(Input::UP)
cursor_up(Input.trigger?(Input::UP))
end

if Input.repeat?(Input::LEFT)
cursor_up(Input.trigger?(Input::LEFT))
end

if Input.repeat?(Input::RIGHT)
cursor_down(Input.trigger?(Input::RIGHT))
end

if @index != last_index
Sound.play_cursor
@savefile_windows[last_index].selected = false
@savefile_windows[@index].selected = true
end
end
end
#--------------------------------------------------------------------------
# * Updating first time save exit
#--------------------------------------------------------------------------
def updating_first_time_save_exit
# Exit frame count
@frames = 0 if @frames == nil
@frames += 1 if @frames < 70
if @frames == 70
return_scene
end
end
#--------------------------------------------------------------------------
# * Confirm Save File
#--------------------------------------------------------------------------
def determine_savefile
if @saving
if @savefile_windows[@index].file_exist == false
@first_save_header.visible = true
Sound.play_save
do_save
else
Sound.play_decision
$scene = Scene_File_II.new(@savefile_windows[@index].filename, @saving,
@index, @from_event)
return
end
else
if @savefile_windows[0].selected == true
command_new_game
return
end
if @savefile_windows[@index].file_exist
Sound.play_decision
$scene = Scene_File_II.new(@savefile_windows[@index].filename, @saving,
@index, @from_event)
else
Sound.play_buzzer
return
end
end
$game_temp.last_file_index = @index
end
#--------------------------------------------------------------------------
# * Move cursor down
# wrap : Wraparound allowed
#--------------------------------------------------------------------------
def cursor_down(wrap)
if @index < @item_max - 1 or wrap
@index = (@index + 1) % @item_max
end
end
#--------------------------------------------------------------------------
# * Move cursor up
# wrap : Wraparound allowed
#--------------------------------------------------------------------------
def cursor_up(wrap)
if @index > 0 or wrap
@index = (@index - 1 + @item_max) % @item_max
end
end
#--------------------------------------------------------------------------
# * Create Filename
# file_index : save file index (0-4)
#--------------------------------------------------------------------------
def make_filename(file_index)
return if file_index == 0
return "Save#{file_index}.rvdata"
end
#--------------------------------------------------------------------------
# * Select File With Newest Timestamp
#--------------------------------------------------------------------------
def latest_file_index
index = 0
latest_time = Time.at(0)
for i in 1...@savefile_windows.size
if @savefile_windows[i].time_stamp > latest_time
latest_time = @savefile_windows[i].time_stamp
index = i
end
end
return index
end
#--------------------------------------------------------------------------
# * Execute Save
#--------------------------------------------------------------------------
def do_save
file = File.open(@savefile_windows[@index].filename, "wb")
write_save_data(file)
file.close
@savefile_windows[@index].redraw_new_save_infofmation
@updating_exit = true
return
end
#--------------------------------------------------------------------------
# * Write Save Data
# file : write file object (opened)
#--------------------------------------------------------------------------
def write_save_data(file)
characters = []
for actor in $game_party.members
characters.push([actor.character_name, actor.character_index])
end
$game_system.save_count += 1
$game_system.version_id = $data_system.version_id
@last_bgm = RPG::BGM::last
@last_bgs = RPG::BGS::last
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
Marshal.dump(@last_bgm, file)
Marshal.dump(@last_bgs, file)
Marshal.dump($game_system, file)
Marshal.dump($game_message, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
@last_bgm = Marshal.load(file)
@last_bgs = Marshal.load(file)
$game_system = Marshal.load(file)
$game_message = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = 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.version_id != $data_system.version_id
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
end
end

#==============================================================================
# ** Scene_File_II
#------------------------------------------------------------------------------
# This class performs the save and load screen processing when rewriting.
#==============================================================================

class Scene_File_II < Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
# file : Save file to load data from
# saving : save flag (if false, load screen)
# return_index : index to return
#--------------------------------------------------------------------------
def initialize(file, saving, return_index, from_event)
@file = file
@saving = saving
@return_index = return_index
@from_event = from_event
load_saved_game_data(@file)
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
# Create Menu Back Sprite
@menuback_sprite = Sprite.new
@menuback_sprite.bitmap = Cache.system("Lufia Menu Back")
# Create Status window
@status_window = Window_File_MenuStatus.new(0, 0, @game_party)
@status_window.active = false
# Get map information
map_info = load_data("Data/MapInfos.rvdata")
# Get map name
map_name = map_info[@game_map.map_id].name
# Create map name window header
@map_name_header = Window_Base.new(18, 198, 505, 76)
@map_name_header.windowskin = Cache.system("TDS-Lufia Window")
@map_name_header.back_opacity = 255
@map_name_header.contents = Bitmap.new(505-32, 76-32)
@map_name_header.contents.font.size = 37
@map_name_header.contents.font.color = @map_name_header.text_color(0)
@map_name_header.contents.draw_text(18, 7 , 505-32, 37, map_name.to_s, 0)
# Create dummy command window header
@dummy_command_window_header = Window_Base.new(358, 274, 165, 135)
@dummy_command_window_header.windowskin = Cache.system("TDS-Lufia Window")
@dummy_command_window_header.back_opacity = 255
@dummy_command_window_header.contents = Bitmap.new(180-32, 130-32)
@dummy_command_window_header.contents.font.size = 20
@dummy_command_window_header.contents.font.color = @dummy_command_window_header.text_color(0)
if @saving == true
@dummy_command_window_header.contents.draw_text(3, 0 , 165-32, 24, "Save over this")
@dummy_command_window_header.contents.draw_text(3, 24 , 165-32, 24, "file?")
else
@dummy_command_window_header.contents.draw_text(3, 0 , 165-32, 24, "Start the game")
@dummy_command_window_header.contents.draw_text(3, 24 , 165-32, 24, "from this file?")
end
@dummy_command_window_header.contents.font.size = 25
# Create command window
@command_window = TDS_Window_Command.new(165, ["YES", "NO"])
@command_window.x = 370
@command_window.y = 332
@command_window.opacity = 0
# Create gold & time window
@gold_time_header = Window_Base.new(18, 274, 340, 78)
@gold_time_header.windowskin = Cache.system("TDS-Lufia Window")
@gold_time_header.back_opacity = 255
@gold_time_header.contents = Bitmap.new(340-32, 78-32)
@gold_time_header.contents.font.size = 25
@gold_time_header.contents.font.color = @gold_time_header.text_color(0)
@gold_time_header.contents.draw_text(18, 0, 340-32, 24, "TIME", 0)
@gold_time_header.contents.draw_text(18, 24 , 340-32, 24, "GOLD", 0)
@gold_time_header.contents.draw_text(18, 24 , 300-32, 24, @game_party.gold , 2)
# Calculate playtime
total_sec = Graphics.frame_count / Graphics.frame_rate
hour = total_sec / 60 / 60
min = total_sec / 60 % 60
sec = total_sec % 60
time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
@gold_time_header.contents.draw_text(18, 0 , 300-32, 24, time_string , 2)
# Create save cofirmation header
@save_confirmation_header = Window_Base.new(18, 352, 340, 57)
@save_confirmation_header.windowskin = Cache.system("TDS-Lufia Window")
@save_confirmation_header.back_opacity = 255
@save_confirmation_header.contents = Bitmap.new(340-32, 78-32)
@save_confirmation_header.contents.font.size = 25
@save_confirmation_header.contents.font.color = @save_confirmation_header.text_color(0)
@save_confirmation_header.contents.draw_text(18, 0, 340-32, 24, "Game saved.", 0)
@save_confirmation_header.visible = false
# Save process flag
@saving_process = false
end
#--------------------------------------------------------------------------
# * Load Saved Game Data
# file : Save file to load data from
#--------------------------------------------------------------------------
def load_saved_game_data(file = nil)
filename = file
file = File.open(filename, "r")
@characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
@last_bgm = Marshal.load(file)
@last_bgs = Marshal.load(file)
@game_system = Marshal.load(file)
@game_message = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
@game_self_switches = 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)
return
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update command window
@command_window.update
# If saving process flag is true
if @saving_process
update_save_process
return
end
# If input trigger cancel
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_File.new(@saving, false, false, @return_index)
return
end

# If input is confirm
if Input.trigger?(Input::C)
case @command_window.index
when 0
if @saving
Sound.play_save
@command_window.active = false
@save_confirmation_header.visible = true
@saving_process = true
$game_temp.last_file_index
return
else
Sound.play_load
@command_window.active = false
do_load
return
end
when 1
Sound.play_cancel
$scene = Scene_File.new(@saving, false, false, @return_index)
return
end
end
end
#--------------------------------------------------------------------------
# * Update save process
#--------------------------------------------------------------------------
def update_save_process
# Exit frame count
@frames = 0 if @frames == nil
@frames += 1 if @frames < 70
if @frames == 70
do_save
end
end
#--------------------------------------------------------------------------
# * Execute Load
#--------------------------------------------------------------------------
def do_load
file = File.open(@file, "rb")
read_save_data(file)
file.close
$scene = Scene_Map.new
RPG::BGM.fade(1500)
Graphics.fadeout(60)
Graphics.wait(40)
@last_bgm.play
@last_bgs.play
end
#--------------------------------------------------------------------------
# * Execute Save
#--------------------------------------------------------------------------
def do_save
file = File.open(@file, "wb")
write_save_data(file)
file.close
if @from_event
$scene = Scene_Map.new
else
$scene = Scene_Menu.new(5)
end
return
end
#--------------------------------------------------------------------------
# * Write Save Data
# file : write file object (opened)
#--------------------------------------------------------------------------
def write_save_data(file)
characters = []
for actor in $game_party.members
characters.push([actor.character_name, actor.character_index])
end
$game_system.save_count += 1
$game_system.version_id = $data_system.version_id
@last_bgm = RPG::BGM::last
@last_bgs = RPG::BGS::last
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
Marshal.dump(@last_bgm, file)
Marshal.dump(@last_bgs, file)
Marshal.dump($game_system, file)
Marshal.dump($game_message, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
@last_bgm = Marshal.load(file)
@last_bgs = Marshal.load(file)
$game_system = Marshal.load(file)
$game_message = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = 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.version_id != $data_system.version_id
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
@menuback_sprite.dispose
@menuback_sprite.bitmap.dispose
@status_window.dispose
@map_name_header.dispose
@dummy_command_window_header.dispose
@command_window.dispose
@gold_time_header.dispose
@save_confirmation_header.dispose
end
end

#==============================================================================
# ** Window_File_MenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the save and load screen.
#==============================================================================

class Window_File_MenuStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y coordinate
#--------------------------------------------------------------------------
def initialize(x, y, party_data)
super(x, y, 544, 416)
self.active = false
self.contents.font.size = 18
self.opacity = 0
@party_data = party_data
@column_max = 2
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = @party_data.members.size
for actor in @party_data.members
actor_index = @party_data.members.index(actor)
y = 0
if actor_index > 1
x = 260
draw_actor_graphic(actor, 19 + actor_index * x - actor_index - @column_max * x, 90)
draw_actor_name(actor, 96 + actor_index * x - actor_index - @column_max * x, 90)
draw_actor_hp(actor, 96 + actor_index * x - actor_index - @column_max * x, y + 84 + WLH * 1 , 120, true)
draw_actor_mp(actor, 96 + actor_index * x - actor_index - @column_max * x, y + 84 + WLH * 2 , 120, true)
draw_actor_level(actor, 174 + actor_index * x - actor_index - @column_max * x, 90)
else
x = 260
draw_actor_graphic(actor, 20 + actor_index * x, 8)
draw_actor_name(actor, 96 + actor_index * x, 10)
draw_actor_hp(actor, 96 + actor_index * x, y + WLH * 1 + 4, 120, true)
draw_actor_mp(actor, 96 + actor_index * x, y + WLH * 2 + 4, 120, true)
draw_actor_level(actor, 174 + actor_index * x, 10)
end
x = actor_index * 96 + WLH / 2
y = 0
end
end
#--------------------------------------------------------------------------
# * Draw Level
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_level(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, WLH, Vocab::level_a)
self.contents.font.color = normal_color
self.contents.draw_text(x + 18, y, 24, WLH, actor.level, 2)
end
#--------------------------------------------------------------------------
# * Draw Actor Walking Graphic
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_graphic(actor, x, y)
character_name = actor.character_name
bitmap = Cache.character(character_name)
sign = character_name[/^[!$]./]
if sign != nil and sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
else
cw = bitmap.width / 12
ch = bitmap.height / 8
end
n = actor.character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
dest_rect = Rect.new(x, y, 80, 80)
dest_rect = Rect.new(x, y, 65, 65)
self.contents.stretch_blt(dest_rect, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# * Draw Name
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_name(actor, x, y)
self.contents.font.color = hp_color(actor)
self.contents.draw_text(x, y, 75, WLH, actor.name)
end
end

#==============================================================================
# ** Window_SaveFile
#------------------------------------------------------------------------------
# This window displays save files on the save and load screens.
#==============================================================================

class Window_SaveFile < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :filename # filename
attr_reader :file_exist # file existence flag
attr_reader :time_stamp # timestamp
attr_reader :selected # selected
#--------------------------------------------------------------------------
# * Object Initialization
# file_index : save file index (0-3)
# filename : filename
#--------------------------------------------------------------------------
def initialize(file_index, filename, saving = false)
window_values = [
# Start
values = [18, 32, 140, 56 ],
# Save files
values = [18, 88, 254, 160 ],
values = [272, 88, 254, 160 ],
values = [18, 248, 254, 160 ],
values = [272, 248, 254, 160 ],
]

v_x = window_values[file_index][0]
v_y = window_values[file_index][1]
v_height = window_values[file_index][2]
v_width = window_values[file_index][3]
super(v_x, v_y, v_height, v_width)
self.windowskin = Cache.system("TDS-Lufia Window")
self.back_opacity = 255
create_custom_cursor
@file_index = file_index
@filename = filename
@saving = saving
load_gamedata
refresh
@selected = false

# self.visible = false
end
#--------------------------------------------------------------------------
# * Load Partial Game Data
# By default, switches and variables are not used (for expansion use,
# such as displaying place names)
#--------------------------------------------------------------------------
def load_gamedata
@time_stamp = Time.at(0)
@file_exist = FileTest.exist?(@filename)
if @file_exist
file = File.open(@filename, "r")
@time_stamp = file.mtime
begin
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@last_bgm = Marshal.load(file)
@last_bgs = Marshal.load(file)
@game_system = Marshal.load(file)
@game_message = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
# Reads self switches
Marshal.load(file)
@game_actors = Marshal.load(file)
@game_party = Marshal.load(file)
Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
rescue
@file_exist = false
ensure
file.close
end
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
if @file_index == 0
name = " START "
self.contents.draw_text(4, 0, 200, WLH, name)
end
if @file_exist == false and @file_index != 0
self.contents.draw_text(30, 0, 200, WLH, "FREE")
end
@name_width = contents.text_size(name).width
if @file_exist
draw_party_characters(35, 105)
draw_playtime(-35, 34, contents.width - 4, 2)
draw_party_leader_name(30, 0)
end
end

#--------------------------------------------------------------------------
# * Redraw New Save Information
#--------------------------------------------------------------------------
def redraw_new_save_infofmation
self.contents.clear
self.contents.font.color = normal_color

@time_stamp = Time.at(0)
@file_exist = FileTest.exist?(@filename)
if @file_exist
file = File.open(@filename, "r")
@time_stamp = file.mtime
begin
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@last_bgm = Marshal.load(file)
@last_bgs = Marshal.load(file)
@game_system = Marshal.load(file)
@game_message = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
# Reads self switches
Marshal.load(file)
@game_actors = Marshal.load(file)
@game_party = Marshal.load(file)
Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
rescue
@file_exist = false
ensure
file.close
end
end


draw_party_characters(35, 105)
draw_playtime(-35, 34, contents.width - 4, 2)
draw_party_leader_name(30, 0)

end

#--------------------------------------------------------------------------
# * Draw Party Characters
# x : Draw spot X coordinate
# y : Draw spot Y coordinate
#--------------------------------------------------------------------------
def draw_party_characters(x, y)
for i in 0...@characters.size
name = @characters[i][0]
index = @characters[i][1]
draw_character(name, index, x + i * 51, y)
self.contents.font.size = 18
self.contents.draw_text(-11 + x + i * 51, 105, 24, 24, @game_party.members[i].level, 1)
self.contents.font.size = 25
end
end
#--------------------------------------------------------------------------
# * Draw Play Time
# x : Draw spot X coordinate
# y : Draw spot Y coordinate
# width : Width
# align : Alignment
#--------------------------------------------------------------------------
def draw_playtime(x, y, width, align)
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, width, WLH, "TIME " + time_string, 2)
end
#--------------------------------------------------------------------------
# * Draw Party Leader Name
# x : Draw spot X coordinate
# y : Draw spot Y coordinate
#--------------------------------------------------------------------------
def draw_party_leader_name(x, y)
self.contents.draw_text(x, y, 100, WLH, "NAME")
self.contents.draw_text(x + 77 , y, 85, WLH, @game_party.members[0].name, 0)
end
#--------------------------------------------------------------------------
# * Set Selected
# selected : new selected (true = selected, false = unselected)
#--------------------------------------------------------------------------
def selected=(selected)
@selected = selected
update_cursor
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
self.contents.dispose
@sprite.bitmap.dispose
@sprite.dispose
super
end
#--------------------------------------------------------------------------
# * Create Custom Cursor
#--------------------------------------------------------------------------
def create_custom_cursor
@sprite = Sprite.new
@sprite.bitmap = Cache.system("Cursor")
@sprite.src_rect.width = @sprite.bitmap.width / 6
if @file_index == 0
@sprite.x = self.x + 16
@sprite.y = self.y + 16 #+ 4
else
@sprite.x = self.x + 16
@sprite.y = self.y + 14 #+ 4
end
@sprite.visible = @selected
@sprite.z = 9999
update_cursor_graphic
end
#--------------------------------------------------------------------------
# * Update Cursor Graphic
#--------------------------------------------------------------------------
def update_cursor_graphic
@sprite.visible = @selected
end
#--------------------------------------------------------------------------
# * Update Cursor Animation
#--------------------------------------------------------------------------
def update_cursor_animation
@duration = -1 if @duration == nil
if @selected
@duration += 1
@duration %= 8
if @duration == 8 -1
@sprite.src_rect.x += 24
@sprite.src_rect.x %= 6 * 24
end
else
@duration += 1
@duration %= 8
if @duration == 8 - 1
@sprite.src_rect.x -= 24
@sprite.src_rect.x %= 7 * 24
end
end
end
#--------------------------------------------------------------------------
# * Update cursor
#--------------------------------------------------------------------------
def update_cursor
if @selected
self.cursor_rect.set(0, 0, @name_width + 8, WLH)
update_cursor_graphic
else
self.cursor_rect.empty
end
end
end

#==============================================================================
# ** Scene_End
#------------------------------------------------------------------------------
# This class performs game end screen processing.
#==============================================================================

class Scene_End < Scene_Base
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
# Create Menu Back Sprite
@menuback_sprite = Sprite.new
@menuback_sprite.bitmap = Cache.system("Lufia Menu Back")
create_command_window
end
#--------------------------------------------------------------------------
# * Post-Start Processing
#--------------------------------------------------------------------------
def post_start
super
open_command_window
end
#--------------------------------------------------------------------------
# * Pre-termination Processing
#--------------------------------------------------------------------------
def pre_terminate
super
close_command_window
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_command_window
@menuback_sprite.dispose
@menuback_sprite.bitmap.dispose
end
#--------------------------------------------------------------------------
# * Return to Original Screen
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(6)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
@command_window.update
if @command_window.active == false and @command_window.openness == 255
@command_window.active = true
@command_window.index = 0
@command_window.change_cursor_visibility(false)
end

if Input.trigger?(Input::B)
Sound.play_cancel
@command_window.index = -1
return_scene
elsif Input.trigger?(Input::C) and @command_window.active
case @command_window.index
when 0 # to title
command_to_title
when 1 # shutdown
command_shutdown
when 2 # quit
command_cancel
end
end
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
s1 = Vocab::to_title
s2 = Vocab::shutdown
s3 = Vocab::cancel
@command_window = TDS_Window_Command.new(172, [s1, s2, s3])
@command_window.x = (544 - @command_window.width) / 2
@command_window.y = (416 - @command_window.height) / 2
@command_window.index = -1
@command_window.active = false
@command_window.openness = 0
end
#--------------------------------------------------------------------------
# * Dispose of Command Window
#--------------------------------------------------------------------------
def dispose_command_window
@command_window.dispose
end
#--------------------------------------------------------------------------
# * Open Command Window
#--------------------------------------------------------------------------
def open_command_window
@command_window.open
begin
@command_window.update
Graphics.update
end until @command_window.openness == 255
end
#--------------------------------------------------------------------------
# * Close Command Window
#--------------------------------------------------------------------------
def close_command_window
@command_window.close
begin
@command_window.update
Graphics.update
end until @command_window.openness == 0
end
#--------------------------------------------------------------------------
# * Process When Choosing [To Title] Command
#--------------------------------------------------------------------------
def command_to_title
@command_window.index = -1
Sound.play_decision
RPG::BGM.fade(800)
RPG::BGS.fade(800)
RPG::ME.fade(800)
close_command_window
Graphics.fadeout(60)
$scene = Scene_File.new(false, true, false)
Audio.bgm_play("Audio/BGM/Lufia II - Title Loading Screen", 100, 100)
end
#--------------------------------------------------------------------------
# * Process When Choosing [Shutdown] Command
#--------------------------------------------------------------------------
def command_shutdown
@command_window.index = -1
Sound.play_decision
RPG::BGM.fade(800)
RPG::BGS.fade(800)
RPG::ME.fade(800)
$scene = nil
exit
end
#--------------------------------------------------------------------------
# * Process When Choosing [Cancel] Command
#--------------------------------------------------------------------------
def command_cancel
@command_window.index = -1
Sound.play_decision
return_scene
end
end

Comment '2'
  • ?
    KSG 2008.11.01 15:53
    뭡니까 이 무지막지한 스크립트는..;;

    설명도 없고 뭐하는 스크립트 인가요;;;
  • ?
    파치리스 2011.09.11 21:24

    제목보면 새로운 메뉴 추가하는 스크립트 같긴한데


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5455
217 상점 상점 무기, 방어구 능력치 비교 스크립트! 18 불독 2008.12.25 3611
216 기타 이벤트 위치 저장 스크립트 10 Tofuman 2008.12.11 2099
215 기타 디스크 체인져 VX!! (업데이트..) 30 file Tofuman 2008.12.02 3169
214 기타 Crissaegrim Farm BETA 1.0.0 10 Man... 2008.11.22 3095
213 이름입력 모그 이름 바꾸기 한글 변역! 2 Man.... 2008.11.04 4116
212 HUD Crissaegrim HUD 2.0!! 13 Man... 2008.10.29 2853
211 제작도구 최대한 한글로 변혁 했음Window Maker V1.0(대박) 15 Man... 2008.10.29 4675
» 메뉴 Adding Extra Menu in lafia Script 2 Man... 2008.10.29 1575
209 장비 Disposable Ammo(또 있는 곳을 잘 읽으셔야 합니다.) 2 Man... 2008.10.29 1697
208 상점 Shopoholic(한글 설명) 11 Man... 2008.10.29 3188
207 SephirothSpawn's Slanted Bars in VX 1.1 2 Man... 2008.10.28 1572
206 Direction Movement Style 4 Man... 2008.10.28 1719
205 퍼스 스크립트 5 Man... 2008.10.28 1679
204 Repel Effect 1 Man... 2008.10.28 1754
203 전투 Fomars indiviivdual battle 2 Man... 2008.10.28 1348
202 아이템 Item Price Changer 7 Man... 2008.10.28 1536
201 Simple Fon Chage 3 Man... 2008.10.28 1213
200 Screen Resolution 3 Man... 2008.10.28 1172
199 Enable Usage of Rmxp 캐릭터(?) 5 Man... 2008.10.28 2413
198 Multi-threader snippet by Omegazion Man... 2008.10.28 1107
Board Pagination Prev 1 ... 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Next
/ 32