Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Tenoukii

Learn Skills through Weapons and Armour

Recommended Posts

Hey guys! (Get me being all active again :D)

I'm looking for a script similar to this one by ModernAlgebra (http://www.rmrk.net/index.php?topic=24405.0)

Basically like FFIX's skill learning system with the AP awarded at the end of a battle but without having to equip the actual skill.

So pretty much like

Equip the weapon/armour > Skill is available to use in battle > SP awarded to the player at the end of the battle (Variable amount per battle) > SP is then used to progress the learning of the skill (SP cost variable through the script) > If weapon/armour is unequiped before the skill is learnt, the player looses the skill. If the weapon/armour is unequiped and the skill is learnt, the skill is still available to the player.

This script needs to be compatible with the following scripts:

Kellessdee's XMB Menu:

 

 

=begin
XMB (Xross Media Bar or PSP/PS3) Style Menu System Script Version 1.0
written by: kellessdee

contact:
wakingdreams.weebly.com
http://www.rmxpunlimited.net/forums/
kellessdee@gmail.com

DISCLAIMER: Anyone is free to use this anyway they would like, I only ask for
credit where due. Enjoy :)
==============================================================================
***** INSTRUCTIONS ***********************************************************
* Put Script above Main
* The background files belong in Graphics/Pictures/back
* The menu icon files belong in Graphics/Pictures/menu
* Players can add/remove background files if they'd like throughout the game
* NOTE: Remind them not to remove "default" background
* To set a different default background, go to the beginning of
* class Settings, and change DEFAULT_BACKGROUND = 'Blue Waves' to
* DEFAULT_BACKGROUND = 'filename'
* filename being the name of the background you wish to set as default
* Any issues/bug reports you can send to any of the contacts I have provided
******************************************************************************
***** SCRIPTER NOTES: ********************************************************
* If you are a scripter, I have created new methods to certain pre-existing
* classes. You can take advantage of these if you'd like :)
* BITMAP CLASS
* added:
>>draw_frame(x, y, width, height)
* draws a rectangular outline
>>draw_gradient_bar(x, y, width, height, min, max, start_color, end_color)
* draws a gradient bar (for hp/sp/etc.)
>>draw_gradient(x, y, width, height, start_color, end_color)
* draws a simple gradient in a bitmap
>>draw_actor_...(...)
* added the methods from Window_Base used to draw actor info (such as graphic,
* hp, sp, etc.) They are used the same way as in Window_Base
******************************************************************************
==============================================================================
=end
#=============================================================================
# ** Settings
#-----------------------------------------------------------------------------
# This class contains Settings data for the XMB menu
#=============================================================================
class Settings
#---------------------------------------------------------------------------
# * Constants
#---------------------------------------------------------------------------
DEFAULT_BACKGROUND = 'Blue Waves'
#---------------------------------------------------------------------------
# * Public Instance Variables
#---------------------------------------------------------------------------
attr_accessor :music_volume
attr_accessor :sound_volume
attr_accessor :bg
attr_accessor :themes
attr_accessor :item_sort_type
attr_accessor :item_sort_reverse
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize
@music_volume = 100
@sound_volume = 100
@bg = DEFAULT_BACKGROUND
@themes = []
@item_sort_type = 2
@item_sort_reverse = false
# Update theme options
update_themes
end # initialize
#---------------------------------------------------------------------------
# * Update Themes
#---------------------------------------------------------------------------
def update_themes
# Add themes from Graphics/Pictures/back/
# Players can add their own themes at any point
# every time a file is loaded or new game created, this array is updated
@themes.clear
Dir.foreach('Graphics/Pictures/back/') {|back|
if back != '.' && back != '..'
@themes.push(back.chomp(File.extname(back)))
end # if back
}
end # update_themes
end # settings
#=============================================================================
# ** XMB Menu
#-----------------------------------------------------------------------------
# This class holds the main menu data for the XMB (psp) style menu, and also
# holds the corresponding instance of it's sub menu
#=============================================================================
class XMB_Menu
#---------------------------------------------------------------------------
# * Constants
#---------------------------------------------------------------------------
BMP_RECT = Rect.new(0, 0, 128, 128) # Src_rect for icon bitmap
#---------------------------------------------------------------------------
# * Public Instance Variables
#---------------------------------------------------------------------------
attr_accessor :sub_index # Currently selected sub menu option
attr_reader :selected # Whether this menu is currently selected
attr_reader :options # Menu Sub options
attr_accessor :step # Movement step counter
attr_accessor :move_left # Moving left flag
attr_accessor :move_right # Moving right flag
#---------------------------------------------------------------------------
# * Object Initialization
# name : actual name of specific main menu option
# options : sub-menu options array
# index : index in main menu option array
#---------------------------------------------------------------------------
def initialize(name, options, index)
@name = name
# Create Icon
@icon = RPG::Sprite.new
@icon.x = 128 * index + 114
@icon.y = 64
@icon.z = 9999
@icon.bitmap = Bitmap.new(136, 136)
# Store image
@image = RPG::Cache.picture('menu/' + @name)
@image_s = RPG::Cache.picture('menu/' + @name + '_s')
# Create Sub Menu
@options = []
options.each_index {|i|
@options.push(XMB_Sub_Menu.new(options[i], i, @icon.x))
}
# Default to not selected
@selected = index == 0
@sub_index = 0
# Not moving
@move_left = false
@move_right = false
@move_up = false
@move_down = false
# Movement step counter
@step = 0
# Set up bitmap
refresh
end # initialize
#---------------------------------------------------------------------------
# * Refresh Object
#---------------------------------------------------------------------------
def refresh
# Clear Bitmap
@icon.bitmap.clear
# If this entry is currently selected
if @selected
# Draw Shadow
@icon.bitmap.blt(2, 2, @image_s, BMP_RECT, 100)
@icon.bitmap.blt(4, 4, @image_s, BMP_RECT, 50)
@icon.bitmap.blt(6, 6, @image_s, BMP_RECT, 25)
# Draw Icon
@icon.bitmap.blt(0, 0, @image, BMP_RECT)
# Draw Title
@icon.bitmap.draw_text(0, 104, 128, 32, @name, 1)
else
# Draw Shadow
@icon.bitmap.blt(2, 2, @image_s, BMP_RECT, 75)
@icon.bitmap.blt(4, 4, @image_s, BMP_RECT, 35)
@icon.bitmap.blt(6, 6, @image_s, BMP_RECT, 10)
# Draw Icon with lower opacity
@icon.bitmap.blt(0, 0, @image, BMP_RECT, 125)
@options.each {|option| option.opacity = 0 }
end # if @selected
end # refresh
#---------------------------------------------------------------------------
# * Opacity
#---------------------------------------------------------------------------
def opacity=(opacity)
@icon.opacity = opacity
end # opacity
#---------------------------------------------------------------------------
# * Moving?
#---------------------------------------------------------------------------
def moving?
return @move_up || @move_down || @move_right || @move_left
end # moving?
#---------------------------------------------------------------------------
# * Update Frame
#---------------------------------------------------------------------------
def update
# Update sub options if selected
@options.each{|option| option.refresh} if @selected && moving?
if @move_up
# If at last option
if @sub_index > @options.size
# Stop moving
@move_up = false
@sub_index = @options.size
return
else
# Move up
slide_up
return
end # if @sub_index
elsif @move_down
# If at first option
if @sub_index < 0
# Stop moving
@move_down = false
@sub_index = 0
else
# Move down
slide_down
end # if @sub_index
elsif @move_right
slide_right
return
elsif @move_left
slide_left
return
else
unless moving?
if @selected
# If Up button is pressed
if Input.repeat?(Input::UP) && @sub_index > 0
@step = 128
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Switch Sub index
@move_down = true
# Increment index
@options[@sub_index].deselect
@sub_index -= 1
@options[@sub_index].select
return
end # if Input
# If Down button is pressed
if Input.repeat?(Input::DOWN) && @sub_index < (@options.size - 1)
@step = 128
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Switch Sub index
@move_up = true
# Decrement index
@options[@sub_index].deselect
@sub_index += 1
@options[@sub_index].select
return
end # if Input
end # if @selected
end # unless moving?
end # if @move_up elsif..
end # update
#---------------------------------------------------------------------------
# * Slide Up
#---------------------------------------------------------------------------
def slide_up
# Move all options up
@options.each {|option|
# If previously selected option
if option == @options[@sub_index-1]
option.move(-64)
else
option.move(-32)
end # if option
}
# Decrement counter
@step -= 32
if @step == 0
# Stop moving
@move_up = false
end # if @step
end # slide_up
#---------------------------------------------------------------------------
# * Slide Down
#---------------------------------------------------------------------------
def slide_down
# Move all options down
@options.each {|option|
# If newly selected option
if option == @options[@sub_index]
option.move(64)
else
option.move(32)
end # if option
}
# Decrement counter
@step -= 32
if @step == 0
# Stop moving
@move_down = false
end # if @step
end # slide_down
#---------------------------------------------------------------------------
# * Slide Left
#---------------------------------------------------------------------------
def slide_left
# Move Left
@icon.x -= 32
# Move Sub menu options
@options.each {|option| option.slide(-32)}
@step -= 32
if @step == 0
# Stop moving
@move_left = false
end # if @step
end # slide_left
#---------------------------------------------------------------------------
# * Slide Right
#---------------------------------------------------------------------------
def slide_right
# Move Right
@icon.x += 32
# Move Sub menu options
@options.each {|option| option.slide(32)}
@step -= 32
if @step == 0
# Stop moving
@move_right = false
end # if @step
end # slide_right
#---------------------------------------------------------------------------
# * Select
#---------------------------------------------------------------------------
def select
# Display sub options
@options.each {|option| option.opacity = 255}
@selected = true
refresh
end # select
#---------------------------------------------------------------------------
# * Deselect
#---------------------------------------------------------------------------
def deselect
# Hide sub options
@options.each {|option| option.opacity = 0}
@selected = false
refresh
end # deselect
#---------------------------------------------------------------------------
# * Dispose
#---------------------------------------------------------------------------
def dispose
@icon.dispose
end # dispose
end #XMB_Menu

#=============================================================================
# ** XMB_Sub_Menu
#-----------------------------------------------------------------------------
# This class is contained within each XMB_Menu class and displays the
# current sub menu options
#=============================================================================
class XMB_Sub_Menu
#---------------------------------------------------------------------------
# * Public instance variables
#---------------------------------------------------------------------------
attr_reader :name
#---------------------------------------------------------------------------
# * Constants
#---------------------------------------------------------------------------
BMP_RECT = Rect.new(0, 0, 128, 128) # Src_rect for icon bitmap
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize(name, index, x)
@name = name
# Create icon
@icon = RPG::Sprite.new
@icon.x = x
@icon.y = index * 128 + 200
# Create Bitmap
@icon.bitmap = Bitmap.new(320, 128)
@image = RPG::Cache.picture('menu/' + @name)
@image_s = RPG::Cache.picture('menu/' + @name + '_s')
# Set selected
@selected = index == 0
refresh
end # initialize
#---------------------------------------------------------------------------
# * Refresh Contents
#---------------------------------------------------------------------------
def refresh
# Clear Bitmap
@icon.bitmap.clear
# If this entry is currently selected
if @selected
# Draw Shadow
@icon.bitmap.blt(2, 2, @image_s, BMP_RECT, 100)
@icon.bitmap.blt(4, 4, @image_s, BMP_RECT, 50)
@icon.bitmap.blt(6, 6, @image_s, BMP_RECT, 25)
# Draw Icon
@icon.bitmap.blt(0, 0, @image, BMP_RECT)
# Draw Title
@icon.bitmap.draw_text(128, 48, 320, 32, @name) unless $scene.phase > 0
else
# Draw Shadow
@icon.bitmap.blt(2, 2, @image_s, BMP_RECT, 75)
@icon.bitmap.blt(4, 4, @image_s, BMP_RECT, 35)
@icon.bitmap.blt(6, 6, @image_s, BMP_RECT, 10)
# Draw Icon with lower opacity
@icon.bitmap.blt(0, 0, @image, BMP_RECT, 125)
end # if @selected
end # refresh
#---------------------------------------------------------------------------
# * Opacity
#---------------------------------------------------------------------------
def opacity=(opacity)
@icon.opacity = opacity
end # opacity
#---------------------------------------------------------------------------
# * Move UP/DOWN
#---------------------------------------------------------------------------
def move(pixels)
@icon.y += pixels
end # move
#---------------------------------------------------------------------------
# * Slide LEFT/RIGHT
#---------------------------------------------------------------------------
def slide(pixels)
@icon.x += pixels
end # slide
#---------------------------------------------------------------------------
# * Select
#---------------------------------------------------------------------------
def select
@selected = true
refresh
end # select
#---------------------------------------------------------------------------
# * Deselect
#---------------------------------------------------------------------------
def deselect
@selected = false
refresh
end # deselect
#---------------------------------------------------------------------------
# * Dispose
#---------------------------------------------------------------------------
def dispose
@icon.dispose
end # dispose
end # XMB_Sub_Menu
#=============================================================================
# ** Sprite_Menu
#-----------------------------------------------------------------------------
# The super class for all selectable sub menus within the XMB menu script
#=============================================================================
class Sprite_Menu < Sprite
#---------------------------------------------------------------------------
# * Public Instance Variables
#---------------------------------------------------------------------------
attr_accessor :index
attr_reader :info
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize
super
self.x = 146
@item_max = 1
@index = 0
end # initialize
#---------------------------------------------------------------------------
# * Update Frame
#---------------------------------------------------------------------------
def update
if @move_down
self.y += 12
@step -= 12
if @step == 0
@move_down = false
end # if @step
return
elsif @move_up
self.y -= 12
@step -= 12
if @step == 0
@move_up = false
end # if @step
return
else
# If Down button is pressed
if Input.repeat?(Input::DOWN) && @index > 0
@step = 48
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Change index
@index -= 1
# Shift up
@move_up = true
end # if Input
# If Up button is pressed
if Input.repeat?(Input::UP) && @index < (@item_max - 1)
@step = 48
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Change index
@index += 1
# Shift down
@move_down = true
end # if Input
# if Info window exists
if @info != nil
update_info
end # if @info
# Refresh contents, defined in sub classes
refresh
end # if @move_down elsif..
end # update
#---------------------------------------------------------------------------
# * Deselected Color
#---------------------------------------------------------------------------
def deselected_color
return Color.new(255, 255, 255, 125)
end # deselected_color
#---------------------------------------------------------------------------
# * Selected Color
#---------------------------------------------------------------------------
def selected_color
return Color.new(255, 255, 255, 255)
end # Selected_color
#---------------------------------------------------------------------------
# * Set Info Window
#---------------------------------------------------------------------------
def info=(info_window)
# Set info window
@info = info_window
if @info != nil
# update info
update_info
end # if @info
end # info
end # Sprite_menu
#=============================================================================
# ** Sprite_Selection
#-----------------------------------------------------------------------------
# This class is the parent class for any highlighted selection menus
#=============================================================================
class Sprite_Selection
#---------------------------------------------------------------------------
# * Public Instance Variables
#---------------------------------------------------------------------------
attr_accessor :index
attr_accessor :active
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize
@bg = Sprite.new
@bg.bitmap = Bitmap.new(640, 480)
@bg.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0, 255))
@bg.opacity = 180
@data = []
@index = 0
@item_max = 1
@active = true
end
#---------------------------------------------------------------------------
# * Update Frame
#---------------------------------------------------------------------------
def update
# Update Flash
if @index > -1
@data.each_index {|i|
@data[i].opacity = 255 if @data[i].opacity < 255 && i != @index
}
if @data[@index].opacity <= 100
@step = 10
elsif @data[@index].opacity >= 255
@step = -10
end
@data[@index].opacity += @step
else
@data.each {|sprite|
if sprite.opacity <= 100
@step = 10
elsif sprite.opacity >= 255
@step = -10
end
sprite.opacity += @step
}
end
# If Up is pressed
if Input.repeat?(Input::UP) && @index >= 0 && @active
# Play Cursor SE
$game_system.se_play($data_system.cursor_se)
# change index
@index = (@index - @item_max - 1) % @item_max
end
# If Down is pressed
if Input.repeat?(Input::DOWN) && @index >= 0 && @active
# Play Cusor SE
$game_system.se_play($data_system.cursor_se)
# Change index
@index = (@index + 1) % @item_max
end
end
#---------------------------------------------------------------------------
# * Dispose
#---------------------------------------------------------------------------
def dispose
@bg.dispose
@data.each {|sprite| sprite.dispose}
end
end # Sprite_Selection
#=============================================================================
# ** Sprite_Confirmation
#-----------------------------------------------------------------------------
# Class that displays Yes/No Confirmation Selection
#=============================================================================
class Sprite_Confirmation < Sprite_Selection
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize(confirmation_text)
super()
@text = Sprite.new
@text.bitmap = Bitmap.new(640, 48)
@text.bitmap.draw_text(0, 0, 640, 48, confirmation_text, 1)
@item_max = 2
words = ['Yes', 'No']
2.times {|i|
@data.push(RPG::Sprite.new)
@data[i].bitmap = Bitmap.new(640, 48)
@data[i].bitmap.draw_text(0, 0, 640, 48, words[i], 1)
}
@text.y = 168
@data[0].y = 216
@data[1].y = 264
end
#---------------------------------------------------------------------------
# * Dispose
#---------------------------------------------------------------------------
def dispose
@text.dispose
super
end
end # Sprite_Confirmation
#=============================================================================
# ** Sprite_Actor_Info
#-----------------------------------------------------------------------------
# Displays Actor Info for item/skill usage
#=============================================================================
class Sprite_Actor_Info < RPG::Sprite
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize(x, y, actor)
super()
self.x = x
self.y = y
self.bitmap = Bitmap.new(480, 64)
@actor = actor
refresh
end
#---------------------------------------------------------------------------
# * Refresh Contents
#---------------------------------------------------------------------------
def refresh
self.bitmap.clear
self.bitmap.draw_actor_graphic(@actor, 0, 8)
self.bitmap.draw_text(48, 0, 100, 32, @actor.name)
self.bitmap.draw_actor_hp(@actor, 48, 32)
self.bitmap.draw_actor_state(@actor, 212, 0)
self.bitmap.draw_actor_sp(@actor, 212, 32)
end
end # Sprite_Actor_Info
#=============================================================================
# ** Sprite_Actor_Preview
#-----------------------------------------------------------------------------
# Displays Actor Status Preview
#=============================================================================
class Sprite_Actor_Preview < RPG::Sprite
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize(actor)
super()
self.x = 32
self.y = 368
self.bitmap = Bitmap.new(480, 64)
@actor = actor
refresh
end
#---------------------------------------------------------------------------
# * Refresh Contents
#---------------------------------------------------------------------------
def refresh
self.bitmap.clear
self.bitmap.draw_actor_graphic(@actor, 0, 8)
self.bitmap.draw_text(48, 0, 100, 32, @actor.name)
self.bitmap.draw_actor_hp(@actor, 48, 32)
self.bitmap.draw_actor_sp(@actor, 212, 32)
end
end # Sprite_Actor_Info

#=============================================================================
# ** Sprite_Items
#-----------------------------------------------------------------------------
# This class draws the current items held available for use
#=============================================================================
class Sprite_Items < Sprite_Menu
#---------------------------------------------------------------------------
# * Constants
#---------------------------------------------------------------------------
ALPHANUMERIC = 0
QUANTITY = 1
STANDARD = 2
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize
super
redraw
end # initialize
#---------------------------------------------------------------------------
# * Redraw
#---------------------------------------------------------------------------
def redraw
if self.bitmap != nil
self.bitmap.clear
self.bitmap = nil
end
@data = []
# Add carried items to data array
(1...$data_items.size).each {|i|
non_key = ($data_items[i].scope != 0 || $data_items[i].occasion != 3)
if $game_party.item_number(i) > 0 && non_key
@data.push($data_items[i])
end
}
@item_max = @data.size
if @item_max > 0
# Sort Items
case $settings.item_sort_type
when ALPHANUMERIC
sort_alpha
when QUANTITY
sort_quantity
when STANDARD
@data.reverse! if $settings.item_sort_reverse
end
height = 48 * @item_max
self.bitmap = Bitmap.new(320, height)
self.y = 280 - height
if self.index > 0
self.y += self.index * 48
end
(0...@item_max).each {|i|
draw_item(i)
}
else
self.bitmap = Bitmap.new(320, 32)
self.y = 248
draw_item(nil)
end
end # redraw
#---------------------------------------------------------------------------
# * Refresh
#---------------------------------------------------------------------------
def refresh
# Used for refreshing menu, to avoid resorting data array
# Use redraw when item is used to clear empty item slots
self.bitmap.clear
if @item_max > 0
(0...@item_max).each {|i|
draw_item(i)
}
else
draw_item(nil)
end
end # refresh
#---------------------------------------------------------------------------
# * Sort by alphanumeric
#---------------------------------------------------------------------------
def sort_alpha
begin
swapped = false
(1...@data.size).each {|i|
if $settings.item_sort_reverse
if @data[i-1].name[0] < @data[i].name[0]
@data[i-1], @data[i] = @data[i], @data[i-1]
swapped = true
end
else
if @data[i-1].name[0] > @data[i].name[0]
@data[i-1], @data[i] = @data[i], @data[i-1]
swapped = true
end
end
}
end while swapped
end
#---------------------------------------------------------------------------
# * Sort by quantity
#---------------------------------------------------------------------------
def sort_quantity
begin
swapped = false
(1...@data.size).each {|i|
if $settings.item_sort_reverse
if $game_party.item_number(@data[i-1].id) > $game_party.item_number(@data[i].id)
@data[i-1], @data[i] = @data[i], @data[i-1]
swapped = true
end
else
if $game_party.item_number(@data[i-1].id) < $game_party.item_number(@data[i].id)
@data[i-1], @data[i] = @data[i], @data[i-1]
swapped = true
end
end
}
end while swapped
end
#---------------------------------------------------------------------------
# * Draw Item
#---------------------------------------------------------------------------
def draw_item(index)
if index == nil
self.bitmap.font.color = selected_color
self.bitmap.draw_text(4, 0, 212, 32, '(Empty)')
else
item = @data[index]
icon = RPG::Cache.icon(item.icon_name)
number = $game_party.item_number(item.id)
x = 4
y = self.bitmap.height - (48 * index) - 32
if index == self.index
self.bitmap.font.color = selected_color
opacity = 255
else
self.bitmap.font.color = deselected_color
opacity = 100
end
self.bitmap.blt(x, y + 4, icon, Rect.new(0, 0, 24, 24), opacity)
self.bitmap.draw_text(x + 28, y, 212, 32, item.name, 0)
self.bitmap.draw_text(x + 240, y, 16, 32, 'x', 1)
self.bitmap.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
end # draw_item
#---------------------------------------------------------------------------
# * Selected Item
#---------------------------------------------------------------------------
def item
return @data[self.index]
end # item
#---------------------------------------------------------------------------
# * Update Info
#---------------------------------------------------------------------------
def update_info
self.info.set_text(self.item == nil ? '' : self.item.description)
end # update_info
end # Sprite_Items
#=============================================================================
# ** Sprite_Sort
#-----------------------------------------------------------------------------
# This class allows the player to determine how to sort Items in inventory
#=============================================================================
class Sprite_Sort < Sprite_Menu
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize
super
self.bitmap = Bitmap.new(320, 144)
self.y = 136
@item_max = 3
@data = ['Alphanumeric', 'Quantity', 'Standard']
refresh
end
#---------------------------------------------------------------------------
# * Refresh
#---------------------------------------------------------------------------
def refresh
self.bitmap.clear
@data.each_index {|i|
y = 144 - (48 * i) - 32
self.bitmap.font.color = i == self.index ? selected_color : deselected_color
self.bitmap.draw_text(4, y, 320, 32, @data[i])
}
end
#---------------------------------------------------------------------------
# * Update Info
#---------------------------------------------------------------------------
def update_info
case self.index
when 0 # Alphanumeric
self.info.set_text('Sort items alphabetically')
when 1 # Quantity
self.info.set_text('Sory items by amount held')
when 2 # Standard
self.info.set_text('Sort items by ID number')
end
end
end # Sprite_Sort
#=============================================================================
# ** Sprite_Sort_Type
#-----------------------------------------------------------------------------
# This class handles whether sorting method is reversed or not
#=============================================================================
class Sprite_Sort_Type < Sprite_Selection
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize
super
words = ['Ascending Order', 'Descending Order']
2.times {|i|
@data.push(RPG::Sprite.new)
@data[i].bitmap = Bitmap.new(320, 48)
@data[i].x = 160
@data[i].y = 48 * i + 192
@data[i].bitmap.draw_text(0, 0, 320, 48, words[i], 1)
}
@item_max = 2
end # Initialize
end # Sprite_Sort_Type
#=============================================================================
# ** Sprite_Important
#-----------------------------------------------------------------------------
# This class displays the party's important items
#=============================================================================
class Sprite_Important < Sprite_Menu
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize
super
draw
end # initialize
#---------------------------------------------------------------------------
# * Redraw
#---------------------------------------------------------------------------
def draw
if self.bitmap != nil
self.bitmap.clear
self.bitmap = nil
end
@data = []
# Add carried items to data array
(1...$data_items.size).each {|i|
non_key = ($data_items[i].scope == 0 && $data_items[i].occasion == 3)
if $game_party.item_number(i) > 0 && non_key
@data.push($data_items[i])
end
}
@item_max = @data.size
if @item_max > 0
height = 48 * @item_max
self.bitmap = Bitmap.new(320, height)
self.y = 280 - height
(0...@item_max).each {|i| draw_item(i)}
else
self.bitmap = Bitmap.new(320, 32)
self.y = 248
draw_item(nil)
end
end # redraw
#---------------------------------------------------------------------------
# * Refresh
#---------------------------------------------------------------------------
def refresh
# Used for refreshing menu
self.bitmap.clear
if @item_max > 0
(0...@item_max).each {|i| draw_item(i)}
else
draw_item(nil)
end
end # refresh
#---------------------------------------------------------------------------
# * Draw Item
#---------------------------------------------------------------------------
def draw_item(index)
if index == nil
self.bitmap.font.color = selected_color
self.bitmap.draw_text(4, 0, 212, 32, '(Empty)')
else
item = @data[index]
icon = RPG::Cache.icon(item.icon_name)
number = $game_party.item_number(item.id)
x = 4
y = self.bitmap.height - (48 * index) - 32
if index == self.index
self.bitmap.font.color = selected_color
opacity = 255
else
self.bitmap.font.color = deselected_color
opacity = 100
end
self.bitmap.blt(x, y + 4, icon, Rect.new(0, 0, 24, 24), opacity)
self.bitmap.draw_text(x + 28, y, 212, 32, item.name, 0)
self.bitmap.draw_text(x + 240, y, 16, 32, 'x', 1)
self.bitmap.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
end # draw_item
#---------------------------------------------------------------------------
# * Selected Item
#---------------------------------------------------------------------------
def item
return @data[self.index]
end # item
#---------------------------------------------------------------------------
# * Update Info
#---------------------------------------------------------------------------
def update_info
self.info.set_text(self.item == nil ? '' : self.item.description)
end # update_info
end # Sprite_Important
#=============================================================================
# ** Sprite_Skills
#-----------------------------------------------------------------------------
# This class displays selected party member's skills
#=============================================================================
class Sprite_Skills < Sprite_Menu
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize(actor)
super()
@actor = actor
draw
end
#---------------------------------------------------------------------------
# * Refresh
#---------------------------------------------------------------------------
def draw
if self.bitmap != nil
self.bitmap.clear
self.bitmap = nil
end
@data = []
@actor.skills.each_index {|i|
skill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
}
@item_max = @data.size
if @item_max > 0
height = 48 * @item_max
self.bitmap = Bitmap.new(320, height)
self.y = 280 - height
@data.each_index {|i| draw_skill(i)}
end
end
#---------------------------------------------------------------------------
# * Refresh
#---------------------------------------------------------------------------
def refresh
self.bitmap.clear
@data.each_index {|i| draw_skill(i)}
end
#---------------------------------------------------------------------------
# * Draw Skill
#---------------------------------------------------------------------------
def draw_skill(index)
skill = @data[index]
icon = RPG::Cache.icon(skill.icon_name)
x = 4
y = self.bitmap.height - (index * 48) - 32
if index == self.index
self.bitmap.font.color = selected_color
opacity = 255
else
self.bitmap.font.color = deselected_color
opacity = 100
end
self.bitmap.blt(x, y + 4, icon, Rect.new(0, 0, 24, 24), opacity)
self.bitmap.draw_text(x + 28, y, 212, 32, skill.name, 0)
self.bitmap.draw_text(x + 240, y, 36, 32, skill.sp_cost.to_s, 2)
self.bitmap.draw_text(x + 276, y, 36, 32, 'Sp', 2)
end
#---------------------------------------------------------------------------
# * Update Info
#---------------------------------------------------------------------------
def update_info
self.info.set_text(self.skill == nil ? '' : self.skill.description)
end
#---------------------------------------------------------------------------
# * Skill
#---------------------------------------------------------------------------
def skill
return @data[self.index]
end
end # Sprite_Skills
#=============================================================================
# ** Sprite_Equip
#-----------------------------------------------------------------------------
# The selection menu for equip type
#=============================================================================
class Sprite_Equip < Sprite_Selection
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize(actor)
super()
@actor = actor
@item_max = 5
@items = []
@display = Sprite.new
@display.bitmap = Bitmap.new(232, 160)
@display.x = 328
@display.y = 272
5.times {|i|
@data.push(RPG::Sprite.new)
@data[i].bitmap = Bitmap.new(200, 32)
@data[i].x = 128
@data[i].y = i * 32 + 272
}
@data[0].bitmap.draw_text(0, 0, 200, 32, $data_system.words.weapon)
@data[1].bitmap.draw_text(0, 0, 200, 32, $data_system.words.armor1)
@data[2].bitmap.draw_text(0, 0, 200, 32, $data_system.words.armor2)
@data[3].bitmap.draw_text(0, 0, 200, 32, $data_system.words.armor3)
@data[4].bitmap.draw_text(0, 0, 200, 32, $data_system.words.armor4)
refresh
end
#---------------------------------------------------------------------------
# * Refresh
#---------------------------------------------------------------------------
def refresh
@display.bitmap.clear
@items[0] = $data_weapons[@actor.weapon_id]
@items[1] = $data_armors[@actor.armor1_id]
@items[2] = $data_armors[@actor.armor2_id]
@items[3] = $data_armors[@actor.armor3_id]
@items[4] = $data_armors[@actor.armor4_id]
@items.each_index {|i|
@display.bitmap.draw_item_name(@items[i], 0, i * 32)
}
end
#---------------------------------------------------------------------------
# * Item
#---------------------------------------------------------------------------
def item
return @items[@index]
end
#---------------------------------------------------------------------------
# * Dispose
#---------------------------------------------------------------------------
def dispose
super
@display.dispose
end
end
#=============================================================================
# ** Sprite_Equipment
#-----------------------------------------------------------------------------
# This class displays selected party member's equipment
#=============================================================================
class Sprite_Equipment
#---------------------------------------------------------------------------
# * Public Instance Variables
#---------------------------------------------------------------------------
attr_reader :phase
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize(actor)
@actor = actor
@phase = 0
# Create Equip Menu
@equipment = Sprite_Equip.new(@actor)
# Draw Actor Info
@actor_info = Sprite.new
@actor_info.bitmap = Bitmap.new(400, 64)
@actor_info.x, @actor_info.y = 128, 32
@actor_info.bitmap.draw_text(0, 0, 200, 32, @actor.name)
@actor_info.bitmap.draw_text(200, 0, 200, 32, $data_classes[@actor.class_id].name)
@actor_info.bitmap.draw_actor_hp(@actor, 0, 32)
@actor_info.bitmap.draw_actor_sp(@actor, 200, 32)
# Create Parameters sprite
@parameters = Sprite.new
@parameters.bitmap = Bitmap.new(240, 96)
@parameters.x, @parameters.y = 128, 136
refresh
end
#---------------------------------------------------------------------------
# * Refresh
#---------------------------------------------------------------------------
def refresh
# Draw Actor Parameters
@parameters.bitmap.clear
4.times {|i| @parameters.bitmap.draw_actor_parameter(@actor, 0, i * 32, i) }
if @new_atk != nil
@parameters.bitmap.draw_text(160, 0, 40, 32, '>>', 1)
@parameters.bitmap.draw_text(200, 0, 36, 32, @new_atk.to_s, 2)
end
if @new_pdef != nil
@parameters.bitmap.draw_text(160, 32, 40, 32, '>>', 1)
@parameters.bitmap.draw_text(200, 32, 36, 32, @new_pdef.to_s, 2)
end
if @new_mdef != nil
@parameters.bitmap.draw_text(160, 64, 40, 32, '>>', 1)
@parameters.bitmap.draw_text(200, 64, 36, 32, @new_mdef.to_s, 2)
end
end
#---------------------------------------------------------------------------
# * Update
#---------------------------------------------------------------------------
def update
# Update Equipment selection
@equipment.update
update_info
unless @phase == 0
update_equip_item
return
end
# If C button is pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Open Equip Item menu
@equip_item = Sprite_Equip_Item.new(@actor, @equipment.index)
@equipment.active = false
@phase = 1
return
end
end
#---------------------------------------------------------------------------
# * Update Equip Item
#---------------------------------------------------------------------------
def update_equip_item
# Update Equip Item Menu
@equip_item.update
# Get equipped item
item1 = @equipment.item
# Get currently selected item
item2 = @equip_item.item
# Change equipment
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@equipment.index, item2 == nil ? 0 : item2.id)
# Get parameters for after equipment change
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
# Return equipment
@actor.equip(@equipment.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# Draw new stats
new_parameters(new_atk, new_pdef, new_mdef)
# If B button is pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Return to equipment selection
@equip_item.dispose
@equip_item = nil
@equipment.active = true
new_parameters(nil, nil, nil)
@phase = 0
# Update Input to clear key cache
Input.update
return
end
# If C button is pressed
if Input.trigger?(Input::C)
# Play equip SE
$game_system.se_play($data_system.equip_se)
# Equip Item
@actor.equip(@equipment.index, item2 == nil ? 0 : item2.id)
# Return
@phase = 0
@equip_item.dispose
@equip_item = nil
@equipment.refresh
@equipment.active = true
new_parameters(nil, nil, nil)
return
end
end
#---------------------------------------------------------------------------
# * New Parameters
#---------------------------------------------------------------------------
def new_parameters(new_atk, new_pdef, new_mdef)
if @new_atk != new_atk || @new_pdef != new_pdef || @new_mdef != new_mdef
@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
refresh
end
end
#---------------------------------------------------------------------------
# * Dispose
#---------------------------------------------------------------------------
def dispose
@equipment.dispose
@actor_info.dispose
@parameters.dispose
end
#---------------------------------------------------------------------------
# * Info
#---------------------------------------------------------------------------
def info=(info)
@info = info
end
#---------------------------------------------------------------------------
# * Update Info
#---------------------------------------------------------------------------
def update_info
if @equipment.active
item = @equipment.item
else
item = @equip_item.item
end
@info.set_text(item == nil ? '' : item.description)
end
end # Sprite_Equipment
#=============================================================================
# ** Sprite_Equip_Item
#-----------------------------------------------------------------------------
# This class allows the player to select item to equip
#=============================================================================
class Sprite_Equip_Item
#---------------------------------------------------------------------------
# * Public Instance Variables
#---------------------------------------------------------------------------
attr_accessor :index
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize(actor, type)
@actor = actor
@type = type
@index = 0
# Create Viewport for scrolling
@viewport = Viewport.new(354, 256, 272, 192)
@viewport.z = 9999
# Create background
@back = Sprite.new(@viewport)
@back.bitmap = Bitmap.new(240, 192)
@back.bitmap.fill_rect(0, 0, 272, 192, Color.new(0, 0, 0, 255))
@back.opacity = 180
@data = []
@items = []
refresh
end
#---------------------------------------------------------------------------
# * Refresh
#---------------------------------------------------------------------------
def refresh
if @type == 0
j = 0
(1...$data_weapons.size).each {|i|
weap_set = $data_classes[@actor.class_id].weapon_set
if $game_party.weapon_number(i) > 0 && weap_set.include?(i)
@data.push(RPG::Sprite.new(@viewport))
@data[j].bitmap = Bitmap.new(240, 32)
@data[j].bitmap.draw_item_name($data_weapons[i], 4, 0)
@items.push($data_weapons[i])
j += 1
end
}
else
j = 0
(1...$data_armors.size).each {|i|
armor_set = $data_classes[@actor.class_id].armor_set
if $game_party.armor_number(i) > 0 && armor_set.include?(i) &&
$data_armors[i].kind == @type - 1
@data.push(RPG::Sprite.new(@viewport))
@data[j].bitmap = Bitmap.new(240, 32)
@data[j].bitmap.draw_item_name($data_armors[i], 4, 0)
@items.push($data_armors[i])
j += 1
end
}
end
@data.push(RPG::Sprite.new(@viewport))
@data[@data.size-1].bitmap = Bitmap.new(240, 32)
@data[@data.size-1].bitmap.draw_text(4, 0, 200, 32, '(Empty)')
@items.push(nil)
# Arrange Items
@data.each_index {|i|
@data[i].y = i * 32
}
@item_max = @data.size
if @item_max * 32 > 192
draw_arrows
end
end
#---------------------------------------------------------------------------
# * Draw Arrows
#---------------------------------------------------------------------------
def draw_arrows
@arrows = []
# Draw Up Arrow
@arrows[0] = Sprite.new
@arrows[0].x, @arrows[0].y, @arrows[0].z = 540, 224, 9999
@arrows[0].bitmap = Bitmap.new(136, 136)
image = RPG::Cache.picture('menu/Arrow_up')
image_s = RPG::Cache.picture('menu/Arrow_up_s')
bmp_rect = Rect.new(0, 0, 128, 128)
# Draw Shadow
@arrows[0].bitmap.blt(2, 2, image_s, bmp_rect, 100)
@arrows[0].bitmap.blt(4, 4, image_s, bmp_rect, 50)
@arrows[0].bitmap.blt(6, 6, image_s, bmp_rect, 25)
# Draw Icon
@arrows[0].bitmap.blt(0, 0, image, bmp_rect)
# Draw Down Arrow
@arrows[1] = Sprite.new
@arrows[1].x, @arrows[1].y, @arrows[1].z = 540, 352, 9999
@arrows[1].bitmap = Bitmap.new(136, 136)
image = RPG::Cache.picture('menu/Arrow_down')
image_s = RPG::Cache.picture('menu/Arrow_down_s')
# Draw Shadow
@arrows[1].bitmap.blt(2, 2, image_s, bmp_rect, 100)
@arrows[1].bitmap.blt(4, 4, image_s, bmp_rect, 50)
@arrows[1].bitmap.blt(6, 6, image_s, bmp_rect, 25)
# Draw Icon
@arrows[1].bitmap.blt(0, 0, image, bmp_rect)
# Set Visibility
@arrows[0].visible = @data[0].y < 0
@arrows[1].visible = @data[@item_max - 1].y > 160
end
#---------------------------------------------------------------------------
# * Update
#---------------------------------------------------------------------------
def update
# Update Flash
@data.each_index {|i|
@data[i].opacity = 255 if @data[i].opacity < 255 && i != @index
}
if @data[@index].opacity <= 100
@step = 10
elsif @data[@index].opacity >= 255
@step = -10
end
@data[@index].opacity += @step
# Update Scroll arrows
if @arrows != nil
@arrows[0].visible = @data[0].y < 0
@arrows[1].visible = @data[@item_max - 1].y > 160
end
# If Up Button is pressed
if Input.repeat?(Input::UP) && @index > 0
# Play Cursor SE
$game_system.se_play($data_system.cursor_se)
# Decrease index
@index -= 1
# If scroll needed
if @data[0].y < 0
scroll_up
end
return
end
# If Down Button is pressed
if Input.repeat?(Input::DOWN) && @index < @item_max - 1
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Increase index
@index += 1
# If scroll needed
if @data[@item_max - 1].y > 160
scroll_down
end
return
end
end
#---------------------------------------------------------------------------
# * Dispose
#---------------------------------------------------------------------------
def dispose
@viewport.dispose
@back.dispose
@data.each {|sprite| sprite.dispose}
if @arrows != nil
@arrows.each {|arrow| arrow.dispose}
end
end
#---------------------------------------------------------------------------
# * Scroll Up
#---------------------------------------------------------------------------
def scroll_up
@data.each {|sprite| sprite.y += 32}
end
#---------------------------------------------------------------------------
# * Scroll Down
#---------------------------------------------------------------------------
def scroll_down
@data.each {|sprite| sprite.y -= 32}
end
#---------------------------------------------------------------------------
# * Item
#---------------------------------------------------------------------------
def item
return @items[@index]
end
end # Sprite_Equip_Item
#=============================================================================
# ** Sprite_Music
#-----------------------------------------------------------------------------
# This class handles music volume adjustments
#=============================================================================
class Sprite_Music < Sprite
ICON_UP = RPG::Cache.icon('Menu_Icon_Sound_More')
ICON_DOWN = RPG::Cache.icon('Menu_Icon_Sound_Less')
SRC_RECT = Rect.new(0, 0, 24, 24)
#---------------------------------------------------------------------------
# * Object Initializatioin
#---------------------------------------------------------------------------
def initialize
super
self.x = 146
self.y = 264
self.bitmap = Bitmap.new(216, 32)
refresh
end
#---------------------------------------------------------------------------
# * Refresh Content
#---------------------------------------------------------------------------
def refresh
# Clear bitmap
self.bitmap.clear
# Draw Icons
self.bitmap.blt(0, 4, ICON_DOWN, SRC_RECT)
self.bitmap.blt(192, 4, ICON_UP, SRC_RECT)
# Draw bar
self.bitmap.draw_gradient_bar(28, 8, 160, 16, $settings.music_volume, 100,
Color.new(25, 25, 255, 255), Color.new(175, 175, 255, 255))
end
#---------------------------------------------------------------------------
# * Update Frame
#---------------------------------------------------------------------------
def update
# if Left button is pressed
if Input.repeat?(Input::LEFT) && $settings.music_volume > 0
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Decrease volume
$settings.music_volume -= 5
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
refresh
end
# if Right button is pressed
if Input.repeat?(Input::RIGHT) && $settings.music_volume < 100
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Increase volume
$settings.music_volume += 5
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
refresh
end
end
end
#=============================================================================
# ** Sprite_Sound
#-----------------------------------------------------------------------------
# This class handles sound volume adjustments
#=============================================================================
class Sprite_Sound < Sprite
ICON_UP = RPG::Cache.icon('Menu_Icon_Sound_More')
ICON_DOWN = RPG::Cache.icon('Menu_Icon_Sound_Less')
SRC_RECT = Rect.new(0, 0, 24, 24)
#---------------------------------------------------------------------------
# * Object Initializatioin
#---------------------------------------------------------------------------
def initialize
super
self.x = 146
self.y = 264
self.bitmap = Bitmap.new(216, 32)
refresh
end
#---------------------------------------------------------------------------
# * Refresh Content
#---------------------------------------------------------------------------
def refresh
# Clear bitmap
self.bitmap.clear
# Draw Icons
self.bitmap.blt(0, 4, ICON_DOWN, SRC_RECT)
self.bitmap.blt(192, 4, ICON_UP, SRC_RECT)
# Draw bar
self.bitmap.draw_gradient_bar(28, 8, 160, 16, $settings.sound_volume, 100,
Color.new(25, 25, 255, 255), Color.new(175, 175, 255, 255))
end
#---------------------------------------------------------------------------
# * Update Frame
#---------------------------------------------------------------------------
def update
# if Left button is pressed
if Input.repeat?(Input::LEFT) && $settings.sound_volume > 0
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Decrease volume
$settings.sound_volume -= 5
refresh
end
# if Right button is pressed
if Input.repeat?(Input::RIGHT) && $settings.sound_volume < 100
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Increase volume
$settings.sound_volume += 5
refresh
end
end
end
#=============================================================================
# ** Sprite_Theme
#-----------------------------------------------------------------------------
# This class allows the player to modify in-game settings
#=============================================================================
class Sprite_Theme < Sprite_Menu
#---------------------------------------------------------------------------
# * Constants
#---------------------------------------------------------------------------
SRC_RECT = Rect.new(0, 0, 640, 480) # Src Rect for background preview
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize
super
# Setup data
@data = []
# Add themes
$settings.themes.each {|theme| @data.push(theme)}
# Set size and position
height = @data.size * 136
self.y = 348 - height
self.bitmap = Bitmap.new(480, height)
@item_max = @data.size
refresh
end # initialize
#---------------------------------------------------------------------------
# * Refresh Contents
#---------------------------------------------------------------------------
def refresh
# Clear bitmap
self.bitmap.clear
# Draw contents
@data.each_index {|i|
self.bitmap.font.color = i == self.index ? selected_color : deselected_color
self.bitmap.draw_text(180, (@item_max - i - 1) * 136 + 45, 320, 32, @data[i])
# draw Preview
bmp = RPG::Cache.picture('back/' + @data[i])
opacity = i == self.index ? 255 : 100
# Draw Shadow
self.bitmap.fill_rect(2, (@item_max - i - 1) * 136 + 2, 162, 122,
Color.new(0, 0, 0, 100))
self.bitmap.fill_rect(3, (@item_max - i - 1) * 136 + 3, 162, 122,
Color.new(0, 0, 0, 50))
# Draw frame
self.bitmap.draw_frame(0, (@item_max - i - 1) * 136, 162, 122,
Color.new(255, 255, 255, 255))
rect = Rect.new(1, (@item_max - i - 1) * 136 + 1, 160, 120)
self.bitmap.stretch_blt(rect, bmp, SRC_RECT, opacity)
}
end # refresh
#---------------------------------------------------------------------------
# * Update Frame
#---------------------------------------------------------------------------
def update
if @move_down
self.y += 34
@step -= 34
if @step == 0
@move_down = false
end # if @step
return
elsif @move_up
self.y -= 34
@step -= 34
if @step == 0
@move_up = false
end # if @step
return
else
# If Down button is pressed
if Input.repeat?(Input::DOWN) && @index > 0
@step = 136
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Change index
@index -= 1
# Shift up
@move_up = true
end # if Input
# If Up button is pressed
if Input.repeat?(Input::UP) && @index < (@item_max - 1)
@step = 136
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Change index
@index += 1
# Shift down
@move_down = true
end # if Input
# if Info window exists
if @info != nil
update_info
end # if @info
# Refresh contents
refresh
end # if @move_down elsif..
end # update
#---------------------------------------------------------------------------
# * Theme
#---------------------------------------------------------------------------
def theme
# Return selected theme
return @data[self.index]
end # theme
end # Sprite_Theme
#=============================================================================
# ** Sprite_File_Preview
#-----------------------------------------------------------------------------
# This class displays the file preview
#=============================================================================
class Sprite_File_Preview < Sprite
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(file_index)
super()
self.bitmap = Bitmap.new(640, 72)
self.y = 364
self.z = 9998
@bg = Sprite.new
@bg.bitmap = Bitmap.new(640, 72)
@bg.y = 364
@bg.z = 9997
@bg.bitmap.draw_gradient(0, 0, 640, 72, Color.new(0, 0, 0, 100), Color.new(0, 0, 0, 0))
@file_index = file_index
@filename = "Save#{@file_index + 1}.rxdata"
@time_stamp = Time.at(0)
@file_exist = FileTest.exist?(@filename)
if @file_exist
file = File.open(@filename, 'r')
@time_stamp = file.mtime
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@game_system = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
file.close
end
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.bitmap.clear
# Draw file number
name = "Slot #{@file_index + 1}"
self.bitmap.draw_text(32, 0, 600, 32, name)
# If save file exists
if @file_exist
# Draw character
(0...@characters.size).each {|i|
bmp = RPG::Cache.character(@characters[i][0], @characters[i][1])
cw = bmp.rect.width / 4
ch = bmp.rect.height / 4
src_rect = Rect.new(0, 0, cw, ch)
x = 300 - @characters.size * 32 + i * 64 - cw / 2
self.bitmap.blt(x, 60 - ch, bmp, src_rect)
}
# Draw play time
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
time_string = sprintf('%02d:%02d:%02d', hour, min, sec)
self.bitmap.draw_text(4, 0, 600, 32, time_string, 2)
# Draw timestamp
time_string = @time_stamp.strftime('%Y/%m/%d %H:%M')
self.bitmap.draw_text(4, 32, 600, 32, time_string, 2)
end
end
#---------------------------------------------------------------------------
# * Dispose
#---------------------------------------------------------------------------
def dispose
@bg.dispose
super
end
end # Sprite_File_Preview
#=============================================================================
# ** Sprite_File
#-----------------------------------------------------------------------------
# Parent Class for file menus
#=============================================================================
class Sprite_File < Sprite_Menu
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize
super
self.bitmap = Bitmap.new(320, 480)
self.y = -200
@item_max = 10
@data = []
10.times {|i| @data.push('Slot ' + (i + 1).to_s)}
refresh
end
#---------------------------------------------------------------------------
# * Refresh
#---------------------------------------------------------------------------
def refresh
# Clear bitmap
self.bitmap.clear
# Draw data
@data.each_index {|i|
y = self.bitmap.height - (i * 48) - 32
self.bitmap.font.color = i == self.index ? selected_color : deselected_color
self.bitmap.draw_text(4, y, 320, 32, @data[i])
}
if @preview != nil
@preview.dispose
@preview = nil
end
@preview = Sprite_File_Preview.new(self.index)
end
#---------------------------------------------------------------------------
# * Dispose
#---------------------------------------------------------------------------
def dispose
@preview.dispose
super
end
end # Sprite_File
#=============================================================================
# ** Sprite_Quit
#-----------------------------------------------------------------------------
# Quit Confirmation menu
#=============================================================================
class Sprite_Quit < Sprite_Menu
#---------------------------------------------------------------------------
# * Constants
#---------------------------------------------------------------------------
ICONS = [RPG::Cache.icon('Menu_Icon_Quit'),
RPG::Cache.icon('Menu_Icon_Reset'),
RPG::Cache.icon('Menu_Icon_Cancel')]
SRC_RECT = Rect.new(0, 0, 24, 24)
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize
super
self.y = 136
self.bitmap = Bitmap.new(320, 144)
@item_max = 3
@data = ['Shutdown', 'Reset', 'Cancel']
refresh
end # initialize
#---------------------------------------------------------------------------
# * Refresh Contents
#---------------------------------------------------------------------------
def refresh
# Clear Bitmap
self.bitmap.clear
# Draw contents
@data.each_index {|i|
y = 144 - (i * 48) - 32
self.bitmap.font.color = i == self.index ? selected_color : deselected_color
self.bitmap.draw_text(32, y, 312, 32, @data[i])
bmp = ICONS[i]
opacity = i == self.index ? 255 : 100
self.bitmap.blt(4, y + 4, bmp, SRC_RECT, opacity)
}
end # refresh
#---------------------------------------------------------------------------
# * Update Info
#---------------------------------------------------------------------------
def update_info
case self.index
when 0 # Shutdown
self.info.set_text('Quit game')
when 1 # Reset
self.info.set_text('Return to title screen')
when 2 # Cancel
self.info.set_text('Return to menu')
end # case self.index
end # update_info
end # Sprite_Quit
#=============================================================================
# ** Sprite_Party
#-----------------------------------------------------------------------------
# This class allows the player to select party members
#=============================================================================
class Sprite_Party < Sprite_Menu
#---------------------------------------------------------------------------
# * Public Instance Variables
#---------------------------------------------------------------------------
attr_accessor :selected
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize
super
@back = Sprite.new
@back.bitmap = Bitmap.new(640, 64)
@back.x = 0
@back.y = 372
@back.bitmap.draw_gradient(0, 0, 640, 64, Color.new(0,0,0,100),
Color.new(0,0,0,0))
@selected = nil
@item_max = $game_party.actors.size
height = @item_max * 48
self.bitmap = Bitmap.new(320, height)
self.y = 280 - height
refresh
end
#---------------------------------------------------------------------------
# * Refresh
#---------------------------------------------------------------------------
def refresh
self.bitmap.clear
@data = []
$game_party.actors.each {|actor|
@data.push(actor.name)
}
@data.each_index {|i|
self.bitmap.font.color = i == self.index || @selected == i ?
selected_color : deselected_color
y = self.bitmap.height - i * 48 - 32
self.bitmap.draw_text(4, y, 316, 32, @data[i])
}
if self.index != @last_index
if @preview != nil
@preview.dispose
@preview = nil
end
@preview = Sprite_Actor_Preview.new($game_party.actors[self.index])
else
@preview.refresh
end
@last_index = self.index
end
#---------------------------------------------------------------------------
# * Dispose
#---------------------------------------------------------------------------
def dispose
@back.dispose
@preview.dispose
super
end
#---------------------------------------------------------------------------
# * Visible
#---------------------------------------------------------------------------
def visible(visible, hide_preview=true)
if hide_preview
@back.visible = visible
@preview.visible = visible
end
self.visible = visible
end
end
#=============================================================================
# ** Sprite_Status
#-----------------------------------------------------------------------------
# This Class displays actor status info
#=============================================================================
class Sprite_Status
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize(actor)
# Draw Background
@bg = Sprite.new
@bg.bitmap = Bitmap.new(640, 480)
@bg.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0, 255))
@bg.opacity = 180
# Draw Actor Status
@status = Sprite.new
@status.bitmap = Bitmap.new(640, 480)
# Draw Name
@status.bitmap.draw_text(128, 32, 200, 32, actor.name)
# Draw Class
@status.bitmap.draw_text(328, 32, 200, 32, $data_classes[actor.class_id].name)
# Draw HP
@status.bitmap.draw_actor_hp(actor, 128, 64)
# Draw SP
@status.bitmap.draw_actor_sp(actor, 328, 64)
# Draw Divider
@status.bitmap.fill_rect(118, 104, 420, 1, Color.new(255, 255, 255, 255))
# Draw Level
@status.bitmap.draw_actor_level(actor, 128, 112)
# Draw EXP
@status.bitmap.draw_actor_exp(actor, 328, 112)
# Draw Divider
@status.bitmap.fill_rect(118, 184, 420, 1, Color.new(255, 255, 255, 255))
# Draw Parameters
7.times {|i|
@status.bitmap.draw_actor_parameter(actor, 128, i * 32 + 192, i)
}
# Draw Divider
@status.bitmap.fill_rect(312, 184, 1, 234, Color.new(255, 255, 255, 255))
# Draw Equipment
@status.bitmap.font.size -= 5
@status.bitmap.draw_text(328, 192, 200, 32, 'EQUIPMENT')
@status.bitmap.font.size += 5
# Draw Divider
@status.bitmap.fill_rect(312, 230, 226, 1, Color.new(255, 255, 255, 255))
# Draw Items
@status.bitmap.draw_item_name($data_weapons[actor.weapon_id], 328, 240)
@status.bitmap.draw_item_name($data_armors[actor.armor1_id], 328, 272)
@status.bitmap.draw_item_name($data_armors[actor.armor2_id], 328, 304)
@status.bitmap.draw_item_name($data_armors[actor.armor3_id], 328, 336)
@status.bitmap.draw_item_name($data_armors[actor.armor4_id], 328, 368)
end
#---------------------------------------------------------------------------
# * Dispose
#---------------------------------------------------------------------------
def dispose
@bg.dispose
@status.dispose
end
end # Sprite_Status
#=============================================================================
# ** Sprite_Target
#-----------------------------------------------------------------------------
# A catchall class for targetting party members
#=============================================================================
class Sprite_Target < Sprite_Selection
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize
super
@item_max = $game_party.actors.size
height = @item_max * 96
@item_max.times {|i|
y = 240 - (height / 2) + (i * 96)
@data.push(Sprite_Actor_Info.new(160, y, $game_party.actors[i]))
}
end
#---------------------------------------------------------------------------
# * Refresh
#---------------------------------------------------------------------------
def refresh
@data.each {|sprite| sprite.refresh}
end
end # Sprite_Target
#=============================================================================
# ** Sprite_PlayTime
#-----------------------------------------------------------------------------
# This Sprite displays the length of time played
#=============================================================================
class Sprite_PlayTime
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize
# Create display time Sprite
@time = Sprite.new
@time.x = 450
@time.y = 8
@time.bitmap = Bitmap.new(140, 48)
# Create icon Sprite
@icon = Sprite.new
@icon.x = 600
@icon.y = 20
@icon.bitmap = Bitmap.new(36, 36)
icon = RPG::Cache.picture('/menu/Time')
shadow = RPG::Cache.picture('/menu/Time_s')
# Draw Icon and shadow
@icon.bitmap.blt(1, 1, shadow, Rect.new(0, 0, 24, 24), 100)
@icon.bitmap.blt(2, 2, shadow, Rect.new(0, 0, 24, 24), 50)
@icon.bitmap.blt(3, 3, shadow, Rect.new(0, 0, 24, 24), 25)
@icon.bitmap.blt(0, 0, icon, Rect.new(0, 0, 24, 24))
refresh
end # initialize
#---------------------------------------------------------------------------
# * Refresh Contents
#---------------------------------------------------------------------------
def refresh
@time.bitmap.clear
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf('%02d:%02d:%02d', hour, min, sec)
@time.bitmap.draw_text(0, 8, 140, 32, text, 2)
end # refresh
#--------------------------------------------------------------------------
# * Update Frame
#--------------------------------------------------------------------------
def update
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end # if Graphics
end # refresh
#---------------------------------------------------------------------------
# * Dispose
#---------------------------------------------------------------------------
def dispose
@time.dispose
@icon.dispose
end # dispose
end # Sprite_PlayTime
#=============================================================================
# ** Sprite_Info
#-----------------------------------------------------------------------------
# Draws in-menu help info
#=============================================================================
class Sprite_Info < Sprite
#---------------------------------------------------------------------------
# * Initialize
#---------------------------------------------------------------------------
def initialize
super
self.y = 440
self.z = 9998
# Create bitmap
self.bitmap = Bitmap.new(640, 32)
# Draw bar back
self.bitmap.draw_gradient(0, 0, 640, 32, Color.new(0,0,0,100),
Color.new(0,0,0,0))
end # intitialize
#---------------------------------------------------------------------------
# * Set Text
#---------------------------------------------------------------------------
def set_text(text)
# if text has changed
if text != @text
# Clear bitmap
self.bitmap.clear
# Redraw bar back
self.bitmap.draw_gradient(0, 0, 640, 32, Color.new(0,0,0,100),
Color.new(0,0,0,0))
# Draw new text
self.bitmap.draw_text(16, 0, 640, 32, text)
# Store current text
@text = text
end # if text
end # set_text
end # Sprite_Info
#=============================================================================
# ** Sprite_Currency
#-----------------------------------------------------------------------------
# Draws the current amount of money held by the party
#=============================================================================
class Sprite_Currency < Sprite
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize
super
self.x = 450
self.y = 48
self.bitmap = Bitmap.new(140, 32)
self.bitmap.draw_text(0, 0, 140, 32, $game_party.gold.to_s + '$', 2)
end # initialize
end # Sprite_Currency
#=============================================================================
# ** Scene_Menu
#-----------------------------------------------------------------------------
# Puts together the psp styled menu
#=============================================================================
class Scene_Menu
attr_accessor :phase
#---------------------------------------------------------------------------
# * Constants
#---------------------------------------------------------------------------
# Menu Phases
MAIN = 0; CONSUME = 1; SORT = 2; IMPORTANT = 3; STATUS = 4; EQUIP = 5
SKILLS = 6; SWITCH = 7; SOUND = 8; MUSIC = 9; THEME = 10; SAVE = 11
LOAD = 12; QUIT = 13
#---------------------------------------------------------------------------
# * Main Processing
#---------------------------------------------------------------------------
def main
# set phase
@phase = MAIN
# Create PSP Background
@background = Sprite.new
@background.bitmap = RPG::Cache.picture('back/' + $settings.bg)
# Create info Bar
@info = Sprite.new
@info = Sprite_Info.new
# Sub Options Array
sub_options = [['Consume', 'Sort', 'Important'], # inventory
['Status', 'Equip', 'Skills', 'Switch'], # Party
['Sound', 'Music', 'Theme'], # Settings
['Save', 'Load', 'Quit']] # System
# Create Menu options array
menu_options = ['Inventory', 'Party', 'Settings', 'System']
@menu = []
menu_options.each_index {|i|
@menu.push(XMB_Menu.new(menu_options[i], sub_options[i], i))
}
@menu_index = 0
@play_time = Sprite_PlayTime.new
@currency = Sprite_Currency.new
# Execute transition
Graphics.transition
# Main loop
loop do
# Update graphics
Graphics.update
# Update Input
Input.update
# Update frame
update
# If scene has changed, break loop
if $scene != self
break
end # if $scene
end # loop
# Prepare transition
Graphics.freeze
# Dispose graphics
@menu.each {|menu|
menu.options.each {|option| option.dispose }
menu.dispose
}
@play_time.dispose
@info.dispose
@currency.dispose
@background.dispose
end
#---------------------------------------------------------------------------
# * Update Frame
#---------------------------------------------------------------------------
def update
# Set info text to current location
@info.set_text($game_map.map_name)
# Update playtime sprite
@play_time.update
if @phase == CONSUME && @menu[@menu_index].step == 0
# Move to Consume menu
start_consume
return
elsif @phase == SORT && @menu[@menu_index].step == 0
# Move to Sort menu
start_sort
return
elsif @phase == IMPORTANT && @menu[@menu_index].step == 0
# Move to Important Item menu
start_important
return
elsif @phase == STATUS && @menu[@menu_index].step == 0
# Move to Status Menu
start_party_target
return
elsif @phase == EQUIP && @menu[@menu_index].step == 0
# Move to Equip Menu
start_party_target
return
elsif @phase == SKILLS && @menu[@menu_index].step == 0
# Move to Skills Menu
start_party_target
return
elsif @phase == SWITCH && @menu[@menu_index].step == 0
# Move to Switch Menu
start_party_target
return
elsif @phase == SAVE && @menu[@menu_index].step == 0
# Move to Save menu
start_save
return
elsif @phase == LOAD && @menu[@menu_index].step == 0
# Move to Load menu
start_load
return
elsif @phase == QUIT && @menu[@menu_index].step == 0
# Move to Quit menu
start_quit
return
elsif @phase == THEME && @menu[@menu_index].step == 0
# Move to Theme menu
start_theme
return
elsif @phase == SOUND && @menu[@menu_index].step == 0
# Move to Sound menu
start_sound
return
elsif @phase == MUSIC && @menu[@menu_index].step == 0
# Move to Sound menu
start_music
return
else
# Update menu options
@menu.each {|option| option.update }
update_main_menu
return
end # if @phase elsif..
end # update
#---------------------------------------------------------------------------
# * Update Main Menu
#---------------------------------------------------------------------------
def update_main_menu
# If menu is not moving
unless @menu[@menu_index].moving?
# If Left button is pressed
if Input.repeat?(Input::LEFT) && @menu_index > 0
# Play Cursor SE
$game_system.se_play($data_system.cursor_se)
# Switch index
@menu[@menu_index].deselect
@menu_index -= 1
@menu[@menu_index].select
# Move menu options
@menu.each {|option|
option.step = 128
option.move_right = true
}
return
end # if Input
# if Right Button is pressed
if Input.repeat?(Input::RIGHT) && @menu_index < (@menu.size - 1)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Switch index
@menu[@menu_index].deselect
@menu_index += 1
@menu[@menu_index].select
# Move menu options
@menu.each {|option|
option.step = 128
option.move_left = true
}
return
end # if Input
# If B button is pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Return to game map
$scene = Scene_Map.new
return
end # if Input
# If C button is pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
case @menu[@menu_index].options[@menu[@menu_index].sub_index].name
when 'Consume'
# Switch phase
@phase = CONSUME
# Hide other menus & shift left
shift_menu_left
return
when 'Sort'
# Switch phase
@phase = SORT
# Hide other menus & shift left
shift_menu_left
return
when 'Important'
# Switch phase
@phase = IMPORTANT
# Hide other menus & shift menu left
shift_menu_left
return
when 'Status'
# Switch phase
@phase = STATUS
# Hide other menus & Shift menu left
shift_menu_left
return
when 'Equip'
# Switch phase
@phase = EQUIP
# Hide other menus & Shift menu left
shift_menu_left
return
when 'Skills'
# Switch phase
@phase = SKILLS
# Hide other menus & Shift menu left
shift_menu_left
return
when 'Switch'
# Switch phase
@phase = SWITCH
# Hide other menus & shift left
shift_menu_left
return
when 'Sound'
# Switch phase
@phase = SOUND
# Hide other menus & shift left
shift_menu_left
return
when 'Music'
# Switch phase
@phase = MUSIC
# Hide other menus & shift left
shift_menu_left
return
when 'Theme'
# Switch phase
@phase = THEME
# Hide other menus & shift left
shift_menu_left
return
when 'Save'
# If saving is disabled
if $game_system.save_disabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Switch phase
@phase = SAVE
# Hide othe menus & Shift menu left
shift_menu_left
return
when 'Load'
# Switch phase
@phase = LOAD
# Hide othe menus & Shift menu left
shift_menu_left
return
when 'Quit'
# Switch phase
@phase = QUIT
# Hide other menus & shift left
shift_menu_left
return
end # case
end # if Input
end # unless @menu.moving?
end # update_main_menu
#--------------------------------------------------------------------------
# * Start Consume
#--------------------------------------------------------------------------
def start_consume
# Create item sprite
@item = Sprite_Items.new
# Associate info
@item.info = @info
# Consume loop
loop do
# Update Graphics
Graphics.update
# Update input
Input.update
# Update menu
update_consume
# if phase has changed
if @phase != CONSUME
break
end
end
# Return Menu
shift_menu_right
# Dispose items
@item.dispose
end
#--------------------------------------------------------------------------
# * Update Consume
#--------------------------------------------------------------------------
def update_consume
# Update play time
@play_time.update
# Update item
@item.update
# If B button is pressed
if Input.trigger?(Input::B)
# Play Cancel SE
$game_system.se_play($data_system.cancel_se)
# Return to main phase
@phase = MAIN
return
end
# If C button is Pressed
if Input.trigger?(Input::C)
item = @item.item
return if item == nil
# If item triggers event with no target
if item.scope == 0 && item.common_event_id > 0
# Command event call reservation
$game_temp.common_event_id = item.common_event_id
# Play item use SE
$game_system.se_play(item.menu_se)
# If consumable
if item.consumable
# Decrease used items by 1
$game_party.lose_item(item.id, 1)
# Redraw item menu
@item.redraw
end
# Switch to map screen
$scene = Scene_Map.new
@phase = MAIN
return
end
# if Item cannot be used
if item.scope < 3 || item.occasion == 1 || item.occasion == 3 ||
!$game_party.item_can_use?(item.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play Decision SE
$game_system.se_play($data_system.decision_se)
# Switch to target menu
item_target
return
end
end
#--------------------------------------------------------------------------
# * Item Target
#--------------------------------------------------------------------------
def item_target
# Create target menu
@target = Sprite_Target.new
item = @item.item
# if item targets entire party
if item.scope == 4 || item.scope == 6
@target.index = -1
end
# Target loop
loop do
# Update Graphics
Graphics.update
# Update Input
Input.update
# Update play time
@play_time.update
# Update target
@target.update
# If B button is pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# return
break
end
# If C Button is pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# If target is all
if @target.index == -1
# Apply item effects to entire party
used = false
$game_party.actors.each {|actor| used |= actor.item_effect(item)}
end
# If single target
if @target.index >= 0
# Apply item use effects to target actor
target = $game_party.actors[@target.index]
used = target.item_effect(item)
end
# If an item was used
if used
# Play item use SE
$game_system.se_play(item.menu_se)
# If consumable
if item.consumable
# Decrease used items by 1
$game_party.lose_item(item.id, 1)
# Redraw item menu
@item.redraw
end
# Remake target window contents
@target.refresh
# If common event ID is valid
if item.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = item.common_event_id
# Switch to map screen
@phase = MAIN
$scene = Scene_Map.new
break
end
end
# If item wasn't used
unless used
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
# If player runs out of item
if $game_party.item_number(item.id) == 0
break
end
end
end
@target.dispose
end
#--------------------------------------------------------------------------
# * Start Sort
#--------------------------------------------------------------------------
def start_sort
# Create Sort menu
@sort = Sprite_Sort.new
# Associate info
@sort.info = @info
# Sort loop
loop do
# Update Graphics
Graphics.update
# Update input
Input.update
# Update sort menu
update_sort
# If phase has changed
if @phase != SORT
break
end
end
# Shift menu right
shift_menu_right
# Dispose sort menu
@sort.dispose
end
#--------------------------------------------------------------------------
# * Update Sort
#--------------------------------------------------------------------------
def update_sort
# Update play time
@play_time.update
# Update sort menu
@sort.update
# If B button is pressed
if Input.trigger?(Input::B)
# Play cancel se
$game_system.se_play($data_system.cancel_se)
# Return to main menu
@phase = MAIN
return
end
# If C button is pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to sort type menu
sort_type_menu
return
end
end
#--------------------------------------------------------------------------
# * Sort Type Menu
#--------------------------------------------------------------------------
def sort_type_menu
# Create Sort Type Menu
@sort_type = Sprite_Sort_Type.new
# Sort Type Menu loop
loop do
# Update Graphics
Graphics.update
# Update Input
Input.update
# Update Play Time
@play_time.update
# Update Sort Type
@sort_type.update
# if B button is pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Return
break
end
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set Sort
$settings.item_sort_type = @sort.index
$settings.item_sort_reverse = @sort_type.index == 1
# Return
break
end
end
@sort_type.dispose
end
#--------------------------------------------------------------------------
# * Start Important
#--------------------------------------------------------------------------
def start_important
# Create Important Item menu
@important = Sprite_Important.new
# Associate info
@important.info = @info
# Important item loop
loop do
# Update Graphics
Graphics.update
# Update input
Input.update
# Update important menu
update_important
# If phase has changed
if @phase != IMPORTANT
break
end
end
# Shift menu right
shift_menu_right
# dispose menu
@important.dispose
end
#--------------------------------------------------------------------------
# * Update Important
#--------------------------------------------------------------------------
def update_important
# Update play time
@play_time.update
# Update Important menu
@important.update
# If B button is pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Return to menu
@phase = MAIN
return
end
end
#--------------------------------------------------------------------------
# * Start Party Target
#--------------------------------------------------------------------------
def start_party_target
# Create party menu
@party = Sprite_Party.new
# Set info text
@info.set_text('Select a Party Member')
# Party Target Loop
loop do
# Update Graphics
Graphics.update
# Update Input
Input.update
# Update Party Select
update_party_target
# If phase has changed
if @phase != STATUS && @phase != EQUIP && @phase != SKILLS &&
@phase != SWITCH
break
end
end
# Shift menu right
shift_menu_right
# Dispose party menu
@party.dispose
end
#--------------------------------------------------------------------------
# * Update Party Target
#--------------------------------------------------------------------------
def update_party_target
# Update Play Time
@play_time.update
# Update Party Selection
@party.update
# If B button is pressed
if Input.trigger?(Input::B)
# Play Cancel SE
$game_system.se_play($data_system.cancel_se)
# Return to main menu
@phase = MAIN
return
end
# If C button is pressed
if Input.trigger?(Input::C)
# Switch to correct menu
case @phase
when STATUS
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Hide Party selection
@party.visible(false)
start_status
# Show Party selection
@party.visible(true)
return
when EQUIP
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Hide Party selection
@party.visible(false)
start_equip
# Show Party selection
@party.visible(true)
return
when SKILLS
# if character has no skills
unless $game_party.actors[@party.index].skills.size > 0
# Play buzzer se
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Hide Party selection
@party.visible(false, false)
start_skills
# Show Party selection
@party.visible(true)
return
when SWITCH
# Play decision SE
$game_system.se_play($data_system.decision_se)
start_switch
return
end
end
end
#--------------------------------------------------------------------------
# * Start Status
#--------------------------------------------------------------------------
def start_status
# Get actor index + actor + size
actor_index = @party.index
actor = $game_party.actors[actor_index]
max = $game_party.actors.size
# Create Status
@status = Sprite_Status.new(actor)
# Status Loop
loop do
# Update Graphics
Graphics.update
# Update Input
Input.update
# Update Play Time
@play_time.update
# If B button is pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Return to menu
break
end
# If L button is pressed
if Input.trigger?(Input::L)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Change Actor Index
actor_index = (actor_index + max - 1) % max
actor = $game_party.actors[actor_index]
@status.dispose
@status = nil
@status = Sprite_Status.new(actor)
end
# If R button is pressed
if Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Change Actor Index
actor_index = (actor_index + 1) % max
actor = $game_party.actors[actor_index]
@status.dispose
@status = nil
@status = Sprite_Status.new(actor)
end
end
@status.dispose
end
#--------------------------------------------------------------------------
# * Start Equip
#--------------------------------------------------------------------------
def start_equip
# Get actor index + actor + size
actor_index = @party.index
actor = $game_party.actors[actor_index]
max = $game_party.actors.size
# Create Equip Screen
@equip = Sprite_Equipment.new(actor)
# Associate Info
@equip.info = @info
# Equip loop
loop do
# Update Graphics
Graphics.update
# Update Input
Input.update
# Update Play Time
@play_time.update
# Update Equip Screen
@equip.update
# If equip phase is 0
if @equip.phase == 0
# If B button is pressed
if Input.trigger?(Input::B)
# Play Cancel SE
$game_system.se_play($data_system.cancel_se)
# Return to menu
break
end
# If L button is pressed
if Input.trigger?(Input::L)
# Play Cursor SE
$game_system.se_play($data_system.cancel_se)
# Change Actor Index
actor_index = (actor_index + max - 1) % max
actor = $game_party.actors[actor_index]
@equip.dispose
@equip = nil
@equip = Sprite_Equipment.new(actor)
# Reassociate info
@equip.info = @info
end
# If R button is pressed
if Input.trigger?(Input::R)
# Play Cursor SE
$game_system.se_play($data_system.cancel_se)
# Change Actor Index
actor_index = (actor_index + 1) % max
actor = $game_party.actors[actor_index]
@equip.dispose
@equip = nil
@equip = Sprite_Equipment.new(actor)
# Reassociate info
@equip.info = @info
end
end
end
@equip.dispose
@info.set_text('Select a Party Member')
end
#--------------------------------------------------------------------------
# * Start Skills
#--------------------------------------------------------------------------
def start_skills
# Get actor
@cur_actor = $game_party.actors[@party.index]
# Create Skills menu
@skills = Sprite_Skills.new(@cur_actor)
# Associate info
@skills.info = @info
@finish_menu = false
# Skills loop
loop do
# Update Graphics
Graphics.update
# Update Input
Input.update
# Update Menu
update_skills
# if finished menu
if @finish_menu
break
end
end
@skills.dispose
@info.set_text('Select a Party Member')
end
#--------------------------------------------------------------------------
# * Update Skills
#--------------------------------------------------------------------------
def update_skills
# if B button is pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Return
@finish_menu = true
return
end
# If C button is pressed
if Input.trigger?(Input::C)
@cur_skill = @skills.skill
# If skill cannot be used
if !@cur_actor.skill_can_use?(@cur_skill.id) ||
@cur_actor.sp < @cur_skill.sp_cost || @cur_skill.occasion == 1 ||
@cur_skill.occasion == 3
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# If effect has no target and triggers common event
if @cur_skill.scope == 0 && @cur_skill.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = @cur_skill.common_event_id
# Play use skill SE
$game_system.se_play(@cur_skill.menu_se)
# Use up SP
@cur_actor.sp -= @cur_skill.sp_cost
@party.refresh
# Switch to map screen
@phase = MAIN
@finish_menu = true
$scene = Scene_Map.new
return
end
# If scope is ally
if @cur_skill.scope >= 3
# If skill's scope is user
if @cur_skill.scope == 7
# Use Skill
used = @cur_actor.skill_effect(@cur_actor, @cur_skill)
if used
# Play skill use SE
$game_system.se_play(@cur_skill.menu_se)
# Use up SP
@cur_actor.sp -= @cur_skill.sp_cost
# Remake each window content
@party.refresh
# If command event ID is valid
if @cur_skill.common_event_id > 0
# Command event call reservation
$game_temp.common_event_id = @cur_skill.common_event_id
# Switch to map screen
@phase = MAIN
@finish_menu = true
$scene = Scene_Map.new
return
end
else
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
end
skill_target
return
end
end
end
#--------------------------------------------------------------------------
# * Skill Target
#--------------------------------------------------------------------------
def skill_target
# Create target menu
@target = Sprite_Target.new
# if item targets entire party
if @cur_skill.scope == 4 || @cur_skill.scope == 6
@target.index = -1
end
# Target loop
loop do
# Update Graphics
Graphics.update
# Update Input
Input.update
# Update play time
@play_time.update
# Update target
@target.update
# If B button is pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# return
break
end
# If C Button is pressed
if Input.trigger?(Input::C)
# If unable to use because SP ran out
unless @cur_actor.skill_can_use?(@cur_skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
break
end
# If target is all
if @target.index == -1
# Apply skill use effects to entire party
used = false
$game_party.actors.each {|actor|
used |= actor.skill_effect(@cur_actor, @cur_skill)
}
end
# If single target
if @target.index >= 0
# Apply skill use effects to target actor
target = $game_party.actors[@target.index]
used = target.skill_effect(@cur_actor, @cur_skill)
end
# If skill was used
if used
# Play skill use SE
$game_system.se_play(@cur_skill.menu_se)
# Use up SP
@cur_actor.sp -= @cur_skill.sp_cost
# Remake each window content
@party.refresh
@target.refresh
# If command event ID is valid
if @cur_skill.common_event_id > 0
# Command event call reservation
$game_temp.common_event_id = @cur_skill.common_event_id
# Switch to map screen
@phase = MAIN
@finish_menu = true
$scene = Scene_Map.new
break
end
else
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
end
end
@target.dispose
end
#--------------------------------------------------------------------------
# * Start Switch
#--------------------------------------------------------------------------
def start_switch
# Get actor index
actor_index = @party.index
@party.selected = actor_index
# Switch Loop
loop do
# Update Graphics
Graphics.update
# Update input
Input.update
# Update play Time
@play_time.update
# Update party selection
@party.update
# If B button is pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Return
@party.selected = nil
break
end
# If C button is pressed and selected 2 different party members
if Input.trigger?(Input::C) && (actor_index != @party.index)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch out party members
$game_party.actors[actor_index], $game_party.actors[@party.index] =
$game_party.actors[@party.index], $game_party.actors[actor_index]
# Refresh menu
@party.refresh
# Refresh game player
$game_player.refresh
# Return
@party.selected = nil
break
end
end
end
#--------------------------------------------------------------------------
# * Start Save
#--------------------------------------------------------------------------
def start_save
# Create Save Menu
@save = Sprite_File.new
# Set info
@info.set_text('Select a file to overwrite')
# Save Loop
loop do
# Update Graphics
Graphics.update
# Update input
Input.update
# Update save menu
update_save
# If Phase has changed
if @phase != SAVE
break
end
end
# Shift Menu Right
shift_menu_right
# Dispose Save menu
@save.dispose
end
#--------------------------------------------------------------------------
# * Update Save
#--------------------------------------------------------------------------
def update_save
# Update Play Time
@play_time.update
# Update Save Menu
@save.update
# if B Button is pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Return
@phase = MAIN
return
end
# If C Button is pressed
if Input.trigger?(Input::C)
# Play Decision SE
$game_system.se_play($data_system.decision_se)
# Create confirmation screen
confirm = Sprite_Confirmation.new('Would you like to overwrite this file?')
# Confirmation loop
loop do
# Update Graphics
Graphics.update
# Update Input
Input.update
# Update Play Time
@play_time.update
# Update Confirmation
confirm.update
# If B Button is pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Return
break
end
# If C Button is pressed
if Input.trigger?(Input::C)
case confirm.index
when 0 # Yes
# Save file
save_file(@save.index)
# Refresh save file
@save.refresh
# Return
break
when 1 # No
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Cancel + Return
break
end
end
end
confirm.dispose
return
end
end
#--------------------------------------------------------------------------
# * Save File
#--------------------------------------------------------------------------
def save_file(file_index)
# Play save SE
$game_system.se_play($data_system.save_se)
# Make Filename
filename = "Save#{file_index + 1}.rxdata"
# Write save data
file = File.open(filename, 'wb')
# Make character data for drawing save file
characters = []
(0...$game_party.actors.size).each {|i|
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
}
# Write character data for drawing save file
Marshal.dump(characters, file)
# Wrire frame count for measuring play time
Marshal.dump(Graphics.frame_count, file)
# Increase save count by 1
$game_system.save_count += 1
# Save magic number
# (A random value will be written each time saving with editor)
$game_system.magic_number = $data_system.magic_number
# Write each type of game object
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, 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)
Marshal.dump($settings, file)
file.close
end
#--------------------------------------------------------------------------
# * Start Load
#--------------------------------------------------------------------------
def start_load
# Create Load Menu
@load = Sprite_File.new
# Set info text
@info.set_text('Select a file to load')
# Load Loop
loop do
# Update graphics
Graphics.update
# Update input
Input.update
# Update Menu
update_load
# If Phase has Changed
if @phase != LOAD
break
end
end
# Shift Menu Right
shift_menu_right
# Dispose menu
@load.dispose
end
#--------------------------------------------------------------------------
# * Update Load
#--------------------------------------------------------------------------
def update_load
# Update Play Time
@play_time.update
# Update Save Menu
@load.update
# if B Button is pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Return
@phase = MAIN
return
end
# If C Button is pressed
if Input.trigger?(Input::C)
# Make Filename
file_index = @load.index + 1
filename = "Save#{file_index}.rxdata"
# If file doesn't exist
unless FileTest.exist?(filename)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play Decision SE
$game_system.se_play($data_system.decision_se)
# Create confirmation screen
confirm = Sprite_Confirmation.new('Would you like to load this file?')
# Confirmation loop
loop do
# Update Graphics
Graphics.update
# Update Input
Input.update
# Update Play Time
@play_time.update
# Update Confirmation
confirm.update
# If B Button is pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Return
break
end
# If C Button is pressed
if Input.trigger?(Input::C)
case confirm.index
when 0 # Yes
# load file
load_file(@load.index)
# Return
break
when 1 # No
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Cancel + Return
break
end
end
end
confirm.dispose
return
end
end
#--------------------------------------------------------------------------
# * Load File
#--------------------------------------------------------------------------
def load_file(file_index)
# Make Filename
filename = "Save#{file_index + 1}.rxdata"
# If file doesn't exist
unless FileTest.exist?(filename)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play load SE
$game_system.se_play($data_system.load_se)
# Read save data
file = File.open(filename, 'rb')
# Read character data for drawing save file
characters = Marshal.load(file)
# Read frame count for measuring play time
Graphics.frame_count = Marshal.load(file)
# Read each type of game object
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
$settings = Marshal.load(file)
# If magic number is different from when saving
# (if editing was added with editor)
if $game_system.magic_number != $data_system.magic_number
# Load map
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
# Refresh party members
$game_party.refresh
file.close
# Restore BGM and BGS
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
# Update map (run parallel process event)
$game_map.update
# Switch to map screen
$scene = Scene_Map.new
@phase = MAIN
end
#--------------------------------------------------------------------------
# * Start Sound
#--------------------------------------------------------------------------
def start_sound
# Create sound object
@sound = Sprite_Sound.new
# Set Info window
@info.set_text('Adjust the in game sound volume')
# Sound loop
loop do
# Update graphics
Graphics.update
# Update input
Input.update
# Update sound
update_sound
# if Phase has changed
if @phase != SOUND
break
end # if @phase
end # loop
# Return menu
shift_menu_right
# Dispose sound
@sound.dispose
end # start_sound
#--------------------------------------------------------------------------
# * Update Sound
#--------------------------------------------------------------------------
def update_sound
# Update play time
@play_time.update
# Update sound
@sound.update
# if B or C button is pressed
if Input.trigger?(Input::B) || Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Return to menu
@phase = MAIN
return
end
end # update_sound
#--------------------------------------------------------------------------
# * Start Music
#--------------------------------------------------------------------------
def start_music
# Create sound object
@music = Sprite_Music.new
# Set Info window
@info.set_text('Adjust the in game music volume')
# Sound loop
loop do
# Update graphics
Graphics.update
# Update input
Input.update
# Update sound
update_music
# if Phase has changed
if @phase != MUSIC
break
end # if @phase
end # loop
# Return menu
shift_menu_right
# Dispose sound
@music.dispose
end # start_music
#--------------------------------------------------------------------------
# * Update Music
#--------------------------------------------------------------------------
def update_music
# Update play time
@play_time.update
# Update sound
@music.update
# if B or C button is pressed
if Input.trigger?(Input::B) || Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Return to menu
@phase = MAIN
return
end
end # update_music
#--------------------------------------------------------------------------
# * Start Theme
#--------------------------------------------------------------------------
def start_theme
# Create theme menu
@theme = Sprite_Theme.new
# Associate info
@info.set_text('Change menu background')
# Theme loop
loop do
# Update graphics
Graphics.update
# Update input
Input.update
# Update Theme menu
update_theme
# if phase has changed
if @phase != THEME
break
end # if @phase
end # loop
# Return menu
shift_menu_right
# Dispose theme menu
@theme.dispose
end # start_theme
#--------------------------------------------------------------------------
# * Update Theme
#--------------------------------------------------------------------------
def update_theme
# Update play time window
@play_time.update
# Update theme window
@theme.update
# if B button is pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Return to main menu
@phase = MAIN
return
end # if Input
# if C button is pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch backgrounds
$settings.bg = @theme.theme
@background.bitmap = RPG::Cache.picture('back/' + $settings.bg)
# Return to main menu
@phase = MAIN
return
end # if Input
end # update_them
#--------------------------------------------------------------------------
# * Start Quit
#--------------------------------------------------------------------------
def start_quit
# Create Quit menu
@quit = Sprite_Quit.new
# Associate info
@quit.info = @info
# Quit loop
loop do
# Update graphics
Graphics.update
# update input
Input.update
# Update Quit menu
update_quit
# If phase has changed
if @phase != QUIT
break
end # if @phase
end # loop
# Return menu
shift_menu_right
# Dispose quit menu
@quit.dispose
end # start_quit
#---------------------------------------------------------------------------
# * Update Quit
#---------------------------------------------------------------------------
def update_quit
# Update play time
@play_time.update
# Update quit menu
@quit.update
# If B button is pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# return to menu
@phase = MAIN
return
end # if Input
# if C button is pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
case @quit.index
when 0 # Shutdown
@phase = MAIN
$game_system.bgm_fade(800)
$game_system.bgs_fade(800)
$scene = nil
when 1 # Reset
@phase = MAIN
$scene = Scene_Title.new
when 2 # Cancel
@phase = MAIN
end # case
return
end # if Input
end # update_quit
#---------------------------------------------------------------------------
# * Hide and Shift Menus left
#---------------------------------------------------------------------------
def shift_menu_left
# Hide other menus
@menu.each_index {|i| @menu[i].opacity = @menu_index == i ? 255 : 0 }
@menu[@menu_index].options[@menu[@menu_index].sub_index].refresh
# Shift Menu left
@menu[@menu_index].step = 128
@menu[@menu_index].move_left = true
end
#---------------------------------------------------------------------------
# * Shift Menus Right
#---------------------------------------------------------------------------
def shift_menu_right
# Redisplay menu
@menu.each_index {|i|
@menu[i].opacity = 255
@menu[i].refresh
}
# Shift Menu Right
@menu[@menu_index].step = 128
@menu[@menu_index].move_right = true
end
end # Scene_Menu
#=============================================================================
# ** Sprite_Title_Selection
#-----------------------------------------------------------------------------
# Handles Title Screen Selection
#=============================================================================
class Sprite_Title_Selection
#---------------------------------------------------------------------------
# * Public Instance Variable
#---------------------------------------------------------------------------
attr_accessor :index
attr_reader :select
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize
words = ['Start New Game', 'Load Saved Game', 'Shutdown']
@data = []
@index = 0
3.times {|i|
@data.push(RPG::Sprite.new)
@data[i].x = 32
@data[i].y = i * 48 + 320
@data[i].z += 10
@data[i].bitmap = Bitmap.new(200, 48)
@data[i].bitmap.draw_text(0, 0, 200, 48, words[i])
}
@cursor = Sprite.new
@cursor.y = 320
@cursor.bitmap = Bitmap.new(640, 48)
@select = true
@width = 0
end
#---------------------------------------------------------------------------
# * Update
#---------------------------------------------------------------------------
def update
@cursor.y = @index * 48 + 320
# Update Flash
@data.each_index {|i|
@data[i].opacity = 255 if @data[i].opacity < 255 && i != @index
}
if @data[@index].opacity <= 100
@step = 10
elsif @data[@index].opacity >= 255
@step = -10
end
@data[@index].opacity += @step
# If item is being selected
if @select
update_selection
else
# If Down Button is pressed
if Input.repeat?(Input::DOWN)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Change index
@index = (@index + 1) % 3
# Start selection
@select = true
@width = 0
return
end
# If Up Button is pressed
if Input.repeat?(Input::UP)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Change index
@index = (@index + 2) % 3
# Start Selection
@select = true
@width = 0
return
end
end
end
#---------------------------------------------------------------------------
# * Update Selection
#---------------------------------------------------------------------------
def update_selection
if @width > 640
@select = false
return
end
@cursor.bitmap.clear
@cursor.bitmap.draw_gradient(0, 0, @width, 48, Color.new(0, 0, 0, 200), Color.new(0, 0, 0, 0))
@width += 40
end
#---------------------------------------------------------------------------
# * Dispose
#---------------------------------------------------------------------------
def dispose
@cursor.dispose
@data.each {|sprite| sprite.dispose}
end
end # Sprite_Title_Selection
#=============================================================================
# ** Sprite_File_Menu_Option
#-----------------------------------------------------------------------------
# Displays File in Save/Load Screen
#=============================================================================
class Sprite_File_Menu_Option < RPG::Sprite
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(file_index, viewport)
super(viewport)
self.bitmap = Bitmap.new(640, 72)
y = 80 * file_index
self.y = y
self.z = 9998
@bg = Sprite.new(viewport)
@bg.bitmap = Bitmap.new(640, 72)
@bg.y = y
@bg.z = 9997
@bg.bitmap.draw_gradient(0, 0, 640, 72, Color.new(0, 0, 0, 100), Color.new(0, 0, 0, 0))
@file_index = file_index
@filename = "Save#{@file_index + 1}.rxdata"
@time_stamp = Time.at(0)
@file_exist = FileTest.exist?(@filename)
if @file_exist
file = File.open(@filename, 'r')
@time_stamp = file.mtime
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@game_system = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
file.close
end
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.bitmap.clear
# Draw file number
name = "Slot #{@file_index + 1}"
self.bitmap.draw_text(32, 0, 600, 32, name)
# If save file exists
if @file_exist
# Draw character
(0...@characters.size).each {|i|
bmp = RPG::Cache.character(@characters[i][0], @characters[i][1])
cw = bmp.rect.width / 4
ch = bmp.rect.height / 4
src_rect = Rect.new(0, 0, cw, ch)
x = 300 - @characters.size * 32 + i * 64 - cw / 2
self.bitmap.blt(x, 60 - ch, bmp, src_rect)
}
# Draw play time
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
time_string = sprintf('%02d:%02d:%02d', hour, min, sec)
self.bitmap.draw_text(4, 0, 600, 32, time_string, 2)
# Draw timestamp
time_string = @time_stamp.strftime('%Y/%m/%d %H:%M')
self.bitmap.draw_text(4, 32, 600, 32, time_string, 2)
end
end
#---------------------------------------------------------------------------
# * Dispose
#---------------------------------------------------------------------------
def dispose
@bg.dispose
super
end
end # Sprite_File_Menu_Option
#=============================================================================
# ** Sprite_File_Selection
#-----------------------------------------------------------------------------
# Handles Save/Load Screen Selection
#=============================================================================
class Sprite_File_Selection
#---------------------------------------------------------------------------
# * Public Instance Variables
#---------------------------------------------------------------------------
attr_accessor :index
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize
@index = 0
@data = []
@viewport = Viewport.new(0, 40, 640, 400)
10.times {|i| @data.push(Sprite_File_Menu_Option.new(i, @viewport))}
end
#---------------------------------------------------------------------------
# * Update
#---------------------------------------------------------------------------
def update
# Update flash
@data.each_index {|i|
@data[i].opacity = 255 if @data[i].opacity < 255 && i != @index
}
if @data[@index].opacity <= 100
@step = 10
elsif @data[@index].opacity >= 255
@step = -10
end
@data[@index].opacity += @step
# If Down Button is pressed
if Input.trigger?(Input::DOWN) && @index < 9
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# Change index
@index += 1
# if scroll needed
if @data[9].y >= 400
scroll_up
end
end
# If Up button is pressed
if Input.trigger?(Input::UP) && @index > 0
# Play cursor se
$game_system.se_play($data_system.cursor_se)
# Change index
@index -= 1
# if scroll needed
if @data[0].y < 0
scroll_down
end
end
end
#---------------------------------------------------------------------------
# * Scroll Up
#---------------------------------------------------------------------------
def scroll_up
# Move File Options up
@data.each {|sprite| sprite.y -= 80}
end
#---------------------------------------------------------------------------
# * Scroll Down
#---------------------------------------------------------------------------
def scroll_down
# Move File options down
@data.each {|sprite| sprite.y += 80}
end
#---------------------------------------------------------------------------
# * Dispose
#---------------------------------------------------------------------------
def dispose
@data.each {|sprite| sprite.dispose}
@viewport.dispose
end
end # Sprite_File_Selection
#=============================================================================
# ** Scene_Title
#-----------------------------------------------------------------------------
# Handles title screen
#=============================================================================
class Scene_Title
#---------------------------------------------------------------------------
# * Main Processing
#---------------------------------------------------------------------------
def main
# If battle test
if $BTEST
battle_test
return
end
# Load database
$data_actors = load_data('Data/Actors.rxdata')
$data_classes = load_data('Data/Classes.rxdata')
$data_skills = load_data('Data/Skills.rxdata')
$data_items = load_data('Data/Items.rxdata')
$data_weapons = load_data('Data/Weapons.rxdata')
$data_armors = load_data('Data/Armors.rxdata')
$data_enemies = load_data('Data/Enemies.rxdata')
$data_troops = load_data('Data/Troops.rxdata')
$data_states = load_data('Data/States.rxdata')
$data_animations = load_data('Data/Animations.rxdata')
$data_tilesets = load_data('Data/Tilesets.rxdata')
$data_common_events = load_data('Data/CommonEvents.rxdata')
$data_system = load_data('Data/System.rxdata')
# Make system object
$game_system = Game_System.new
# Make title graphic
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
# Make command window
@command = Sprite_Title_Selection.new
# Continue enabled determinant
# Check if at least one save file exists
# If enabled, make @continue_enabled true; if disabled, make it false
@continue_enabled = false
10.times {|i|
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
}
if @continue_enabled
@command.index = 1
end
# Play title BGM
$game_system.bgm_play($data_system.title_bgm)
# Stop playing ME and BGS
Audio.me_stop
Audio.bgs_stop
# Execute transition
Graphics.transition
# Main loop
loop do
# Update Graphics
Graphics.update
# Update Input
Input.update
# Update menu
update
# if Scene has changed
if $scene != self
break
end
end
# Prepare transition
Graphics.freeze
# Dispose windows
@sprite.dispose
@command.dispose
end
#---------------------------------------------------------------------------
# * Update Frame
#---------------------------------------------------------------------------
def update
# Update Commands
@command.update
# If C Button is pressed
if Input.trigger?(Input::C)
case @command.index
when 0 # New Game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# New game
command_new_game
when 1 # Continue
# if Continue not enabled
unless @continue_enabled
# Play Buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Load
command_continue
when 2 # Shutdown
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Shutdown
command_shutdown
end
end
end
#---------------------------------------------------------------------------
# * Command New Game
#---------------------------------------------------------------------------
def command_new_game
# Stop BGM
Audio.bgm_stop
# Reset frame count for measuring play time
Graphics.frame_count = 0
# Make each type of game object
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# Set up initial party
$game_party.setup_starting_members
# Set up initial map position
$game_map.setup($data_system.start_map_id)
# Move player to initial position
$game_player.moveto($data_system.start_x, $data_system.start_y)
# Refresh player
$game_player.refresh
# Run automatic change for BGM and BGS set with map
$game_map.autoplay
# Update map (run parallel process event)
$game_map.update
# Switch to map screen
$scene = Scene_Map.new
end
#---------------------------------------------------------------------------
# * Command Continue
#---------------------------------------------------------------------------
def command_continue
# Switch to Load screen
$scene = Scene_Load.new
end
#---------------------------------------------------------------------------
# * Command Shut Down
#---------------------------------------------------------------------------
def command_shutdown
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Shutdown
$scene = nil
end
#--------------------------------------------------------------------------
# * Battle Test
#--------------------------------------------------------------------------
def battle_test
# Load database (for battle test)
$data_actors = load_data('Data/BT_Actors.rxdata')
$data_classes = load_data('Data/BT_Classes.rxdata')
$data_skills = load_data('Data/BT_Skills.rxdata')
$data_items = load_data('Data/BT_Items.rxdata')
$data_weapons = load_data('Data/BT_Weapons.rxdata')
$data_armors = load_data('Data/BT_Armors.rxdata')
$data_enemies = load_data('Data/BT_Enemies.rxdata')
$data_troops = load_data('Data/BT_Troops.rxdata')
$data_states = load_data('Data/BT_States.rxdata')
$data_animations = load_data('Data/BT_Animations.rxdata')
$data_tilesets = load_data('Data/BT_Tilesets.rxdata')
$data_common_events = load_data('Data/BT_CommonEvents.rxdata')
$data_system = load_data('Data/BT_System.rxdata')
# Reset frame count for measuring play time
Graphics.frame_count = 0
# Make each game object
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# Set up party for battle test
$game_party.setup_battle_test_members
# Set troop ID, can escape flag, and battleback
$game_temp.battle_troop_id = $data_system.test_troop_id
$game_temp.battle_can_escape = true
$game_map.battleback_name = $data_system.battleback_name
# Play battle start SE
$game_system.se_play($data_system.battle_start_se)
# Play battle BGM
$game_system.bgm_play($game_system.battle_bgm)
# Switch to battle screen
$scene = Scene_Battle.new
end
end # Scene_Title
#=============================================================================
# ** Scene_File
#-----------------------------------------------------------------------------
# Handles Loading/Saving outside of menu
#=============================================================================
class Scene_File
#--------------------------------------------------------------------------
# * Object Initialization
# help_text : text string shown in the help window
#--------------------------------------------------------------------------
def initialize(help_text, confirmation_text)
@help_text = help_text
@confirmation_text = confirmation_text
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Draw Background
@background = Sprite.new
@background.bitmap = RPG::Cache.picture('back/' + $settings.bg)
# Make info window
@info = Sprite_Info.new
@info.set_text(@help_text)
# Make save file window
@file = Sprite_File_Selection.new
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@info.dispose
@file.dispose
@background.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update file selection
@file.update
# If C button was pressed
if Input.trigger?(Input::C)
# if Loading
if $scene.is_a?(Scene_Load)
# Make Filename
file_index = @file.index + 1
filename = "Save#{file_index}.rxdata"
# If file doesn't exist
unless FileTest.exist?(filename)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
end
# Create confirmation screen
confirm = Sprite_Confirmation.new(@confirmation_text)
# Confirmation loop
loop do
# Update Graphics
Graphics.update
# Update Input
Input.update
# Update Confirmation
confirm.update
# If B Button is pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Return
break
end
# If C Button is pressed
if Input.trigger?(Input::C)
case confirm.index
when 0 # Yes
# Call method: on_decision (defined by the subclasses)
on_decision(make_filename(@file.index))
# Return
break
when 1 # No
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Cancel + Return
break
end
end
end
confirm.dispose
return
end
# If B button was pressed
if Input.trigger?(Input::B)
# Call method: on_cancel (defined by the subclasses)
on_cancel
return
end
end
#--------------------------------------------------------------------------
# * Make File Name
# file_index : save file index (0-3)
#--------------------------------------------------------------------------
def make_filename(file_index)
return "Save#{file_index + 1}.rxdata"
end
end # Scene_File
#=============================================================================
# ** Scene_Save
#-----------------------------------------------------------------------------
# Handles Saving from outside menu (event calls)
#=============================================================================
class Scene_Save
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super('Select a file to overwrite', 'Would you like to overwrite this file?')
end
#--------------------------------------------------------------------------
# * Decision Processing
#--------------------------------------------------------------------------
def on_decision(filename)
# Play save SE
$game_system.se_play($data_system.save_se)
# Write save data
file = File.open(filename, 'wb')
write_save_data(file)
file.close
# If called from event
if $game_temp.save_calling
# Clear save call flag
$game_temp.save_calling = false
# Switch to map screen
$scene = Scene_Map.new
return
end
end
#--------------------------------------------------------------------------
# * Cancel Processing
#--------------------------------------------------------------------------
def on_cancel
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# If called from event
if $game_temp.save_calling
# Clear save call flag
$game_temp.save_calling = false
# Switch to map screen
$scene = Scene_Map.new
return
end
end
#--------------------------------------------------------------------------
# * Write Save Data
# file : write file object (opened)
#--------------------------------------------------------------------------
def write_save_data(file)
# Make character data for drawing save file
characters = []
(0...$game_party.actors.size).each {|i|
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
}
# Write character data for drawing save file
Marshal.dump(characters, file)
# Wrire frame count for measuring play time
Marshal.dump(Graphics.frame_count, file)
# Increase save count by 1
$game_system.save_count += 1
# Save magic number
# (A random value will be written each time saving with editor)
$game_system.magic_number = $data_system.magic_number
# Write each type of game object
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, 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)
Marshal.dump($settings, file)
end
end # Scene_Save
#=============================================================================
# ** Scene_Load
#-----------------------------------------------------------------------------
# Handles Loading from outside menu (title screen)
#=============================================================================
class Scene_Load
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Remake Temporary object
$game_temp = Game_Temp.new
super('Select a file to load', 'Would you like to load this file?')
end
#--------------------------------------------------------------------------
# * Decision Processing
#--------------------------------------------------------------------------
def on_decision(filename)
# If file doesn't exist
unless FileTest.exist?(filename)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play load SE
$game_system.se_play($data_system.load_se)
# Read save data
file = File.open(filename, 'rb')
read_save_data(file)
file.close
# Restore BGM and BGS
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
# Update map (run parallel process event)
$game_map.update
# Switch to map screen
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Cancel Processing
#--------------------------------------------------------------------------
def on_cancel
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to title screen
$scene = Scene_Title.new
end
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
def read_save_data(file)
# Read character data for drawing save file
characters = Marshal.load(file)
# Read frame count for measuring play time
Graphics.frame_count = Marshal.load(file)
# Read each type of game object
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
$settings = Marshal.load(file)
# If magic number is different from when saving
# (if editing was added with editor)
if $game_system.magic_number != $data_system.magic_number
# Load map
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
# Refresh party members
$game_party.refresh
end
end # Scene_Load
#=============================================================================
# ** Bitmap
#-----------------------------------------------------------------------------
# Alias and redefine draw_text to draw PSP XMB style shadows
#=============================================================================
class Bitmap
# Alias draw_text only once
unless self.method_defined?(:draw_shadow)
alias draw_shadow draw_text
end # unless
#===========================================================================
# * draw_text
#===========================================================================
def draw_text(arg1 = 0, arg2 = 0, arg3 = 0, arg4 = 0, arg5 = 0, arg6 = 0)
if arg1.is_a?(Rect)
x = arg1.x
y = arg1.y
width = arg1.width
height = arg1.height
string = arg2
align = arg3
else
x = arg1
y = arg2
width = arg3
height = arg4
string = arg5
align = arg6
end # if arg1.is_a?(Rect)
color = self.font.color.dup
# Set outline color to BLACK
self.font.color = Color.new(0, 0, 0, 100)
draw_shadow(x + 1, y + 1, width, height, string, align)
self.font.color = Color.new(0, 0, 0, 75)
draw_shadow(x + 2, y + 2, width, height, string, align)
self.font.color = Color.new(0, 0, 0, 50)
draw_shadow(x + 3, y + 3, width, height, string, align)
self.font.color = Color.new(0, 0, 0, 25)
draw_shadow(x + 4, y + 4, width, height, string, align)
self.font.color = Color.new(0, 0, 0, 10)
draw_shadow(x + 5, y + 5, width, height, string, align)
# Draw text with original Color
self.font.color = color
draw_shadow(x, y, width, height, string, align)
end # def draw_text
#--------------------------------------------------------------------------
# * Draw Gradient Bar
#--------------------------------------------------------------------------
def draw_gradient_bar(x, y, width, height, min, max, start_color, end_color)
# Colors
black = Color.new(0, 0, 0, 255)
# Draw Bar back
self.fill_rect(x, y, width, height, black)
self.fill_rect(x - 1, y + 1, 1, height - 2, black)
self.fill_rect(x + width, y + 1, 1, height - 2, black)
# Get fill amount
x += 3
y += 3
height -= 6
width -= 6
fill = (min.to_f / max) * width
width = (width.to_f / fill) * 100
dr = (end_color.red - start_color.red) / width.to_f
dg = (end_color.green - start_color.green) / width.to_f
db = (end_color.blue - start_color.blue) / width.to_f
da = (end_color.alpha - start_color.alpha) / width.to_f
(0...fill).each {|i|
start_color.red += dr unless start_color.red + dr < 0
start_color.green += dg unless start_color.green + dg < 0
start_color.blue += db unless start_color.blue + db < 0
start_color.alpha += da unless start_color.alpha + da < 0
self.fill_rect(x + i, y, 1, height, start_color)
}
end
#--------------------------------------------------------------------------
# * Draw Gradient
#--------------------------------------------------------------------------
def draw_gradient(x, y, width, height, start_color, end_color)
dr = (end_color.red - start_color.red) / width.to_f
dg = (end_color.green - start_color.green) / width.to_f
db = (end_color.blue - start_color.blue) / width.to_f
da = (end_color.alpha - start_color.alpha) / width.to_f
(0...width).each {|i|
start_color.red += dr unless start_color.red + dr < 0
start_color.green += dg unless start_color.green + dg < 0
start_color.blue += db unless start_color.blue + db < 0
start_color.alpha += da unless start_color.alpha + da < 0
self.fill_rect(x + i, y, 1, height, start_color)
}
end
#--------------------------------------------------------------------------
# * Draw Frame
#--------------------------------------------------------------------------
def draw_frame(x, y, width, height, color)
self.fill_rect(x, y, 1, height, color)
self.fill_rect(x, y, width, 1, color)
self.fill_rect(x + width - 1, y, 1, height, color)
self.fill_rect(x, y + height - 1, width, 1, color)
end
#--------------------------------------------------------------------------
# * Draw Actor Graphic
#--------------------------------------------------------------------------
def draw_actor_graphic(actor, x, y)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
src_rect = Rect.new(0, 0, cw, ch)
self.blt(x, y, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# * Draw Actor HP
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y)
# Draw HP bar
sc = Color.new(255, 0, 0, 255)
ec = Color.new(255, 175, 175, 255)
self.draw_gradient_bar(x + 16, y + 24, 108, 8, actor.hp, actor.maxhp, sc, ec)
# Draw "HP" text string
self.draw_text(x, y, 32, 32, $data_system.words.hp)
# Draw HP
hp_x = x + 32
self.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
# Draw MaxHP
self.draw_text(hp_x + 48, y, 12, 32, '/', 1)
self.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
end
#--------------------------------------------------------------------------
# * Draw Actor SP
#--------------------------------------------------------------------------
def draw_actor_sp(actor, x, y)
# Draw SP bar
sc = Color.new(0, 0, 255, 255)
ec = Color.new(175, 175, 255, 255)
self.draw_gradient_bar(x + 16, y + 24, 108, 8, actor.sp, actor.maxsp, sc, ec)
# Draw "SP" text string
self.draw_text(x, y, 32, 32, $data_system.words.sp)
# Draw SP
hp_x = x + 32
self.draw_text(hp_x, y, 48, 32, actor.sp.to_s, 2)
# Draw MaxSP
self.draw_text(hp_x + 48, y, 12, 32, '/', 1)
self.draw_text(hp_x + 60, y, 48, 32, actor.maxsp.to_s)
end
#--------------------------------------------------------------------------
# * Draw Actor EXP
#--------------------------------------------------------------------------
def draw_actor_exp(actor, x, y)
end
#--------------------------------------------------------------------------
# * Draw Actor Level
#--------------------------------------------------------------------------
def draw_actor_level(actor, x, y)
self.draw_text(x, y, 64, 32, 'Level')
self.draw_text(x + 64, y, 24, 32, actor.level.to_s, 2)
end
#--------------------------------------------------------------------------
# * Draw Actor Parameter
#--------------------------------------------------------------------------
def draw_actor_parameter(actor, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
when 2
parameter_name = $data_system.words.mdef
parameter_value = actor.mdef
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
end
self.draw_text(x, y, 120, 32, parameter_name)
self.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
end
#--------------------------------------------------------------------------
# * Make State Text String for Drawing
#--------------------------------------------------------------------------
def make_battler_state_text(battler, width, need_normal)
# Get width of brackets
brackets_width = self.text_size('[]').width
# Make text string for state names
text = ''
battler.states.each {|i|
if $data_states[i].rating >= 1
if text == ''
text = $data_states[i].name
else
new_text = text + '/' + $data_states[i].name
text_width = self.text_size(new_text).width
if text_width > width - brackets_width
break
end
text = new_text
end
end
}
# If text string for state names is empty, make it [normal]
if text == ''
if need_normal
text = '[Normal]'
end
else
# Attach brackets
text = '[' + text + ']'
end
# Return completed text string
return text
end
#--------------------------------------------------------------------------
# * Draw State
#--------------------------------------------------------------------------
def draw_actor_state(actor, x, y, width = 320)
text = make_battler_state_text(actor, width, true)
self.draw_text(x, y, width, 32, text)
end
#--------------------------------------------------------------------------
# * Draw Actor Exp
#--------------------------------------------------------------------------
def draw_actor_exp(actor, x, y)
self.draw_text(x, y, 80, 32, 'Exp')
self.draw_text(x, y + 32, 80, 32, 'Next')
self.draw_text(x + 80, y, 84, 32, actor.exp_s, 2)
self.draw_text(x + 80, y + 32, 84, 32, actor.next_rest_exp_s, 2)
end
#--------------------------------------------------------------------------
# * Draw Item Name
#--------------------------------------------------------------------------
def draw_item_name(item, x, y)
if item == nil
self.draw_text(x, y, 212, 32, '(Empty)')
return
end
bitmap = RPG::Cache.icon(item.icon_name)
self.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.draw_text(x + 28, y, 212, 32, item.name)
end
end # class Bitmap
#============================================================================
# ** Game_Map
#----------------------------------------------------------------------------
# Modified to load Map name
#============================================================================
class Game_Map
# Alias map setup
alias new_game_map_setup setup
# Make map_name public
attr_reader :map_name
#--------------------------------------------------------------------------
# * New Setup
#--------------------------------------------------------------------------
def setup(map_id)
# Set up map
new_game_map_setup(map_id)
# Load Map info
@map_name = (load_data('Data/MapInfos.rxdata'))[map_id].name
end
end
#============================================================================
# ** Game_System
#----------------------------------------------------------------------------
# Modified to make use of volume settings
#============================================================================
class Game_System
# Alias initialize to create Settings
alias new_settings_initialize initialize
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize
# Create settings object
$settings = Settings.new
new_settings_initialize
end
#--------------------------------------------------------------------------
# * Play Background Music
# bgm : background music to be played
#--------------------------------------------------------------------------
def bgm_play(bgm)
@playing_bgm = bgm
if bgm != nil && bgm.name != ''
Audio.bgm_play('Audio/BGM/' + bgm.name, $settings.music_volume, bgm.pitch)
else
Audio.bgm_stop
end
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# * Play Music Effect
# me : music effect to be played
#--------------------------------------------------------------------------
def me_play(me)
if me != nil && me.name != ''
Audio.me_play('Audio/ME/' + me.name, $settings.music_volume, me.pitch)
else
Audio.me_stop
end
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# * Play Background Sound
# bgs : background sound to be played
#--------------------------------------------------------------------------
def bgs_play(bgs)
@playing_bgs = bgs
if bgs != nil && bgs.name != ''
Audio.bgs_play('Audio/BGS/' + bgs.name, $settings.sound_volume, bgs.pitch)
else
Audio.bgs_stop
end
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# * Play Sound Effect
# se : sound effect to be played
#--------------------------------------------------------------------------
def se_play(se)
if se != nil && se.name != ''
Audio.se_play('Audio/SE/' + se.name, $settings.sound_volume, se.pitch)
end
end
end

ParaDogs ATB (With Kellessdees edit)

 

 

#==============================================================================
# Active Time Battle v.2.62
# Script by ParaDog
#  http://2d6.parasite.jp/
#------------------------------------------------------------------------------
# When the CT Gauge becomes filled,  the battler which it controls will then be
# able to perform his/her battle action.
# The system can also  adjust the positioning  of the BattleStatus window which
# works well with Sideview System scripts.
#------------------------------------------------------------------------------
# INSTALLING:
# When using this system,  it is recommended  that this script  be placed above
# all other 'Custom' scripts... directly below Scene_Debug if possible.
#------------------------------------------------------------------------------
# ESCAPE:
# While a battler's command window is active,  pressing the  [ESC]  button will
# activate the  'Fight / Escape' window   at the top  of the screen.   The more
# actors you have  with full CT,  the better  your chances  are of a successful
# escape, while fewer actors and more enemies results in a lower chance to flee.
#
# NEXT/PREVIOUS BATTLER:
# When two or more actors can act,  you can toggle between the actors with full
# CT gauges with the [R] button or the [PageDown] key, or in reverse order with
# the [L] button or the [PageUp] key.  These keys can be altered in the config-
# uration section below.
#==============================================================================
# Modified by Kellessdee to display cursor rect over selected character
# and fixed the switching between character's bug
module PARA_CTB
  
  # CT gauge pauses while command window is open
  COMMAND_WAIT = false
  # CT gauge pauses when Skill and Item windows are open, and while targeting
  SELECT_WAIT = true
  # CT gauge pauses when battlers perform actions
  ANIMATION_WAIT = false
  
  # CT Gauge fill / Battle system speed
  BATTLE_SPEED = 3
 
  # Maximum size in your Battle Party
  PARTY_SIZE = 4
  
  # CT Cost in percentages for each action
  ACT_ATTACK_CT  = 100   # Normal attack
  ACT_GUARD_CT   = 100   # Defense
  ACT_ESCAPE_CT  = 100   # Escape
  ACT_SKILL_CT   = 100   # Skill
  ACT_ITEM_CT    = 100   # Item
  
  # Message when failed to escape
  UNESCAPE_MES   = "Escape failed"
 
  # Sound effect played when the CT Gauge is full (if "", plays no sound)
  # Sound effect stored in the project's "Audio/SE" folder
  FULL_CT_SE = "015-Jump01"
  # Sound Volume
  FULL_CT_SE_VOL = 80
 
  # Tone effect of the battler when the CT Gauge is full
  # A value of (0,0,0) performs no tone change
  FULL_CT_COLOR = Tone.new(32,0,0)
  
  # Color of HP gauge (gradation left edge)
  HP_COLOR_LEFT = Color.new(128, 0, 0, 255)
  # Color of HP gauge (gradation right edge)
  HP_COLOR_RIGHT= Color.new(255, 0, 0, 255)
  # Color of SP gauge (gradation left edge)
  SP_COLOR_LEFT = Color.new(0, 0, 128, 255)
  # Color of SP gauge (gradation right edge)
  SP_COLOR_RIGHT= Color.new(0, 0, 255, 255)
  # Color of CT gauge (gradation left edge)
  COLOR_LEFT = Color.new(128, 128, 64, 255)
  # Color of CT gauge (gradation left edge)
  COLOR_RIGHT= Color.new(255, 255, 128, 255)
  # Color of CT gauge (filled gauge)
  COLOR_FULL = Color.new(255, 225, 128, 255)
  
  # Gauge Frame Color
  FRAME_COLOR = Color.new(192, 192, 192, 255)
  # Gauge Frame Width
  FRAME_BORDER = 1
  # Gauge Frame Background Color
  BACK_COLOR = Color.new(128, 128, 128, 128)
 
  # Font Size of Actor Names
  NAME_FONT_SIZE = 16
  # Font Size of Actor HP/SP
  HPSP_FONT_SIZE = 18
  # Font Size of Enemy Names
  ENEMY_FONT_SIZE = 16
  # Draw maximum values for HP/SP
  MAX_DRAW = false
 
  # Group Enemy Names
  # Ex: Instead of "Ghost Ghost" it will say "Ghost2"
  ENEMY_GROUPING = false
 
  # Draw Bars for Enemies (0: None / 1: HP / 2: CT)
  # If ENEMY_GROUPING is used, then this setting is ignored
  ENEMY_DRAWING_MATER = 2
  
  # Draw Actor HP/SP bars in the help window
  HELP_DRAWING_MATER_ACTOR = false
  # Draw Enemy HP/SP bars in the help window
  HELP_DRAWING_MATER_ENEMY = false
  
  # Command Window Position System (true/false)
  # (Useful with side-view scripts if the position of the Actor Command Window
  # appears unnatural). The default setting is false, while true allows you to
  # adjust the x/y position of the window.
  WINDOWPOS_CHANGE = false
  WINDOWPOS_X = 100   # X coordinates of the Actor Command Window
  WINDOWPOS_Y = 320   # Y coordinates of the Actor Command Window
 
  # Sets the intervals of the CT bar updates
  # The lower a setting, the smoother the CT Bar fill will appear (0 Minimum).
  # The higher a setting, the faster the CT Bar refreshes (Useful if lagging).
  CT_SKIP = 2
  
  # Set the Action Order Keys (Declared Method,Input::(Button))
  # (See matching keys listed in RPGMaker XP)
  CHANGE_NEXT = Input::R  # Skip to next actor
  CHANGE_LAST = Input::L  # Skip back to previous actor
 
  # Opacity of the Actor Command Window
  WINDOW_OPACITY = 160
 
  # Opacity of the Battlestatus Window
  WINDOW_MAIN_OPACITY = 255
 
  # Revised Escape Ratio
  # The higher the number, the easier to escape (1 being minimum).  The base
  # value is calculated by dividing the total of active party members by the
  # number of active enemies.   This value, multiplied by 10, determines the
  # ercentage chance to escape.  If the calculated value is -1, it succeeds.
  ESCAPEABLE = 10
 
end
 
# End of the config section
#------------------------------------------------------------------------------
 
 
#==============================================================================
# ** Scene_Battle 
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================
 
class Scene_Battle
  #--------------------------------------------------------------------------
  # * CT Update
  #--------------------------------------------------------------------------
  def update_ct
    # When count rise is permitted
    if @countup
      for actor in $game_party.actors
        # If you can act?
        if actor.movable? == false and actor.ct_visible and @phase4_step != 5
          # In invisibility state count rise
          actor.ct_visible = false
          actor.countup = true
          actor.full_ct = false
        elsif actor.movable? and actor.ct_visible == false
          # Cancelling invisibility count rise
          clear_ct(actor)
          actor.ct_visible = true
        end
        # It corresponds to the replacement of the actor
        if actor.max_ct == 0
          actor.max_ct = @max_ct
        end
        # Count rise of actor
        if actor.countup
          # If the CT Gauge is filled and the actor is not in action
          if actor.now_ct >= @max_ct and !(@pre_action_battlers.include?(actor))
            # Adds the actor to the command input list
            @pre_action_battlers.push(actor)
            @action_count += 1
            # Play the CG Gauge SE
            if PARA_CTB::FULL_CT_SE != "" and actor.ct_visible
              Audio.se_play("Audio/SE/" + PARA_CTB::FULL_CT_SE,PARA_CTB::FULL_CT_SE_VOL)
            end
            # Stop filling the CT Gauge
            actor.countup = false
            actor.full_ct = true
          else
            # Count rise
            actor.make_action_speed
            ct_skip = PARA_CTB::CT_SKIP + 1
            actor.now_ct += actor.current_action.speed * PARA_CTB::BATTLE_SPEED * ct_skip
          end
        end
      end
      for enemy in $game_troop.enemies
        # If you can act
        if enemy.movable? == false and enemy.ct_visible and @phase4_step == 5
          # In invisibility state count rise
          enemy.ct_visible = false
          enemy.countup = true
          enemy.full_ct = false
        elsif enemy.movable? and enemy.ct_visible == false
          # Clear the invisible CT
          clear_ct(enemy)
          enemy.ct_visible = true
        end
        # Count rise of enemy
        if enemy.countup
          # if the enemy CT Gauge is full and the enemy is not in action
          if enemy.now_ct >= @max_ct and ! @pre_action_battlers.include?(enemy)
            # Adds the enemy to the command input list
            @pre_action_battlers.push(enemy)
            @action_count += 1
            # Stop filling the CT Gauge
            enemy.countup = false
            enemy.full_ct = true
          else
            # Count rise
            enemy.make_action_speed
            enemy.now_ct += enemy.current_action.speed * PARA_CTB::BATTLE_SPEED
          end
        end
      end
      # Redrawing CT gauge
      @status_window.refresh_ct
      @status_window2.refresh_ct
    end
  end
  #--------------------------------------------------------------------------
  # * Clear the battler CT
  #--------------------------------------------------------------------------
  def clear_ct(battler)
    battler.countup = true
    battler.now_ct = 0
    battler.full_ct = false
  end
  #--------------------------------------------------------------------------
  # * Percentage of battler CT
  #--------------------------------------------------------------------------
  def declease_ct(battler,percent)
    battler.countup = true
    battler.now_ct = battler.now_ct * percent / 100
    battler.full_ct = false
  end
  #--------------------------------------------------------------------------
  # * CT Initialization
  #--------------------------------------------------------------------------
  def initialize_ct
    # Deciding the reference level of CT
    max_ct
    for battler in $game_party.actors + $game_troop.enemies
      if battler.movable?
        # Set the CT starting level
        battler.now_ct = battler.agi * 300
        battler.ct_visible = true
      else
        clear_ct(battler)
        battler.ct_visible = false
      end
      battler.countup = true
      battler.full_ct = false
      battler.max_ct = @max_ct
    end
  end
  #--------------------------------------------------------------------------
  # * Set the reference level of empty CT based on the Battler's speed
  #--------------------------------------------------------------------------
  def max_ct
    for battler in $game_party.actors + $game_troop.enemies
      @max_ct += battler.agi
    end
    @max_ct = @max_ct * 500 / ($game_party.actors.size + $game_troop.enemies.size )
  end
  #--------------------------------------------------------------------------
  # * Modify the Battler's order of performance
  #--------------------------------------------------------------------------
  def shift_activer(shift)
    # When one shifting, the actor of rear 2 or more
    if @pre_action_battlers != nil
      if shift == 1
        # Acquiring the present actor
        act = @pre_action_battlers[@pre_action_battlers.size-1]
        # Inserting the present actor in two rear
        @pre_action_battlers.insert(0, act)
        # Presently eliminating position
        @pre_action_battlers.delete_at(@pre_action_battlers.size-1)
        @actor_array_index -= 1
        phase3_next_actor
      else
        act = @pre_action_battlers[@actor_array_index]
        # Most adding the present actor to rear
        @pre_action_battlers.push(act)
        # Presently eliminating position        
        @pre_action_battlers.delete_at(@actor_array_index)
        @actor_array_index -= 1
        phase3_next_actor
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Main processing
  #--------------------------------------------------------------------------
  alias main_ctb main
  def main
    # Drawing up the enemy name window
    @status_window2 = Window_BattleStatus_enemy.new
    @action_battlers = []
    @pre_action_battlers = []
    @max_ct = 0
    @countup = false
    @ct_wait = 0
    @action_count = 0
    main_ctb
    # Dispose the enemy name window
    @status_window2.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame renewal
  #--------------------------------------------------------------------------
  alias ctb_update update
  def update
    # If battle event is running
    if $game_system.battle_interpreter.running?
      # Update interpreter
      $game_system.battle_interpreter.update
      # If a battler which is forcing actions doesn't exist
      if $game_temp.forcing_battler == nil
        # If battle event has finished running
        unless $game_system.battle_interpreter.running?
          # Rerun battle event set up if battle continues
          unless judge
            setup_battle_event
          end
        end
        # If not after battle phase
        if @phase != 5
          # Refresh status window
          @status_window.refresh
          # Refresh enemy status window
          @status_window2.refresh
        end
      end
    else
      if @ct_wait > 0
        @ct_wait -= 1
      else
        update_ct
        @ct_wait = PARA_CTB::CT_SKIP
      end
    end
    unless @actor_index == nil
      if @actor_index >= 0 && @active_battler != nil
        # Display cursor rect
        x = 0
        y = @actor_index * 32
        @status_window.cursor_rect.set(x, y, @status_window.contents.width, 32)
      else
        @status_window.cursor_rect.empty
      end
    end
    ctb_update
  end
  #--------------------------------------------------------------------------
  # * Start Pre-Battle Phase
  #--------------------------------------------------------------------------
  alias ctb_start_phase1 start_phase1
  def start_phase1
    # CT Initialization
    initialize_ct
    # Start of Count Rise
    @countup = true
    # Run original call
    ctb_start_phase1
  end
  #--------------------------------------------------------------------------
  # * Frame Update (pre-battle phase)
  #--------------------------------------------------------------------------
  def update_phase1
    # Renew the enemy name list
    @status_window2.refresh
    # Determine win/loss situation
    if judge
      # If won or lost: end method
      return
    end
    # Start actor command phase
    start_phase3
  end
  #--------------------------------------------------------------------------
  # * Start Party Command Phase
  #--------------------------------------------------------------------------
  def start_phase2
    # Shift to phase 2
    @phase = 2
    # Set actor to non-selecting
    @actor_index = -1
    @active_battler = nil
    # Enable party command window
    @party_command_window.active = true
    @party_command_window.visible = true
    # Disable actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # Clear main phase flag
    $game_temp.battle_main_phase = false
    # If impossible to input command
    unless $game_party.inputable?
      # Start main phase
      start_phase4
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (party command phase: escape)
  #--------------------------------------------------------------------------
  def update_phase2_escape
    # Calculate enemy agility average
    enemies_agi = 0
    for enemy in $game_troop.enemies
      if enemy.exist?
        enemies_agi += enemy.agi
      end
    end
    # Calculate actor agility average
    actors_agi = 0
    for actor in @pre_action_battlers
      if actor.is_a?(Game_Actor) and actor.exist?
        actors_agi += actor.agi
      end
    end
    # Determine if escape is successful
    if PARA_CTB::ESCAPEABLE < 0
      success = true
    else
      success = rand(100) < PARA_CTB::ESCAPEABLE * 10 * actors_agi / enemies_agi
   end
    # If escape is successful
    if success
      # Play escape SE
      $game_system.se_play($data_system.escape_se)
      # Return to BGM before battle started
      $game_system.bgm_play($game_temp.map_bgm)
      # Clear the Battlers' CT
      for battler in $game_party.actors
        clear_ct(battler)
      end
      # Battle ends
      battle_end(1)
    # If escape is failure
    else
      # Set the "Escape Failure" message to the help window
      @help_window.set_text(PARA_CTB::UNESCAPE_MES, 1)
      # Clearing action and CT of the actor
      pre_action_battlers = @pre_action_battlers.clone
      for act in pre_action_battlers
        if act.is_a?(Game_Actor)
          declease_ct(act, 100-PARA_CTB::ACT_ESCAPE_CT)
          act.current_action.clear
          @pre_action_battlers.delete(act)
        end
      end
      @party_command_window.visible = false
      # Hide the help window
      @help_window.visible = true
      @wait_count = 20
      # Start main phase
      start_phase4
    end
  end
  #--------------------------------------------------------------------------
  # * Start Actor Command Phase
  #--------------------------------------------------------------------------
  def start_phase3
    # Shift to phase 3
    @phase = 3
    # Set actor as unselectable
    @actor_index = -1
    @active_battler = nil
    @actor_array_index = -1
    # To command input of the following actor
    if @pre_action_battlers != []
      phase3_next_actor
    else
      start_phase4
    end
  end
  #--------------------------------------------------------------------------
  # * Go to Command Input for Next Actor
  #--------------------------------------------------------------------------
  def phase3_next_actor
    # Loop
    begin
      # Actor blink effect OFF
      if @active_battler != nil
        @active_battler.blink = false
      end
      # If last actor
      if @actor_array_index + 1 == @pre_action_battlers.size
        # Start main phase
        start_phase4
        return
      # The next in case of enemy
      elsif $game_troop.enemies.include?(@pre_action_battlers[@actor_array_index + 1])
        # Start main phase
        start_phase4
        return
      end
      # Advance actor index
      @actor_array_index += 1
      @actor_index = @pre_action_battlers[@actor_array_index].index
      @active_battler = $game_party.actors[@actor_index]
      # When the battle event is reserved,
      if @active_battler.current_action.forcing
        # Main phase start
        start_phase4
        return
      end
      @active_battler.blink = true
      @active_battler.current_action.clear
    # Once more if actor refuses command input
    end until @active_battler.inputable?
    # Set up actor command window
    phase3_setup_command_window
  end
  #--------------------------------------------------------------------------
  # * Go to Command Input of Previous Actor
  #--------------------------------------------------------------------------
  def phase3_prior_actor
    # Loop
    begin
      # Actor blink effect OFF
      if @active_battler != nil
        @active_battler.blink = false
      end
      # If first actor
      if @actor_array_index <= 0
        # Start party command phase
        start_phase2
        return
      end
      # Return to actor index
      @actor_array_index -= 1
      @actor_index = @pre_action_battlers[@actor_array_index].index
      @active_battler = $game_party.actors[@actor_index]
      @active_battler.blink = true
      @active_battler.current_action.clear
    # Once more if actor refuses command input
    end until @active_battler.inputable?
    # Set up actor command window
    phase3_setup_command_window
  end
  #--------------------------------------------------------------------------
  # * Actor Command Window Setup
  #--------------------------------------------------------------------------
  alias phase3_setup_command_window_ctb phase3_setup_command_window
  def phase3_setup_command_window
    @actor_command_window.back_opacity = PARA_CTB::WINDOW_OPACITY
    phase3_setup_command_window_ctb
    if PARA_CTB::WINDOWPOS_CHANGE
      # Set actor command window position
      @actor_command_window.x = PARA_CTB::WINDOWPOS_X
      @actor_command_window.y = PARA_CTB::WINDOWPOS_Y
      # Way it does not hide in the status window
      @actor_command_window.z = 9999
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase)
  #--------------------------------------------------------------------------
  def update_phase3
    # If enemy arrow is enabled
    if @enemy_arrow != nil
      @countup = PARA_CTB::SELECT_WAIT ? false : true
      update_phase3_enemy_select
    # If actor arrow is enabled
    elsif @actor_arrow != nil
      @countup = PARA_CTB::SELECT_WAIT ? false : true
      update_phase3_actor_select
    # If skill window is enabled
    elsif @skill_window != nil
      @countup = PARA_CTB::SELECT_WAIT ? false : true
      update_phase3_skill_select
    # If item window is enabled
    elsif @item_window != nil
      @countup = PARA_CTB::SELECT_WAIT ? false : true
      update_phase3_item_select
    # If actor command window is enabled
    elsif @actor_command_window.active
      @countup = PARA_CTB::COMMAND_WAIT ? false : true
      update_phase3_basic_command
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (actor command phase : basic command)
  #--------------------------------------------------------------------------
  alias ctb_update_phase3_basic_command update_phase3_basic_command
  def update_phase3_basic_command
    ctb_update_phase3_basic_command
    # Change player order with the preset L & R keys
    if Input.trigger?(PARA_CTB::CHANGE_NEXT)
      shift_activer(1)
    end
     if Input.trigger?(PARA_CTB::CHANGE_LAST)
      shift_activer(-1)
    end
  end
  #--------------------------------------------------------------------------
  # * Start Main Phase
  #--------------------------------------------------------------------------
  def start_phase4
    # Shift to phase 4
    @phase = 4
    battler_count = $game_party.actors.size + $game_troop.enemies.size
    if @action_count >= battler_count or $game_temp.battle_turn == 0
      # Search all battle event pages
      for index in 0...$data_troops[@troop_id].pages.size
        # Get event page
        page = $data_troops[@troop_id].pages[index]
        # If this page span is [turn]
        if page.span == 1
          # Clear action completed flags
          $game_temp.battle_event_flags[index] = false
        end
      end
      # Turn count
      $game_temp.battle_turn += 1
      @action_count = 0
    end
    # Set actor as unselectable
    @actor_index = -1
    @active_battler = nil
    # Enable party command window
    @party_command_window.active = false
    @party_command_window.visible = false
    # Disable actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # Set main phase flag
    $game_temp.battle_main_phase = true
    # Make enemy action
    for enemy in $game_troop.enemies
      unless enemy.current_action.forcing
        enemy.make_action
      end
    end
    # Make action orders 
    make_action_orders
    # Shift to step 1
    @phase4_step = 1
  end
  #--------------------------------------------------------------------------
  # * Make Action Orders
  #--------------------------------------------------------------------------
  def make_action_orders
    # Initialize @action_battlers array
    @action_battlers = []
    if @pre_action_battlers != []
      for i in 0..@actor_array_index
        # Add the actors to the @action_battle array
        @action_battlers.push(@pre_action_battlers[0])
        @pre_action_battlers.shift
      end
      if @pre_action_battlers.size != 0
      loop do
        if $game_troop.enemies.include?(@pre_action_battlers[0])
          # Add the enemies to the @action_battle array
          @action_battlers.push(@pre_action_battlers[0])
          @pre_action_battlers.shift
        else
          break
        end
      end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 1 : action preparation)
  #--------------------------------------------------------------------------
  alias ctb_update_phase4_step1 update_phase4_step1
  def update_phase4_step1
    @countup = true
    # Hide the help window
    @help_window.visible = false
    # Determine win/loss situation
    if judge
      # If won or lost: end method 
      return
    end
    # If no actionless battlers exist (all have performed an action)
    if @action_battlers.size == 0
      # Start actor command phase
      start_phase3
      return
    end
    ctb_update_phase4_step1
  end
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 2 : start action)
  #--------------------------------------------------------------------------
  alias ctb_update_phase4_step2 update_phase4_step2
  def update_phase4_step2
    # If not a forcing action
    unless @active_battler.current_action.forcing
      # If restriction is [cannot perform action]
      if @active_battler.restriction == 4
        # Clear the CT
        clear_ct(@active_battler)
        # Clear battler being forced into action
        $game_temp.forcing_battler = nil
        # Shift to step 1
        @phase4_step = 1
        return
      end
    end
    # Determines if CT Gauge is filled during animation
    @countup = PARA_CTB::ANIMATION_WAIT ? false : true
    ctb_update_phase4_step2
  end
  #--------------------------------------------------------------------------
  # * Make Basic Action Results
  #--------------------------------------------------------------------------
  alias make_basic_action_result_ctb make_basic_action_result
  def make_basic_action_result
    # If doing nothing
    if @active_battler.current_action.basic == 3
      # Clear the battler's CT 
      clear_ct(@active_battler)
      # Clear battler being forced into action
      $game_temp.forcing_battler = nil
      # Shift to step 1
      @phase4_step = 1
      return
    end
    make_basic_action_result_ctb
  end
  #--------------------------------------------------------------------------
  # * Make Skill Action Results
  #--------------------------------------------------------------------------
  def make_skill_action_result
    # Get skill
    @skill = $data_skills[@active_battler.current_action.skill_id]
    # If not a forcing action
    unless @active_battler.current_action.forcing
      # If unable to use due to SP running out
      unless @active_battler.skill_can_use?(@skill.id)
        # Clear battler being forced into action
        $game_temp.forcing_battler = nil
        # Clear the CT
        declease_ct(@active_battler,100-PARA_CTB::ACT_SKILL_CT)
        # Shift to step 1
        @phase4_step = 1
        return
      end
    end
    # Use up SP
    @active_battler.sp -= @skill.sp_cost
    # Refresh status window
    @status_window.refresh
    # Show skill name on help window
    @help_window.set_text(@skill.name, 1)
    # Set animation ID
    @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    # Set command event ID
    @common_event_id = @skill.common_event_id
    # Set target battlers 
    set_target_battlers(@skill.scope)
    # Apply skill effect
    for target in @target_battlers
      target.skill_effect(@active_battler, @skill)
    end
  end
  #--------------------------------------------------------------------------
  # * Make Item Action Results
  #--------------------------------------------------------------------------
  alias ctb_make_item_action_result make_item_action_result
  def make_item_action_result
    # Get item
    @item = $data_items[@active_battler.current_action.item_id]
    # If unable to use due to items running out
    unless $game_party.item_can_use?(@item.id)
      # Clear the CT
      declease_ct(@active_battler,100-PARA_CTB::ACT_ITEM_CT)
      # Shift to step 1
      @phase4_step = 1
      return
    end
    ctb_make_item_action_result
  end
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 5 : damage display)
  #--------------------------------------------------------------------------
  alias update_phase4_step5_ctb update_phase4_step5
  def update_phase4_step5
    # Display damage
    for target in @target_battlers
      if target.damage != nil
        target.movable_backup = target.movable?
      end
    end
    update_phase4_step5_ctb
  end
  #-------------------------------------------------------------------------- 
  # * Frame Update (main phase step 6 : refresh)
  #--------------------------------------------------------------------------
  alias update_phase4_step6_ctb update_phase4_step6
  def update_phase4_step6
    @active_battler.countup = true
    if @active_battler.current_action.basic == 1
      # Defense
      declease_ct(@active_battler,100-PARA_CTB::ACT_GUARD_CT)
    else
      case @active_battler.current_action.kind
      # Attack
      when 0
        declease_ct(@active_battler,100-PARA_CTB::ACT_ATTACK_CT)
      # Skill
      when 1
        declease_ct(@active_battler,100-PARA_CTB::ACT_SKILL_CT)
      # Item
      when 2
        declease_ct(@active_battler,100-PARA_CTB::ACT_ITEM_CT)
      else
        clear_ct(@active_battler)
      end
    end
    # Clear the CT if the battler is incapacitated
    for target in @target_battlers
      if target.movable? == false and target.movable_backup == true
        clear_ct(target)
        @status_window.refresh_ct
      end
    end
    update_phase4_step6_ctb
    # Renew the Enemy Name List
    @status_window2.refresh
    # Clearing action
    if @active_battler.guarding? == false
      @active_battler.current_action.clear
    end    
  end
  #--------------------------------------------------------------------------
  # * Start After Battle Phase
  #--------------------------------------------------------------------------
  alias ctb_start_phase5 start_phase5
  def start_phase5
    @countup = false
    ctb_start_phase5
  end
end
 
#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
#  This window displays the status of all party members on the battle screen.
#==============================================================================
 
class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(160, 320, 480, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = PARA_CTB::WINDOW_MAIN_OPACITY
    @level_up_flags = [false, false, false, false]
    @before_hp = []
    @before_sp = []
    @before_states = []
    @now_hp = []
    @now_sp = []
    @now_states = []
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      line_height = 120 / PARA_CTB::PARTY_SIZE
      actor_y = i * line_height + 4
      # Present status in arrangement
      @now_hp[i] = actor.hp
      @now_sp[i] = actor.sp
      @now_states[i] = actor.states
      # If leveling up
      if @level_up_flags[i]
        self.contents.fill_rect(344, actor_y+14, 100, 8, Color.new(0, 0, 0, 0))
        self.contents.font.color = normal_color
        self.contents.draw_text(344, actor_y, 120, 32, "LEVEL UP!")
      end
    end
    # Light weight conversion processing of battle status
    # When arrangement of status changes only, drawing processing
    if @before_hp == nil or @before_sp == nil or @before_states == nil or
    @before_hp != @now_hp or @before_sp != @now_sp or @before_states != @now_states
      self.contents.clear
      for j in 0...$game_party.actors.size
        actor = $game_party.actors[j]
        line_height = 120 / PARA_CTB::PARTY_SIZE
        actor_y = j * line_height + 4
        self.contents.font.size = PARA_CTB::NAME_FONT_SIZE
        # Draw Actor Name
        draw_actor_name(actor, 4, actor_y+16-PARA_CTB::NAME_FONT_SIZE)
        # Draw HP
        hp_color1 = PARA_CTB::HP_COLOR_LEFT
        hp_color2 = PARA_CTB::HP_COLOR_RIGHT
        draw_meter(actor.hp, actor.maxhp, 125, actor_y+14, 80, 8, hp_color1, hp_color2)
        draw_actor_hp(actor, 102, actor_y+16-PARA_CTB::HPSP_FONT_SIZE, 100)
        # Draw SP 
        sp_color1 = PARA_CTB::SP_COLOR_LEFT
        sp_color2 = PARA_CTB::SP_COLOR_RIGHT
        draw_meter(actor.sp, actor.maxsp, 245, actor_y+14, 80, 8, sp_color1, sp_color2)
        draw_actor_sp(actor, 222, actor_y+16-PARA_CTB::HPSP_FONT_SIZE, 100)
        # Status after the changing in arrangement
        @before_hp[j] = actor.hp
        @before_sp[j] = actor.sp
        @before_states[j] = actor.states
        # If Leveling up
        if @level_up_flags[j]
          self.contents.fill_rect(344, actor_y, 100, 8, Color.new(0, 0, 0, 0))
          self.contents.font.color = normal_color
          self.contents.draw_text(344, actor_y, 120, 32, "LEVEL UP!")
        end
      end
    end
    refresh_ct
  end
  #--------------------------------------------------------------------------
  # * Refresh the CT Gauge
  #--------------------------------------------------------------------------
  def refresh_ct
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      line_height = 120 / PARA_CTB::PARTY_SIZE
      actor_y = i * line_height + 4
      # When the CT gauge is full, color of gauge
      ct_color_full = PARA_CTB::COLOR_FULL
      # Color of CT gauge (left hand edge)
      ct_color_start = actor.full_ct ? ct_color_full : PARA_CTB::COLOR_LEFT
      # Color of CT gauge (right hand edge)
      ct_color_end = actor.full_ct ? ct_color_full : PARA_CTB::COLOR_RIGHT
      if @level_up_flags[i] != true and actor.ct_visible
        draw_meter(actor.now_ct, actor.max_ct, 344, actor_y+14, 100, 8, ct_color_start, ct_color_end)
      elsif @level_up_flags[i] != true
        draw_meter(0, actor.max_ct, 344, actor_y+14, 100, 8, ct_color_start, ct_color_end)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Renewal
  #--------------------------------------------------------------------------
  def update
    super
  end
  #--------------------------------------------------------------------------
  # * Draw HP
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_hp(actor, x, y, width = 144)
    # Draw the "HP" text
    self.contents.font.color = system_color
    self.contents.font.size = 16
    self.contents.draw_text(x, y+2, 32, 32, $data_system.words.hp)
    self.contents.font.color = normal_color
    self.contents.font.size = PARA_CTB::HPSP_FONT_SIZE
    if PARA_CTB::MAX_DRAW
      # Draw the MaxHP
      self.contents.draw_text(x, y, width, 32, actor.maxhp.to_s, 2)
      text_size = self.contents.text_size(actor.maxhp.to_s) 
      text_x = x + width - text_size.width - 12
      self.contents.draw_text(text_x, y, 12, 32, "/", 1)
      # Draw the HP
      self.contents.font.color = actor.hp == 0 ? knockout_color :
        actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
      text_x = text_x - text_size.width
      self.contents.draw_text(text_x, y, text_size.width, 32, actor.hp.to_s, 2)
    else
      self.contents.font.color = actor.hp == 0 ? knockout_color :
        actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
      self.contents.draw_text(x, y, width, 32, actor.hp.to_s, 2)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw SP
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_sp(actor, x, y, width = 144)
    # Draw the "SP" text
    self.contents.font.color = system_color
    self.contents.font.size = 16
    self.contents.draw_text(x, y+2, 32, 32, $data_system.words.sp)
    self.contents.font.color = normal_color
    self.contents.font.size = PARA_CTB::HPSP_FONT_SIZE
    if PARA_CTB::MAX_DRAW
    # Draw the MaxSP
      self.contents.draw_text(x, y, width, 32, actor.maxsp.to_s, 2)
      text_size = self.contents.text_size(actor.maxsp.to_s) 
      text_x = x + width - text_size.width - 12
      self.contents.draw_text(text_x, y, 12, 32, "/", 1)
      # Draw the SP
      self.contents.font.color = actor.sp == 0 ? knockout_color :
        actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
      text_x = text_x - text_size.width
      self.contents.draw_text(text_x, y, text_size.width, 32, actor.sp.to_s, 2)
    else
      self.contents.font.color = actor.sp == 0 ? knockout_color :
        actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
      self.contents.draw_text(x, y, width, 32, actor.sp.to_s, 2)
    end
  end
end
 
#============================================================================== 
# ** Window_BattleStatus_enemy
#------------------------------------------------------------------------------
#  This window displays the status of all enemy troops on the battle screen.
#==============================================================================
 
class Window_BattleStatus_enemy < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 320, 160, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.back_opacity = PARA_CTB::WINDOW_MAIN_OPACITY
    refresh
  end
  #-------------------------------------------------------------------------- 
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.font.size = PARA_CTB::ENEMY_FONT_SIZE
    @exist_enemies = []
    if $game_troop.enemies != nil
      if PARA_CTB::ENEMY_GROUPING
        ememy_list = []
        ememy_list_index = []
        # Loop through the Enemy Troop
        for i in 0...$game_troop.enemies.size
          enemy = $game_troop.enemies[i]
          if enemy.exist?
            if ememy_list.include?(enemy.name)
              ememy_list_index[ememy_list.index(enemy.name)] += 1
            else
              # Store the enemy name
              ememy_list.push(enemy.name)
              ememy_list_index[ememy_list.index(enemy.name)] = 1
            end
          end
        end
        # Draw the name and number of the enemy
        enemy_index = 0
        for enemy_name in ememy_list
          enemy_y = enemy_index * (PARA_CTB::ENEMY_FONT_SIZE+6) + 4
          if ememy_list_index[enemy_index] > 1
            enemy_name = enemy_name + " " + ememy_list_index[enemy_index].to_s
          end
          self.contents.draw_text(4, enemy_y, 160, 20, enemy_name)
          enemy_index += 1
        end
      else
        # Draw the enemy name 
        enemy_index = 0
        for i in 0...$game_troop.enemies.size
          enemy = $game_troop.enemies[i]
          if enemy.exist?
            @exist_enemies.push(enemy)
            line_height = PARA_CTB::ENEMY_FONT_SIZE + 6
            if PARA_CTB::ENEMY_DRAWING_MATER != 0
              line_height += 10
            end
            enemy_y = enemy_index * line_height + 4
            self.contents.draw_text(4, enemy_y, 160, 20, enemy.name)
            enemy_index += 1
            if PARA_CTB::ENEMY_DRAWING_MATER == 1
              hp_color1 = PARA_CTB::HP_COLOR_LEFT
              hp_color2 = PARA_CTB::HP_COLOR_RIGHT
              y = enemy_y + PARA_CTB::ENEMY_FONT_SIZE + 3
              draw_meter(enemy.hp, enemy.maxhp, 4, y, 80, 8, hp_color1, hp_color2)
            end
          end
        end
      end
    end
    refresh_ct
  end
  #-------------------------------------------------------------------------- 
  # * Refresh the CT gauge
  #--------------------------------------------------------------------------
  def refresh_ct
    if PARA_CTB::ENEMY_DRAWING_MATER == 2 and @exist_enemies != nil
      enemy_index = 0
      for enemy in @exist_enemies
        line_height = PARA_CTB::ENEMY_FONT_SIZE + 16
        enemy_y = enemy_index * line_height + 4
        y = enemy_y + PARA_CTB::ENEMY_FONT_SIZE + 3
        # When the CT gauge is full, color of gauge
        ct_color_full = PARA_CTB::COLOR_FULL
        # Color of CT gauge (the left edge)
        ct_color_start = enemy.full_ct ? ct_color_full : PARA_CTB::COLOR_LEFT
        # Color of CT gauge (the right edge)
        ct_color_end = enemy.full_ct ? ct_color_full : PARA_CTB::COLOR_RIGHT
        if enemy.ct_visible
          draw_meter(enemy.now_ct, enemy.max_ct, 4, y, 100, 8, ct_color_start, ct_color_end)
        else
          draw_meter(0, enemy.max_ct, 4, y, 100, 8, ct_color_start, ct_color_end)
        end
        enemy_index += 1
      end
    end
  end
end
 
#============================================================================== 
# ** Window_Base
#------------------------------------------------------------------------------
#  This class is for all in-game windows.
#==============================================================================
 
class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Draw the meter
  #--------------------------------------------------------------------------
  def draw_meter(now, max, x, y, width, height, start_color, end_color=start_color )
    self.contents.fill_rect(x, y, width, height, PARA_CTB::FRAME_COLOR)
    self.contents.fill_rect(x+PARA_CTB::FRAME_BORDER, y+PARA_CTB::FRAME_BORDER, width-
    PARA_CTB::FRAME_BORDER*2, height-PARA_CTB::FRAME_BORDER*2, PARA_CTB::BACK_COLOR)
    now = now > max ? max : now
    percentage = max != 0 ? (width-2) * now / max.to_f : 0
    if start_color == end_color
      self.contents.fill_rect(x+1, y+1, percentage, height-2, start_color)
    else
      for i in 1..percentage
        r = start_color.red + (end_color.red - start_color.red) / percentage * i
        g = start_color.green + (end_color.green - start_color.green) / percentage * i
        b = start_color.blue + (end_color.blue - start_color.blue) / percentage * i
        a = start_color.alpha + (end_color.alpha - start_color.alpha) / percentage * i
        self.contents.fill_rect(x+i, y+1, 1, height-2, Color.new(r, g, b, a))
      end
    end
  end
end
 
#==============================================================================
# ** Game_Battler 
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass for the Game_Actor
#  and Game_Enemy classes.
#==============================================================================
 
class Game_Battler 
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :max_ct
  attr_accessor :now_ct
  attr_accessor :full_ct
  attr_accessor :countup
  attr_accessor :ct_visible
  attr_accessor :movable_backup
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias ctb_initialize initialize
  def initialize
    ctb_initialize
    @max_ct = 0
    @now_ct = 0
    @full_ct = false
    @countup = true
    @ct_visible = true
  end
end
 
#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
#  This sprite is used to display the battler.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================
 
class Sprite_Battler < RPG::Sprite 
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias ctb_update update
  def update
    ctb_update
    if @battler != nil
      if @battler.full_ct and @battler.ct_visible
        # Change the color tone of the battler when the CT Gauge is full
        fullct_color = PARA_CTB::FULL_CT_COLOR
        self.tone = fullct_color
      else
        fullct_color = Tone.new(0,0,0)
        self.tone = fullct_color
      end
    end
  end
end
 
#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
#  This window shows skill and item explanations along with actor status.
#==============================================================================
 
class Window_Help < Window_Base
  #--------------------------------------------------------------------------
  # * Set Actor
  #     actor : status displaying actor
  #--------------------------------------------------------------------------
  alias set_actor_ctb set_actor
  def set_actor(actor)
    if PARA_CTB::HELP_DRAWING_MATER_ACTOR
      self.contents.clear
      draw_actor_name(actor, 4, 0)
      draw_actor_state(actor, 140, 0)
      hp_color1 = PARA_CTB::HP_COLOR_LEFT
      hp_color2 = PARA_CTB::HP_COLOR_RIGHT
      draw_meter(actor.hp, actor.maxhp, 316, 18, 112, 8, hp_color1, hp_color2)
      draw_actor_hp(actor, 284, 0)
      sp_color1 = PARA_CTB::SP_COLOR_LEFT
      sp_color2 = PARA_CTB::SP_COLOR_RIGHT
      draw_meter(actor.sp, actor.maxsp, 492, 18, 112, 8, sp_color1, sp_color2)
      draw_actor_sp(actor, 460, 0)
      @actor = actor
      @text = nil
      self.visible = true
    else
      set_actor_ctb(actor)
    end
  end
  #--------------------------------------------------------------------------
  # * Set Enemy
  #     enemy : name and status displaying enemy
  #--------------------------------------------------------------------------
  alias set_enemy_ctb set_enemy
  def set_enemy(enemy)
    if PARA_CTB::HELP_DRAWING_MATER_ENEMY
      self.contents.clear
      draw_actor_name(enemy, 4, 0)
      draw_actor_state(enemy, 140, 0)
      hp_color1 = PARA_CTB::HP_COLOR_LEFT
      hp_color2 = PARA_CTB::HP_COLOR_RIGHT
      draw_meter(enemy.hp, enemy.maxhp, 316, 18, 112, 8, hp_color1, hp_color2)
      draw_actor_hp(enemy, 284, 0)
      sp_color1 = PARA_CTB::SP_COLOR_LEFT
      sp_color2 = PARA_CTB::SP_COLOR_RIGHT
      draw_meter(enemy.sp, enemy.maxsp, 492, 18, 112, 8, sp_color1, sp_color2)
      draw_actor_sp(enemy, 460, 0)
      self.visible = true
    else
      set_enemy_ctb(enemy)
    end
  end
end

Edited by Tenoukii

Share this post


Link to post
Share on other sites

Damn, it's cut off the rest >.<

The rest stated:

I'd like the progress of each skill shown in the Skills screen if possible, and when a skill is fully learnt, it tells you in the end of battle screen (like it does in FFIX)

Another request is an edit to the ATB script to show the character graphic on the left of the characters details that shows animations of when magic is cast, hits/magic taken.

And the final one! (I've almost forgotten what this one is, so I'll sit and ponder for a moment in the hope it'll come back to me...)

Damn it, I've forgotten ;_; I'll have to put this one in when I remember what it is!

 

Anywho, I know it's a sizeable request, hence why I will be forever in the debt of whichever person (or persons) takes it on!

Thanks in advance!! ^^ 

Share this post


Link to post
Share on other sites

I believe you are thinking of something closer to the final fantasy tactics games.

I found this script for you. http://save-point.org/thread-2300.html I think it should have what you need.

 

As far as the null states go you can do that in the database, except it only blocks half the damage.

 

Which atb exactly?

Edited by Saltome

Share this post


Link to post
Share on other sites

It's ParaDogs ATB.. it's got an add-on type thing that Kellessdee did for me back in like, 2011. I've put a copy of it in the OP :)

Will that Skill system work with the XMB (show in the same sort of way as all the other submenus in the menu)? I'm assuming not?

Share this post


Link to post
Share on other sites

Nope, I'm gonna have to set it up manually. But at least check out the learning script and tell me if you want it, so I can merge them.

If you want to have the character graphics back just remove the addon Kellessdee made.

Edited by Saltome

Share this post


Link to post
Share on other sites

The edit on the ATB is for hiding animations that would be shown on the battler graphic, but I think I had the battler graphics written out of it, so removing the edit just shows random animations along the bottom of the screen.

The learning script is awesome from what I've seen, I'm not sure weather I'm looking at it wrong though, but the skills available in the W/A don't appear to be usable until you've learnt them?

 

Edit:

Just seen the snippet he put in to allow you to use the skills!

And I forgot about the add-on on the ATB that does what's described above. The edit in the main script gets rid of the battler graphic (which I still don't want) I meant the actual character graphic displayed downwards to the left of the names, or in a seperate window above them.

like this: 

example.png?_subject_uid=265225716&w=AAB

Edited by Tenoukii

Share this post


Link to post
Share on other sites

Ok, I see it now. It should be fine to show the character sprites. But your example doesn't seem to be working, I guess it wants me to log in dropbox or something.

 

It depends how you set up the skills, the script offers you the ability to have skills that are only available when a certain item is equipped, and the ability to require a certain level before you can gain exp for a given skill, in addition to learning skills stored in equipment.

Share this post


Link to post
Share on other sites

If you haven't seen it yet is basically just that the enemy window is on the Left (displays the enemy name) the character one on the right (showing name, hp, sp) and the battle screen with the enemy graphics on top. I wanted the character graphic either to the left of the characters names or in a separate window above the character window :) 

I'll take a more detailed look at the script tomorrow and see if I can figure it out :) Thanks ^^

Share this post


Link to post
Share on other sites

Well this menu script is a bit overwhelming, I'm gonna need some time off. On the other hand I put the actor characters in the status window, and I made some improvements and bugfixes. For future reference I made them directly to the code, that's not the best idea, but since it's an abandoned script it shouldn't be a problem. Delete the old scripts and add mine in the order I post them.
 
kellessdee addon:

class Arrow_Actor < Arrow_Base
def update
super
# Cursor right
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@index += 1
@index %= $game_party.actors.size
end
# Cursor left
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@index += $game_party.actors.size - 1
@index %= $game_party.actors.size
end
# Set sprite coordinates
if self.actor != nil
self.x = self.actor.screen_x
self.y = self.actor.screen_y+48
end
end
end

class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# If battler is nil
if @battler == nil
self.bitmap = nil
loop_animation(nil)
return
end
unless @battler.is_a?(Game_Actor)
# If file name or hue are different than current ones
if @battler.battler_name != @battler_name ||
@battler.battler_hue != @battler_hue
# Get and set bitmap
@battler_name = @battler.battler_name
@battler_hue = @battler.battler_hue
self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
@width = bitmap.width
@height = bitmap.height
self.ox = @width / 2
self.oy = @height
# Change opacity level to 0 when dead or hidden
if @battler.dead? || @battler.hidden
self.opacity = 0
end
end
else
if @battler.battler_name != @battler_name ||
@battler.battler_hue != @battler_hue
# Get and set bitmap
@battler_name = @battler.character_name
@battler_hue = @battler.character_hue
self.bitmap = RPG::Cache.character(@battler_name, @battler_hue)
@width = bitmap.width/4
@height = bitmap.height/4
self.src_rect.set(0, 0, @width, @height)
self.ox = @width / 2
self.oy = @height
# Change opacity level to 0 when dead or hidden
if @battler.dead? || @battler.hidden
self.opacity = 0
end
end
end
# If animation ID is different than current one
if @battler.damage == nil &&
@battler.state_animation_id != @state_animation_id
@state_animation_id = @battler.state_animation_id
loop_animation($data_animations[@state_animation_id])
end
#=begin
# If actor which should be displayed
if @battler.is_a?(Game_Actor) and @battler_visible
# Bring opacity level down a bit when not in main phase
if $game_temp.battle_main_phase
self.opacity += 3 if self.opacity < 255
else
self.opacity -= 3 if self.opacity > 207
end
end
#=end
# Blink
if @battler.blink
blink_on
else
blink_off
end
# If invisible
unless @battler_visible
# Appear
if !@battler.hidden && !@battler.dead? &&
(@battler.damage == nil || @battler.damage_pop)
appear
@battler_visible = true
end
end
# If visible
if @battler_visible
# Escape
if @battler.hidden
$game_system.se_play($data_system.escape_se)
escape
@battler_visible = false
end
# White flash
if @battler.white_flash
whiten
@battler.white_flash = false
end
# Animation
if @battler.animation_id != 0 #&& @battler.is_a?(Game_Enemy)
animation = $data_animations[@battler.animation_id]
animation(animation, @battler.animation_hit)
@battler.animation_id = 0
end
# Damage
if @battler.damage_pop
damage(@battler.damage, @battler.critical)
@battler.damage = nil
@battler.critical = false
@battler.damage_pop = false
end
# Collapse
if @battler.damage == nil && @battler.dead?
if @battler.is_a?(Game_Enemy)
$game_system.se_play($data_system.enemy_collapse_se)
else
$game_system.se_play($data_system.actor_collapse_se)
end
collapse
@battler_visible = false
end
end
# Set sprite coordinates
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
end
end
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Get Battle Screen X-Coordinate
#--------------------------------------------------------------------------
def screen_x
return ((self.index%2) *32)+192-12
end
#--------------------------------------------------------------------------
# * Get Battle Screen Y-Coordinate
#--------------------------------------------------------------------------
def screen_y
if self.index != nil
return self.index * 24 + 320+64
else
return 0
end
end
end
#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
# This class brings together battle screen sprites. It's used within
# the Scene_Battle class.
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :viewport1 # enemy viewport
attr_reader :viewport2 # actor viewport
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Make viewports
@viewport1 = Viewport.new(0, 0, 640, 320)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport4 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 101
@viewport3.z = 200
@viewport4.z = 5000
# Make battleback sprite
@battleback_sprite = Sprite.new(@viewport1)
# Make enemy sprites
@enemy_sprites = []
# @enemy_characters=[]
for enemy in $game_troop.enemies.reverse
@enemy_sprites<<Sprite_Battler.new(@viewport1, enemy)

end
# Make actor sprites
@actor_sprites=[]
for i in 0...PARA_CTB::PARTY_SIZE
@actor_sprites<<Sprite_Battler.new(@viewport2)

end
=begin
@actor_sprites = []
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
=end
# Make weather
@weather = RPG::Weather.new(@viewport1)
# Make picture sprites
@picture_sprites = []
for i in 51..100
@picture_sprites.push(Sprite_Picture.new(@viewport3,
$game_screen.pictures))
end
# Make timer sprite
@timer_sprite = Sprite_Timer.new
# Frame update
update
end
end


ParaDog Active Time Battle v.2.63

#==============================================================================
# Active Time Battle v.2.62
# Script by ParaDog
#  http://2d6.parasite.jp/
#------------------------------------------------------------------------------
# When the CT Gauge becomes filled, the battler which it controls will then be
# able to perform his/her battle action.
# The system can also adjust the positioning of the BattleStatus window which
# works well with Sideview System scripts.
#------------------------------------------------------------------------------
# INSTALLING:
# When using this system, it is recommended that this script be placed above
# all other 'Custom' scripts... directly below Scene_Debug if possible.
#------------------------------------------------------------------------------
# ESCAPE:
# While a battler's command window is active, pressing the [ESC] button will
# activate the 'Fight / Escape' window at the top of the screen. The more
# actors you have with full CT, the better your chances are of a successful
# escape, while fewer actors and more enemies results in a lower chance to flee.
#
# NEXT/PREVIOUS BATTLER:
# When two or more actors can act, you can toggle between the actors with full
# CT gauges with the [R] button or the [PageDown] key, or in reverse order with
# the [L] button or the [PageUp] key. These keys can be altered in the config-
# uration section below.
#==============================================================================
# Modified by Kellessdee to display cursor rect over selected character
# and fixed the switching between character's bug
module PARA_CTB

# CT gauge pauses while command window is open
COMMAND_WAIT = true
# CT gauge pauses when Skill and Item windows are open, and while targeting
SELECT_WAIT = true
# CT gauge pauses when battlers perform actions
ANIMATION_WAIT = true

# CT Gauge fill / Battle system speed
BATTLE_SPEED = 3

# Maximum size in your Battle Party
PARTY_SIZE = 4

# CT Cost in percentages for each action
ACT_ATTACK_CT = 100 # Normal attack
ACT_GUARD_CT = 100 # Defense
ACT_ESCAPE_CT = 100 # Escape
ACT_SKILL_CT = 100 # Skill
ACT_ITEM_CT = 100 # Item

# Message when failed to escape
UNESCAPE_MES = "Escape failed"

# Sound effect played when the CT Gauge is full (if "", plays no sound)
# Sound effect stored in the project's "Audio/SE" folder
FULL_CT_SE = "015-Jump01"
# Sound Volume
FULL_CT_SE_VOL = 60

# Tone effect of the battler when the CT Gauge is full
# A value of (0,0,0) performs no tone change
FULL_CT_COLOR = Tone.new(32,0,0)

# Color of HP gauge (gradation left edge)
HP_COLOR_LEFT = Color.new(128, 0, 0, 255)
# Color of HP gauge (gradation right edge)
HP_COLOR_RIGHT= Color.new(255, 0, 0, 255)
# Color of SP gauge (gradation left edge)
SP_COLOR_LEFT = Color.new(0, 0, 128, 255)
# Color of SP gauge (gradation right edge)
SP_COLOR_RIGHT= Color.new(0, 0, 255, 255)
# Color of CT gauge (gradation left edge)
COLOR_LEFT = Color.new(128, 128, 64, 255)
# Color of CT gauge (gradation left edge)
COLOR_RIGHT= Color.new(255, 255, 128, 255)
# Color of CT gauge (filled gauge)
COLOR_FULL = Color.new(255, 225, 128, 255)

# Gauge Frame Color
FRAME_COLOR = Color.new(192, 192, 192, 255)
# Gauge Frame Width
FRAME_BORDER = 1
# Gauge Frame Background Color
BACK_COLOR = Color.new(128, 128, 128, 128)

# Font Size of Actor Names
NAME_FONT_SIZE = 16
# Font Size of Actor HP/SP
HPSP_FONT_SIZE = 18
# Font Size of Enemy Names
ENEMY_FONT_SIZE = 16
# Draw maximum values for HP/SP
MAX_DRAW = false

# Group Enemy Names
# Ex: Instead of "Ghost Ghost" it will say "Ghost2"
ENEMY_GROUPING = true

# Draw Bars for Enemies (0: None / 1: HP / 2: CT)
# If ENEMY_GROUPING is used, then this setting is ignored
ENEMY_DRAWING_MATER = 2

# Draw Actor HP/SP bars in the help window
HELP_DRAWING_MATER_ACTOR = false
# Draw Enemy HP/SP bars in the help window
HELP_DRAWING_MATER_ENEMY = false

# Command Window Position System (true/false)
# (Useful with side-view scripts if the position of the Actor Command Window
# appears unnatural). The default setting is false, while true allows you to
# adjust the x/y position of the window.
WINDOWPOS_CHANGE = false
WINDOWPOS_X = 100 # X coordinates of the Actor Command Window
WINDOWPOS_Y = 320 # Y coordinates of the Actor Command Window

# Sets the intervals of the CT bar updates
# The lower a setting, the smoother the CT Bar fill will appear (0 Minimum).
# The higher a setting, the faster the CT Bar refreshes (Useful if lagging).
CT_SKIP = 2

# Set the Action Order Keys (Declared Method,Input::(Button))
# (See matching keys listed in RPGMaker XP)
CHANGE_NEXT = Input::RIGHT # Skip to next actor
CHANGE_LAST = Input::LEFT # Skip back to previous actor

# Opacity of the Actor Command Window
WINDOW_OPACITY = 160

# Opacity of the Battlestatus Window
WINDOW_MAIN_OPACITY = 255

# Revised Escape Ratio
# The higher the number, the easier to escape (1 being minimum). The base
# value is calculated by dividing the total of active party members by the
# number of active enemies. This value, multiplied by 10, determines the
# ercentage chance to escape. If the calculated value is -1, it succeeds.
ESCAPEABLE = 10

end

# End of the config section
#------------------------------------------------------------------------------


#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# * CT Update
#--------------------------------------------------------------------------
def update_ct
# When count rise is permitted
if @countup
for actor in $game_party.actors
# If you can act?
if actor.movable? == false and actor.ct_visible and @phase4_step != 5
# In invisibility state count rise
actor.ct_visible = false
actor.countup = true
actor.full_ct = false
elsif actor.movable? and actor.ct_visible == false
# Cancelling invisibility count rise
clear_ct(actor)
actor.ct_visible = true
end
# It corresponds to the replacement of the actor
if actor.max_ct == 0
actor.max_ct = @max_ct
end
# Count rise of actor
if actor.countup
# If the CT Gauge is filled and the actor is not in action
if actor.now_ct >= @max_ct and !(@pre_action_battlers.include?(actor))
# Adds the actor to the command input list
@pre_action_battlers.push(actor)
@action_count += 1
# Play the CG Gauge SE
if PARA_CTB::FULL_CT_SE != "" and actor.ct_visible
Audio.se_play("Audio/SE/" + PARA_CTB::FULL_CT_SE,PARA_CTB::FULL_CT_SE_VOL)
end
# Stop filling the CT Gauge
actor.countup = false
actor.full_ct = true
else
# Count rise
actor.make_action_speed
ct_skip = PARA_CTB::CT_SKIP + 1
actor.now_ct += actor.current_action.speed * PARA_CTB::BATTLE_SPEED * ct_skip
end
end
end
for enemy in $game_troop.enemies
# If you can act
if enemy.movable? == false and enemy.ct_visible and @phase4_step == 5
# In invisibility state count rise
enemy.ct_visible = false
enemy.countup = true
enemy.full_ct = false
elsif enemy.movable? and enemy.ct_visible == false
# Clear the invisible CT
clear_ct(enemy)
enemy.ct_visible = true
end
# Count rise of enemy
if enemy.countup
# if the enemy CT Gauge is full and the enemy is not in action
if enemy.now_ct >= @max_ct and ! @pre_action_battlers.include?(enemy)
# Adds the enemy to the command input list
@pre_action_battlers.push(enemy)
@action_count += 1
# Stop filling the CT Gauge
enemy.countup = false
enemy.full_ct = true
else
# Count rise
enemy.make_action_speed
enemy.now_ct += enemy.current_action.speed * PARA_CTB::BATTLE_SPEED
end
end
end
# Redrawing CT gauge
@status_window.refresh_ct
@status_window2.refresh_ct
end
end
#--------------------------------------------------------------------------
# * Clear the battler CT
#--------------------------------------------------------------------------
def clear_ct(battler)
battler.countup = true
battler.now_ct = 0
battler.full_ct = false
end
#--------------------------------------------------------------------------
# * Percentage of battler CT
#--------------------------------------------------------------------------
def declease_ct(battler,percent)
battler.countup = true
battler.now_ct = battler.now_ct * percent / 100
battler.full_ct = false
end
#--------------------------------------------------------------------------
# * CT Initialization
#--------------------------------------------------------------------------
def initialize_ct
# Deciding the reference level of CT
max_ct
for battler in $game_party.actors + $game_troop.enemies
if battler.movable?
# Set the CT starting level
battler.now_ct = battler.agi * 300
battler.ct_visible = true
else
clear_ct(battler)
battler.ct_visible = false
end
battler.countup = true
battler.full_ct = false
battler.max_ct = @max_ct
end
end
#--------------------------------------------------------------------------
# * Set the reference level of empty CT based on the Battler's speed
#--------------------------------------------------------------------------
def max_ct
for battler in $game_party.actors + $game_troop.enemies
@max_ct += battler.agi
end
@max_ct = @max_ct * 500 / ($game_party.actors.size + $game_troop.enemies.size )
end
#--------------------------------------------------------------------------
# * Modify the Battler's order of performance
#--------------------------------------------------------------------------
def shift_activer(shift)
# When one shifting, the actor of rear 2 or more
if @pre_action_battlers != nil
if shift == 1
# Acquiring the present actor
act = @pre_action_battlers[@pre_action_battlers.size-1]
# Inserting the present actor in two rear
@pre_action_battlers.insert(0, act)
# Presently eliminating position
@pre_action_battlers.delete_at(@pre_action_battlers.size-1)
@actor_array_index -= 1
phase3_next_actor
else
act = @pre_action_battlers[@actor_array_index]
# Most adding the present actor to rear
@pre_action_battlers.push(act)
# Presently eliminating position
@pre_action_battlers.delete_at(@actor_array_index)
@actor_array_index -= 1
phase3_next_actor
end
end
end
#--------------------------------------------------------------------------
# * Main processing
#--------------------------------------------------------------------------
alias main_ctb main
def main
# Drawing up the enemy name window
@status_window2 = Window_BattleStatus_enemy.new
@action_battlers = []
@pre_action_battlers = []
@max_ct = 0
@countup = false
@ct_wait = 0
@action_count = 0
main_ctb
# Dispose the enemy name window
@status_window2.dispose
end
#--------------------------------------------------------------------------
# * Frame renewal
#--------------------------------------------------------------------------
alias ctb_update update
def update
# If battle event is running
if $game_system.battle_interpreter.running?
# Update interpreter
$game_system.battle_interpreter.update
# If a battler which is forcing actions doesn't exist
if $game_temp.forcing_battler == nil
# If battle event has finished running
unless $game_system.battle_interpreter.running?
# Rerun battle event set up if battle continues
unless judge
setup_battle_event
end
end
# If not after battle phase
if @phase != 5
# Refresh status window
@status_window.refresh
# Refresh enemy status window
@status_window2.refresh
end
end
else
if @ct_wait > 0
@ct_wait -= 1
else
update_ct
@ct_wait = PARA_CTB::CT_SKIP
end
end
# unless @actor_index == nil
# if @actor_index >= 0 && @active_battler != nil
# # Display cursor rect
# x = 0
# y = @actor_index * 32
# @status_window.cursor_rect.set(x, y, @status_window.contents.width, 32)
# else
# @status_window.cursor_rect.empty
# end
# end
ctb_update
end
#--------------------------------------------------------------------------
# * Start Pre-Battle Phase
#--------------------------------------------------------------------------
alias ctb_start_phase1 start_phase1
def start_phase1
# CT Initialization
initialize_ct
# Start of Count Rise
@countup = true
# Run original call
ctb_start_phase1
end
#--------------------------------------------------------------------------
# * Frame Update (pre-battle phase)
#--------------------------------------------------------------------------
def update_phase1
# Renew the enemy name list
@status_window2.refresh
# Determine win/loss situation
if judge
# If won or lost: end method
return
end
# Start actor command phase
start_phase3
end
#--------------------------------------------------------------------------
# * Start Party Command Phase
#--------------------------------------------------------------------------
def start_phase2
# Shift to phase 2
@phase = 2
# Set actor to non-selecting
@actor_index = -1
@active_battler = nil
# Enable party command window
@party_command_window.active = true
@party_command_window.visible = true
# Disable actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
# Clear main phase flag
$game_temp.battle_main_phase = false
# If impossible to input command
unless $game_party.inputable?
# Start main phase
start_phase4
end
end
#--------------------------------------------------------------------------
# * Frame Update (party command phase: escape)
#--------------------------------------------------------------------------
def update_phase2_escape
# Calculate enemy agility average
enemies_agi = 0
for enemy in $game_troop.enemies
if enemy.exist?
enemies_agi += enemy.agi
end
end
# Calculate actor agility average
actors_agi = 0
for actor in @pre_action_battlers
if actor.is_a?(Game_Actor) and actor.exist?
actors_agi += actor.agi
end
end
# Determine if escape is successful
if PARA_CTB::ESCAPEABLE < 0
success = true
else
success = rand(100) < PARA_CTB::ESCAPEABLE * 10 * actors_agi / enemies_agi
end
# If escape is successful
if success
# Play escape SE
$game_system.se_play($data_system.escape_se)
# Return to BGM before battle started
$game_system.bgm_play($game_temp.map_bgm)
# Clear the Battlers' CT
for battler in $game_party.actors
clear_ct(battler)
end
# Battle ends
battle_end(1)
# If escape is failure
else
# Set the "Escape Failure" message to the help window
@help_window.set_text(PARA_CTB::UNESCAPE_MES, 1)
# Clearing action and CT of the actor
pre_action_battlers = @pre_action_battlers.clone
for act in pre_action_battlers
if act.is_a?(Game_Actor)
declease_ct(act, 100-PARA_CTB::ACT_ESCAPE_CT)
act.current_action.clear
@pre_action_battlers.delete(act)
end
end
@party_command_window.visible = false
# Hide the help window
@help_window.visible = true
@wait_count = 20
# Start main phase
start_phase4
end
end
#--------------------------------------------------------------------------
# * Start Actor Command Phase
#--------------------------------------------------------------------------
def start_phase3
# Shift to phase 3
@phase = 3
# Set actor as unselectable
@actor_index = -1
@active_battler = nil
@actor_array_index = -1
# To command input of the following actor
if @pre_action_battlers != []
phase3_next_actor
else
start_phase4
end
end
#--------------------------------------------------------------------------
# * Go to Command Input for Next Actor
#--------------------------------------------------------------------------
def phase3_next_actor
# Loop
begin
# Actor blink effect OFF
if @active_battler != nil
@active_battler.blink = false
end
# If last actor
if @actor_array_index + 1 == @pre_action_battlers.size
# Start main phase
start_phase4
return
# The next in case of enemy
elsif $game_troop.enemies.include?(@pre_action_battlers[@actor_array_index + 1])
# Start main phase
start_phase4
return
end
# Advance actor index
@actor_array_index += 1
@actor_index = @pre_action_battlers[@actor_array_index].index
@active_battler = $game_party.actors[@actor_index]
# When the battle event is reserved,
if @active_battler.current_action.forcing
# Main phase start
start_phase4
return
end
@active_battler.blink = true
@active_battler.current_action.clear
# Once more if actor refuses command input
end until @active_battler.inputable?
# Set up actor command window
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# * Go to Command Input of Previous Actor
#--------------------------------------------------------------------------
def phase3_prior_actor
# Loop
begin
# Actor blink effect OFF
if @active_battler != nil
@active_battler.blink = false
end
# If first actor
if @actor_array_index <= 0
# Start party command phase
start_phase2
return
end
# Return to actor index
@actor_array_index -= 1
@actor_index = @pre_action_battlers[@actor_array_index].index
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
@active_battler.current_action.clear
# Once more if actor refuses command input
end until @active_battler.inputable?
# Set up actor command window
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# * Actor Command Window Setup
#--------------------------------------------------------------------------
alias phase3_setup_command_window_ctb phase3_setup_command_window
def phase3_setup_command_window
@actor_command_window.back_opacity = PARA_CTB::WINDOW_OPACITY
phase3_setup_command_window_ctb
if PARA_CTB::WINDOWPOS_CHANGE
# Set actor command window position
@actor_command_window.x = PARA_CTB::WINDOWPOS_X
@actor_command_window.y = PARA_CTB::WINDOWPOS_Y
# Way it does not hide in the status window
@actor_command_window.z = 9999
end
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase)
#--------------------------------------------------------------------------
def update_phase3
# If enemy arrow is enabled
if @enemy_arrow != nil
@countup = PARA_CTB::SELECT_WAIT ? false : true
update_phase3_enemy_select
# If actor arrow is enabled
elsif @actor_arrow != nil
@countup = PARA_CTB::SELECT_WAIT ? false : true
update_phase3_actor_select
# If skill window is enabled
elsif @skill_window != nil
@countup = PARA_CTB::SELECT_WAIT ? false : true
update_phase3_skill_select
# If item window is enabled
elsif @item_window != nil
@countup = PARA_CTB::SELECT_WAIT ? false : true
update_phase3_item_select
# If actor command window is enabled
elsif @actor_command_window.active
@countup = PARA_CTB::COMMAND_WAIT ? false : true
update_phase3_basic_command
end
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : basic command)
#--------------------------------------------------------------------------
alias ctb_update_phase3_basic_command update_phase3_basic_command
def update_phase3_basic_command
ctb_update_phase3_basic_command
# Change player order with the preset L & R keys
if Input.trigger?(PARA_CTB::CHANGE_NEXT)
shift_activer(1)
end
if Input.trigger?(PARA_CTB::CHANGE_LAST)
shift_activer(-1)
end
end
#--------------------------------------------------------------------------
# * Start Main Phase
#--------------------------------------------------------------------------
def start_phase4
# Shift to phase 4
@phase = 4
battler_count = $game_party.actors.size + $game_troop.enemies.size
if @action_count >= battler_count or $game_temp.battle_turn == 0
# Search all battle event pages
for index in 0...$data_troops[@troop_id].pages.size
# Get event page
page = $data_troops[@troop_id].pages[index]
# If this page span is [turn]
if page.span == 1
# Clear action completed flags
$game_temp.battle_event_flags[index] = false
end
end
# Turn count
$game_temp.battle_turn += 1
@action_count = 0
end
# Set actor as unselectable
@actor_index = -1
@active_battler = nil
# Enable party command window
@party_command_window.active = false
@party_command_window.visible = false
# Disable actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
# Set main phase flag
$game_temp.battle_main_phase = true
# Make enemy action
for enemy in $game_troop.enemies
unless enemy.current_action.forcing
enemy.make_action
end
end
# Make action orders
make_action_orders
# Shift to step 1
@phase4_step = 1
end
#--------------------------------------------------------------------------
# * Make Action Orders
#--------------------------------------------------------------------------
def make_action_orders
# Initialize @action_battlers array
@action_battlers = []
if @pre_action_battlers != []
for i in 0..@actor_array_index
# Add the actors to the @action_battle array
@action_battlers.push(@pre_action_battlers[0])
@pre_action_battlers.shift
end
if @pre_action_battlers.size != 0
loop do
if $game_troop.enemies.include?(@pre_action_battlers[0])
# Add the enemies to the @action_battle array
@action_battlers.push(@pre_action_battlers[0])
@pre_action_battlers.shift
else
break
end
end
end
end
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 1 : action preparation)
#--------------------------------------------------------------------------
alias ctb_update_phase4_step1 update_phase4_step1
def update_phase4_step1
@countup = true
# Hide the help window
@help_window.visible = false
# Determine win/loss situation
if judge
# If won or lost: end method
return
end
# If no actionless battlers exist (all have performed an action)
if @action_battlers.size == 0
# Start actor command phase
start_phase3
return
end
ctb_update_phase4_step1
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 2 : start action)
#--------------------------------------------------------------------------
alias ctb_update_phase4_step2 update_phase4_step2
def update_phase4_step2
# If not a forcing action
unless @active_battler.current_action.forcing
# If restriction is [cannot perform action]
if @active_battler.restriction == 4
# Clear the CT
clear_ct(@active_battler)
# Clear battler being forced into action
$game_temp.forcing_battler = nil
# Shift to step 1
@phase4_step = 1
return
end
end
# Determines if CT Gauge is filled during animation
@countup = PARA_CTB::ANIMATION_WAIT ? false : true
ctb_update_phase4_step2
end
#--------------------------------------------------------------------------
# * Make Basic Action Results
#--------------------------------------------------------------------------
alias make_basic_action_result_ctb make_basic_action_result
def make_basic_action_result
# If doing nothing
if @active_battler.current_action.basic == 3
# Clear the battler's CT
clear_ct(@active_battler)
# Clear battler being forced into action
$game_temp.forcing_battler = nil
# Shift to step 1
@phase4_step = 1
return
end
make_basic_action_result_ctb
end
#--------------------------------------------------------------------------
# * Make Skill Action Results
#--------------------------------------------------------------------------
def make_skill_action_result
# Get skill
@skill = $data_skills[@active_battler.current_action.skill_id]
# If not a forcing action
unless @active_battler.current_action.forcing
# If unable to use due to SP running out
unless @active_battler.skill_can_use?(@skill.id)
# Clear battler being forced into action
$game_temp.forcing_battler = nil
# Clear the CT
declease_ct(@active_battler,100-PARA_CTB::ACT_SKILL_CT)
# Shift to step 1
@phase4_step = 1
return
end
end
# Use up SP
@active_battler.sp -= @skill.sp_cost
# Refresh status window
@status_window.refresh
# Show skill name on help window
@help_window.set_text(@skill.name, 1)
# Set animation ID
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
# Set command event ID
@common_event_id = @skill.common_event_id
# Set target battlers
set_target_battlers(@skill.scope)
# Apply skill effect
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
end
#--------------------------------------------------------------------------
# * Make Item Action Results
#--------------------------------------------------------------------------
alias ctb_make_item_action_result make_item_action_result
def make_item_action_result
# Get item
@item = $data_items[@active_battler.current_action.item_id]
# If unable to use due to items running out
unless $game_party.item_can_use?(@item.id)
# Clear the CT
declease_ct(@active_battler,100-PARA_CTB::ACT_ITEM_CT)
# Shift to step 1
@phase4_step = 1
return
end
ctb_make_item_action_result
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 5 : damage display)
#--------------------------------------------------------------------------
alias update_phase4_step5_ctb update_phase4_step5
def update_phase4_step5
# Display damage
for target in @target_battlers
if target.damage != nil
target.movable_backup = target.movable?
end
end
update_phase4_step5_ctb
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 6 : refresh)
#--------------------------------------------------------------------------
alias update_phase4_step6_ctb update_phase4_step6
def update_phase4_step6
@active_battler.countup = true
if @active_battler.current_action.basic == 1
# Defense
declease_ct(@active_battler,100-PARA_CTB::ACT_GUARD_CT)
else
case @active_battler.current_action.kind
# Attack
when 0
declease_ct(@active_battler,100-PARA_CTB::ACT_ATTACK_CT)
# Skill
when 1
declease_ct(@active_battler,100-PARA_CTB::ACT_SKILL_CT)
# Item
when 2
declease_ct(@active_battler,100-PARA_CTB::ACT_ITEM_CT)
else
clear_ct(@active_battler)
end
end
# Clear the CT if the battler is incapacitated
for target in @target_battlers
if target.movable? == false and target.movable_backup == true
clear_ct(target)
@status_window.refresh_ct
end
end
update_phase4_step6_ctb
# Renew the Enemy Name List
@status_window2.refresh
# Clearing action
if @active_battler.guarding? == false
@active_battler.current_action.clear
end
end
#--------------------------------------------------------------------------
# * Start After Battle Phase
#--------------------------------------------------------------------------
alias ctb_start_phase5 start_phase5
def start_phase5
@countup = false
ctb_start_phase5
end
end

#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
# This window displays the status of all party members on the battle screen.
#==============================================================================

class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(160, 320, 480, 160)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = PARA_CTB::WINDOW_MAIN_OPACITY
@level_up_flags = [false, false, false, false]
@before_hp = []
@before_sp = []
@before_states = []
@now_hp = []
@now_sp = []
@now_states = []
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# @item_max = $game_party.actors.size
#=begin
for i in 0...$game_party.actors.size
actor = $game_party.actors
line_height = 96 / PARA_CTB::PARTY_SIZE
actor_y = i * line_height + 4
# Present status in arrangement
@now_hp = actor.hp
@now_sp = actor.sp
@now_states = actor.states
# If leveling up
if @level_up_flags
self.contents.fill_rect(340+((actor.index%2)*16), actor_y+20, 100, 8, Color.new(0, 0, 0, 0))
self.contents.font.color = normal_color
self.contents.draw_text(344+((actor.index%2)*16), actor_y+20-PARA_CTB::NAME_FONT_SIZE, 120, 32, "LEVEL UP!")
end
end
#=end
# Light weight conversion processing of battle status
# When arrangement of status changes only, drawing processing
if @before_hp == nil or @before_sp == nil or @before_states == nil or
@before_hp != @now_hp or @before_sp != @now_sp or @before_states != @now_states
self.contents.clear
for j in 0...$game_party.actors.size
actor = $game_party.actors[j]
# line_height = 96 / PARA_CTB::PARTY_SIZE
actor_y = j * line_height + 4
self.contents.font.size = PARA_CTB::NAME_FONT_SIZE
# Draw Actor Name
draw_actor_name(actor, 4+48+((actor.index%2)*16), actor_y+4+16-PARA_CTB::NAME_FONT_SIZE)
# Draw HP
hp_color1 = PARA_CTB::HP_COLOR_LEFT
hp_color2 = PARA_CTB::HP_COLOR_RIGHT
draw_meter(actor.hp, actor.maxhp, 102+20+((actor.index%2)*16), actor_y+16+4, 80, 8, hp_color1, hp_color2)
# draw_actor_hp(actor, 102, actor_y+16-PARA_CTB::HPSP_FONT_SIZE, 100)
draw_actor_hp(actor, 102+((actor.index%2)*16), actor_y+16+4-PARA_CTB::HPSP_FONT_SIZE, 100)
# Draw SP
sp_color1 = PARA_CTB::SP_COLOR_LEFT
sp_color2 = PARA_CTB::SP_COLOR_RIGHT
draw_meter(actor.sp, actor.maxsp, 222+20+((actor.index%2)*16), actor_y+4+16, 80, 8, sp_color1, sp_color2)
draw_actor_sp(actor, 222+((actor.index%2)*16), actor_y+4+16-PARA_CTB::HPSP_FONT_SIZE, 100)
# Status after the changing in arrangement
@before_hp[j] = actor.hp
@before_sp[j] = actor.sp
@before_states[j] = actor.states
# If Leveling up
# if @level_up_flags[j]
# self.contents.fill_rect(344, actor_y, 100, 8, Color.new(0, 0, 0, 0))
# self.contents.font.color = normal_color
# self.contents.draw_text(344, actor_y, 120, 32, "LEVEL UP!")
# end
end
end
refresh_ct
end
#--------------------------------------------------------------------------
# * Refresh the CT Gauge
#--------------------------------------------------------------------------
def refresh_ct
for i in 0...$game_party.actors.size
actor = $game_party.actors
line_height = 96 / PARA_CTB::PARTY_SIZE
actor_y = i * line_height + 4
# When the CT gauge is full, color of gauge
ct_color_full = PARA_CTB::COLOR_FULL
# Color of CT gauge (left hand edge)
ct_color_start = actor.full_ct ? ct_color_full : PARA_CTB::COLOR_LEFT
# Color of CT gauge (right hand edge)
ct_color_end = actor.full_ct ? ct_color_full : PARA_CTB::COLOR_RIGHT
if @level_up_flags != true and actor.ct_visible
draw_meter(actor.now_ct, actor.max_ct, 344-3+((actor.index%2)*16), actor_y+4+16, 80, 8, ct_color_start, ct_color_end)
elsif @level_up_flags != true
draw_meter(0, actor.max_ct, 344-3+((actor.index%2)*16), actor_y+4+16, 80, 8, ct_color_start, ct_color_end)
end
end
end
#--------------------------------------------------------------------------
# * Frame Renewal
#--------------------------------------------------------------------------
def update
super
end
#--------------------------------------------------------------------------
# * Draw HP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y, width = 144)
# Draw the "HP" text
self.contents.font.color = system_color
self.contents.font.size = 16
self.contents.draw_text(x, y+2, 32, 32, $data_system.words.hp)
self.contents.font.color = normal_color
self.contents.font.size = PARA_CTB::HPSP_FONT_SIZE
# x-=23
if PARA_CTB::MAX_DRAW
# Draw the MaxHP
self.contents.draw_text(x, y, width, 32, actor.maxhp.to_s, 2)
text_size = self.contents.text_size(actor.maxhp.to_s)
text_x = x + width - text_size.width - 12
self.contents.draw_text(text_x, y, 12, 32, "/", 1)
# Draw the HP
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
text_x = text_x - text_size.width
self.contents.draw_text(text_x, y, text_size.width, 32, actor.hp.to_s, 2)
else
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(x, y, width, 32, actor.hp.to_s, 2)
end
end
#--------------------------------------------------------------------------
# * Draw SP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
def draw_actor_sp(actor, x, y, width = 144)
# Draw the "SP" text
self.contents.font.color = system_color
self.contents.font.size = 16
self.contents.draw_text(x, y+2, 32, 32, $data_system.words.sp)
self.contents.font.color = normal_color
self.contents.font.size = PARA_CTB::HPSP_FONT_SIZE
# x-=23
if PARA_CTB::MAX_DRAW
# Draw the MaxSP
self.contents.draw_text(x, y, width, 32, actor.maxsp.to_s, 2)
text_size = self.contents.text_size(actor.maxsp.to_s)
text_x = x + width - text_size.width - 12
self.contents.draw_text(text_x, y, 12, 32, "/", 1)
# Draw the SP
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
text_x = text_x - text_size.width
self.contents.draw_text(text_x, y, text_size.width, 32, actor.sp.to_s, 2)
else
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(x, y, width, 32, actor.sp.to_s, 2)
end
end
end

#==============================================================================
# ** Window_BattleStatus_enemy
#------------------------------------------------------------------------------
# This window displays the status of all enemy troops on the battle screen.
#==============================================================================

class Window_BattleStatus_enemy < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 320, 160, 160)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = PARA_CTB::WINDOW_MAIN_OPACITY
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = PARA_CTB::ENEMY_FONT_SIZE
@exist_enemies = []
if $game_troop.enemies != nil
if PARA_CTB::ENEMY_GROUPING
enemy_list = []
enemy_list_index = []
# Loop through the Enemy Troop
for i in 0...$game_troop.enemies.size
enemy = $game_troop.enemies
if enemy.exist?
@exist_enemies.push(enemy)
if enemy_list.include?(enemy.name)
enemy_list_index[enemy_list.index(enemy.name)] += 1
# enemy_list_index+= 1
else
# Store the enemy name
enemy_list.push(enemy.name)
enemy_list_index[enemy_list.index(enemy.name)] = 1
end
end
end
# Draw the name and number of the enemy
for i in 0...enemy_list.size
for j in 0...enemy_list_index
enemy_y= 4+ 32*j
name ="#{enemy_list} #{j+1}"
self.contents.draw_text(4+((j%2)*16), enemy_y+16-PARA_CTB::HPSP_FONT_SIZE, 160, 20, name)
if PARA_CTB::ENEMY_DRAWING_MATER == 1
hp_color1 = PARA_CTB::HP_COLOR_LEFT
hp_color2 = PARA_CTB::HP_COLOR_RIGHT
y = enemy_y
draw_meter(enemy.hp, enemy.maxhp, 4+((j%2)*16), y+4+16, 80, 8, hp_color1, hp_color2)
end
end
end
else
# Draw the enemy name
enemy_index = 0
for i in 0...$game_troop.enemies.size
enemy = $game_troop.enemies
if enemy.exist?
@exist_enemies.push(enemy)
line_height = PARA_CTB::ENEMY_FONT_SIZE + 6
if PARA_CTB::ENEMY_DRAWING_MATER != 0
line_height += 10
end
enemy_y = enemy_index * line_height + 4
self.contents.draw_text(4+((enemy_index%2)*16), enemy_y+4+16, 160, 20, enemy.name)
enemy_index += 1
if PARA_CTB::ENEMY_DRAWING_MATER == 1
hp_color1 = PARA_CTB::HP_COLOR_LEFT
hp_color2 = PARA_CTB::HP_COLOR_RIGHT
y = enemy_y
draw_meter(enemy.hp, enemy.maxhp, 4+((enemy_index%2)*20), y+4+16, 80, 8, hp_color1, hp_color2)
end
end
end
end
end
refresh_ct
end
#draw_actor_sp(actor, 222+((actor.index%2)*16), actor_y+4+16-PARA_CTB::HPSP_FONT_SIZE, 100)

#--------------------------------------------------------------------------
# * Refresh the CT gauge
#--------------------------------------------------------------------------
def refresh_ct
if PARA_CTB::ENEMY_DRAWING_MATER == 2 and @exist_enemies != nil
enemy_index = 0
for enemy in @exist_enemies
line_height = PARA_CTB::ENEMY_FONT_SIZE + 16
enemy_y = enemy_index * line_height + 4
y = enemy_y
# When the CT gauge is full, color of gauge
ct_color_full = PARA_CTB::COLOR_FULL
# Color of CT gauge (the left edge)
ct_color_start = enemy.full_ct ? ct_color_full : PARA_CTB::COLOR_LEFT
# Color of CT gauge (the right edge)
ct_color_end = enemy.full_ct ? ct_color_full : PARA_CTB::COLOR_RIGHT
if enemy.ct_visible
draw_meter(enemy.now_ct, enemy.max_ct, 4+((enemy_index%2)*16), y+20, 100, 8, ct_color_start, ct_color_end)
else
draw_meter(0, enemy.max_ct, 4+((enemy_index%2)*16), y+20, 100, 8, ct_color_start, ct_color_end)
end
enemy_index += 1
end
end
end
end

#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================

class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw the meter
#--------------------------------------------------------------------------
def draw_meter(now, max, x, y, width, height, start_color, end_color=start_color )
self.contents.fill_rect(x, y, width, height, PARA_CTB::FRAME_COLOR)
self.contents.fill_rect(x+PARA_CTB::FRAME_BORDER, y+PARA_CTB::FRAME_BORDER, width-
PARA_CTB::FRAME_BORDER*2, height-PARA_CTB::FRAME_BORDER*2, PARA_CTB::BACK_COLOR)
now = now > max ? max : now
percentage = max != 0 ? (width-2) * now / max.to_f : 0
if start_color == end_color
self.contents.fill_rect(x+1, y+1, percentage, height-2, start_color)
else
for i in 1..percentage
r = start_color.red + (end_color.red - start_color.red) / percentage * i
g = start_color.green + (end_color.green - start_color.green) / percentage * i
b = start_color.blue + (end_color.blue - start_color.blue) / percentage * i
a = start_color.alpha + (end_color.alpha - start_color.alpha) / percentage * i
self.contents.fill_rect(x+i, y+1, 1, height-2, Color.new(r, g, b, a))
end
end
end
end

#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass for the Game_Actor
# and Game_Enemy classes.
#==============================================================================

class Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :max_ct
attr_accessor :now_ct
attr_accessor :full_ct
attr_accessor :countup
attr_accessor :ct_visible
attr_accessor :movable_backup
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias ctb_initialize initialize
def initialize
ctb_initialize
@max_ct = 0
@now_ct = 0
@full_ct = false
@countup = true
@ct_visible = true
end
end

#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
# This sprite is used to display the battler.It observes the Game_Character
# class and automatically changes sprite conditions.
#==============================================================================

class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias ctb_update update
def update
ctb_update
if @battler != nil
if @battler.full_ct and @battler.ct_visible
# Change the color tone of the battler when the CT Gauge is full
fullct_color = PARA_CTB::FULL_CT_COLOR
self.tone = fullct_color
else
fullct_color = Tone.new(0,0,0)
self.tone = fullct_color
end
end
end
end

#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================

class Window_Help < Window_Base
#--------------------------------------------------------------------------
# * Set Actor
# actor : status displaying actor
#--------------------------------------------------------------------------
alias set_actor_ctb set_actor
def set_actor(actor)
if PARA_CTB::HELP_DRAWING_MATER_ACTOR
self.contents.clear
draw_actor_name(actor, 4, 0)
draw_actor_state(actor, 140, 0)
hp_color1 = PARA_CTB::HP_COLOR_LEFT
hp_color2 = PARA_CTB::HP_COLOR_RIGHT
draw_meter(actor.hp, actor.maxhp, 316, 18, 112, 8, hp_color1, hp_color2)
draw_actor_hp(actor, 284, 0)
sp_color1 = PARA_CTB::SP_COLOR_LEFT
sp_color2 = PARA_CTB::SP_COLOR_RIGHT
draw_meter(actor.sp, actor.maxsp, 492, 18, 112, 8, sp_color1, sp_color2)
draw_actor_sp(actor, 460, 0)
@actor = actor
@text = nil
self.visible = true
else
set_actor_ctb(actor)
end
end
#--------------------------------------------------------------------------
# * Set Enemy
# enemy : name and status displaying enemy
#--------------------------------------------------------------------------
alias set_enemy_ctb set_enemy
def set_enemy(enemy)
if PARA_CTB::HELP_DRAWING_MATER_ENEMY
self.contents.clear
draw_actor_name(enemy, 4, 0)
draw_actor_state(enemy, 140, 0)
hp_color1 = PARA_CTB::HP_COLOR_LEFT
hp_color2 = PARA_CTB::HP_COLOR_RIGHT
draw_meter(enemy.hp, enemy.maxhp, 316, 18, 112, 8, hp_color1, hp_color2)
draw_actor_hp(enemy, 284, 0)
sp_color1 = PARA_CTB::SP_COLOR_LEFT
sp_color2 = PARA_CTB::SP_COLOR_RIGHT
draw_meter(enemy.sp, enemy.maxsp, 492, 18, 112, 8, sp_color1, sp_color2)
draw_actor_sp(enemy, 460, 0)
self.visible = true
else
set_enemy_ctb(enemy)
end
end
end

:

Fixed the error.

Edited by Saltome

Share this post


Link to post
Share on other sites

That's odd, I haven't even changed that line.

Go to the script and find the line, it should say

@enemy_sprites<<Sprite_Battler.new(@viewport1, enemy)

 

if that's the case, try changing it to:

@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))

Edited by Saltome

Share this post


Link to post
Share on other sites

It's 

@enemy_sprites< end  :dizzy:

I should really learn to script... or at least to understand what the hell it all means.

 

Edit:

Scratch that! With that solve comes a new problem. Line 198 is now throwing up an error >;[

 

@actor_sprites< end
Edited by Tenoukii

Share this post


Link to post
Share on other sites

... Maaaark! Can I yell at you now?

That's in fact an error. I recall the website chat cuts off messages that contain <<

I believe that's what happened in this case too, when I copied the script to the website it must have deleted the parts after <<, which screwed the whole script up.

 

Go back to line 194 and change it to

@enemy_sprites<<Sprite_Battler.new(@viewport1, enemy)

 

For the new error change it's line to

@actor_sprites<<Sprite_Battler.new(@viewport2)

 

Yeah you should learn scripting but it's not something you do in a day.

Share this post


Link to post
Share on other sites

This script and I just weren't meant to be! :(

Line 219 which literally says End is now throwing an error into the mix!

Share this post


Link to post
Share on other sites

You must be missing an end somewhere .

Go to line 193 the next few lines should look like this:

 

    for enemy in $game_troop.enemies.reverse
      @enemy_sprites<<Sprite_Battler.new(@viewport1, enemy)
    end
    # Make actor sprites
    @actor_sprites=[]
    for actor in $game_party.actors
      @actor_sprites<<Sprite_Battler.new(@viewport2)
    end

 

You probably deleted one or both of those ends, when fixing the other mess, add them in.

Or you can just copy the whole addon from my earlier post since I fixed the mistake there.

Edited by Saltome

Share this post


Link to post
Share on other sites

Yay! That script is fixed... Wait for it, wait forrrr it...

Another error. This time on Spriteset_Battle.

Line 97, undefined method for 'battler=' for nil Nil:Class

Share this post


Link to post
Share on other sites

... oopsie, that's kinda my fault. Shame on you for trying to have less than 4 party members at all times. :L

Ironically enough the error is still in the addon, it just doesn't realize that there is one until it gets to the spriteset script.

 

To fix it go to line 199 of the addon script.

It should look like this.

for actor in $game_party.actors

Change it to this.

for i in 0...PARA_CTB::PARTY_SIZE

 

Fixed it in the earlier post too...again.

Edited by Saltome

Share this post


Link to post
Share on other sites

Woo! All is working, and I'd say it was well worth the hassle... well, worth it for me since it was my request at least :P

Thankyouuu! You shall be credited and hopefully bothered less by me xD 

Share this post


Link to post
Share on other sites

Well I finished incorporating the skill learning system into the xmb menu.

 

It seems that the forum is a bit unwilling when it comes to taking more than 8 thousand lines of code and cramming them into a single post, so I'll just upload a project with the scripts you need to copy.

http://www.gdunlimited.net/media/uploads/manager/sls-23914.zip

Share this post


Link to post
Share on other sites

Thankyouu ^^ I'll let you know of any errors :)

 

EDIT: Couple of questions! What would I need to get rid of to remove the Switch bit in the menu? And Where do I find all the bits to change where it says "Body Armour" to just "Armour"? It's doing my head in that that is a different size to the rest of it because of the length x(

Duhhh! Moron over here didn't look in the database properly. Yes, I feel stupid xD

Edited by Tenoukii

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...