#==============================================================================
# ** Advanced Item Grid Menu
#------------------------------------------------------------------------------
# Constance
# 11.4.06 - Version: 1.1
# 15MAR11 - Version: 1.2 - Brewmeister
# Fixed to calculate all positions of icons & cursor from
# @column_max & @rows in the Window_Item class. (line 184)
#==============================================================================
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
#SDK.log('Advanced Item Grid Menu', 'Constance', 1.0, '11.4.06')
#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
#if SDK.state('Advanced Item Grid Menu') == true
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Level2
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_level2(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Lv:")
self.contents.font.color = normal_color
self.contents.draw_text(x + 16, y, 24, 32, actor.level.to_s, 2)
end
end
#==============================================================================
# ** Window_Grid_Dummy
#------------------------------------------------------------------------------
# Dummy Window for viewing the real grid.
#==============================================================================
class Window_Grid_Dummy < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 64, 352, 416)
self.contents = Bitmap.new(width - 32, height - 32)
end
end #of class
#==============================================================================
# ** Window_Statistics
#------------------------------------------------------------------------------
# Window for the statistics window for each item.
#==============================================================================
class Window_Statistics < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(352, 64, 288, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Sylfaen"
end
end #of class
#==============================================================================
# ** Window_Welcome
#------------------------------------------------------------------------------
# Window for the welcome at the top.
#==============================================================================
class Window_Welcome < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Sylfaen"
end
end #of class
#==============================================================================
# ** Window_Selectable2
#------------------------------------------------------------------------------
# This class is the same as Window_Selectable but changes cursor properties for
# the grid only.
#==============================================================================
class Window_Selectable2 < Window_Selectable
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
# If cursor position is less than 0
if @index < 0
self.cursor_rect.empty
return
end
# Get current row
row = @index / @column_max
# If current row is before top row
if row < self.top_row
# Scroll so that current row becomes top row
self.top_row = row
end
# If current row is more to back than back row
if row > self.top_row + (self.page_row_max - 1)
# Scroll so that current row becomes back row
self.top_row = row - (self.page_row_max - 1)
end
# Calculate cursor width
cursor_width = (self.width - 32) / @column_max
cursor_height = (self.height - 32) / @rows
# Calculate cursor coordinates
x = @index % @column_max * (cursor_width)
y = @index / @column_max * cursor_height - self.oy
# Update cursor rectangle
self.cursor_rect.set(x, y, cursor_width, cursor_height)
end
#--------------------------------------------------------------------------
# * Get Top Row
#--------------------------------------------------------------------------
def top_row
# Divide y-coordinate of window contents transfer origin by 1 row
# height of 32
return self.oy / ((self.height - 32) / @rows)
end
#--------------------------------------------------------------------------
# * Set Top Row
# row : row shown on top
#--------------------------------------------------------------------------
def top_row=(row)
# If row is less than 0, change it to 0
if row < 0
row = 0
end
# If row exceeds row_max - 1, change it to row_max - 1
if row > row_max - 1
row = row_max - 1
end
# Multiply 1 row height by 32 for y-coordinate of window contents
# transfer origin
self.oy = row * (self.height - 32) / @rows
end
#--------------------------------------------------------------------------
# * Get Number of Rows Displayable on 1 Page
#--------------------------------------------------------------------------
def page_row_max
# Subtract a frame height of 32 from the window height, and divide it by
# 1 row height of 32
return @rows
end
end
#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
# The Item Grid Window. Based off a 10 column coding.
#==============================================================================
class Window_Item < Window_Selectable2
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :item
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 64, 352, 416)
self.opacity = 0
################################
# #
@column_max = 4
@rows = 4
# #
################################
refresh
self.index = 0
# If in battle, move window to center of screen
# and make it semi-transparent
if $game_temp.in_battle
self.x = 144
self.y = 64
self.back_opacity = 250
end
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Add item
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
# Also add weapons and items if outside of battle
unless $game_temp.in_battle
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
end
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
row_height = (self.height - 32) / @rows
self.contents = Bitmap.new(width - 32, row_max * row_height)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
row_height = (self.height - 32) / @rows
x = index % @column_max * (self.width - 32) / @column_max
y = index / @column_max * row_height + ((row_height - 24)/2)
rect = Rect.new(x, y, (self.width - 32) / @column_max, row_height)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24), opacity)
width = [rect.width - 24, 32].min
self.contents.draw_text(x + 24, y, width, 32, number.to_s, 1)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end #of class
#==============================================================================
# ** Window_Target
#------------------------------------------------------------------------------
# This window selects a use target for the actor on item and skill screens.
#==============================================================================
class Window_Target < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(202, 170, 288, 160)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Sylfaen"
self.z += 10
@item_max = $game_party.actors.size
@column_max = 4
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
self.contents.clear
for i in 0...$game_party.actors.size
x = 10 + i * 60
y = 0
actor = $game_party.actors[i]
draw_actor_name(actor, x, y)
draw_actor_graphic(actor, x + 20, y + 80)
draw_actor_level2(actor, x, y + 66)
end
actor = $game_party.actors[self.index]
x = 0
y = 0
draw_actor_hp(actor, x + 60, y + 86)
draw_actor_sp(actor, x + 60, y + 106)
# Cursor position -1 = all choices, -2 or lower = independent choice
# (meaning the user's own choice)
if @index <= -2
self.cursor_rect.set(0, (@index + 10) * 60, 60, 96)
elsif @index == -1
self.cursor_rect.set(0, 0, 60, @item_max * 116 - 20)
else
self.cursor_rect.set(@index * 60, 0, 60, 96)
end
end
end
#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
# This class performs item screen processing.
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make help window
@help_window = Window_Help.new
@help_window.z = -10
# Make grid window
@item_window = Window_Item.new
# Associate help window
@item_window.help_window = @help_window
# Make dummy grid window
@dummy_window = Window_Grid_Dummy.new
# Make dummy statistics window
@statistics_window = Window_Statistics.new
# Make target window
@target_window = Window_Target.new
@target_window.active = false
@target_window.visible = false
# Make welcome window
@welcome_window = Window_Welcome.new
# Draw welcome text
@welcome_window.contents.draw_text(0, 0, 255, 32, "Welcome to the Your Inventory Screen.", 1)
# 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
@welcome_window.dispose
@help_window.dispose
@item_window.dispose
@dummy_window.dispose
@statistics_window.dispose
@target_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@welcome_window.update
@help_window.update
@item_window.update
@target_window.update
# If grid window is active: call update_item
if @item_window.active
update_item
update_stats
return
end
# If target window is active: call update_target
if @target_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# * Stats Text Update
# -- If Item = Item -> Item_Values
# -- If Item = Weapon -> Weapon_Values
# -- If Item = Armor -> Armor_Values
#--------------------------------------------------------------------------
def update_stats
@x, @y = 0, 0
@statistics_window.contents.clear
if @item_window.item != 0
@item = @item_window.item
update_item
elsif @grid_widnow.item = 0
@statistics_window.contents.clear
end
case @item
when RPG::Item
number = $game_party.item_number(@item.id)
update_item_values
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
update_weapon_values
when RPG::Armor
number = $game_party.armor_number(@item.id)
update_armor_values
end
end
#--------------------------------------------------------------------------
# * Update Item Values
#--------------------------------------------------------------------------
def update_item_values
# Clear Window
@statistics_window.contents.clear
# Create Default Word Values
@hp_word = $data_system.words.hp
@sp_word = $data_system.words.sp
@str_word = $data_system.words.str
@dex_word = $data_system.words.dex
@agi_word = $data_system.words.agi
@int_word = $data_system.words.int
@atk_word = $data_system.words.atk
@pdef_word = $data_system.words.pdef
@mdef_word = $data_system.words.mdef
@guard_word = $data_system.words.guard
# Create Stats
@statistics_window.contents.font.color = Color.new(192, 224, 255, 255)
@statistics_window.contents.font.bold = true
@statistics_window.contents.draw_text(@x, @y, 212, 32, "Name: ", 0)
@statistics_window.contents.draw_text(@x, @y + 42, 212, 32, "Description:", 0)
@statistics_window.contents.draw_text(@x, @y + 106, 212, 32, "Item Type: ", 0)
@statistics_window.contents.draw_text(@x, @y + 140, 212, 32, "Statistics: ", 0)
@statistics_window.contents.font.bold = false
@statistics_window.contents.font.color = Color.new(255, 255, 255, 255)
@statistics_window.contents.draw_text(@x + 60, @y, 212, 32, @item.name, 0)
@statistics_window.contents.draw_text(@x, @y + 62, 252, 32, @item.description, 0)
@statistics_window.contents.draw_text(@x + 95, @y + 106, 212, 32, "Item", 0)
# Main Words
@statistics_window.contents.font.color = Color.new(192, 224, 255, 255)
@statistics_window.contents.draw_text(@x, @y + 165, 212, 32, "Enhancements: ", 0)
@statistics_window.contents.draw_text(@x, @y + 185, 212, 32, "Range: ", 0)
@statistics_window.contents.draw_text(@x, @y + 205, 212, 32, "Recovery: ", 0)
@statistics_window.contents.draw_text(@x, @y + 225, 212, 32, "Elements: ", 0)
@statistics_window.contents.draw_text(@x, @y + 245, 212, 32, "Status Effects: ", 0)
# Values
@statistics_window.contents.font.color = Color.new(255, 255, 255, 255)
# Enhancements
parameter = @item.parameter_type
case parameter
when 0
@statistics_window.contents.draw_text(@x + 108, @y + 165, 212, 32, "None", 0)
when 1
@statistics_window.contents.draw_text(@x + 108, @y + 165, 212, 32, "Max #{@hp_word} + " + @item.parameter_points.to_s, 0)
when 2
@statistics_window.contents.draw_text(@x + 108, @y + 165, 212, 32, "Max #{@sp_word} + " + @item.parameter_points.to_s, 0)
when 3
@statistics_window.contents.draw_text(@x + 108, @y + 165, 212, 32, "#{@str_word} + " + @item.parameter_points.to_s, 0)
when 4
@statistics_window.contents.draw_text(@x + 108, @y + 165, 212, 32, "#{@dex_word} + " + @item.parameter_points.to_s, 0)
when 5
@statistics_window.contents.draw_text(@x + 108, @y + 165, 212, 32, "#{@agi_word} + " + @item.parameter_points.to_s, 0)
when 6
@statistics_window.contents.draw_text(@x + 108, @y + 165, 212, 32, "#{@int_word} + " + @item.parameter_points.to_s, 0)
end
# Range
scope = @item.scope
case scope
when 0
@statistics_window.contents.draw_text(@x + 110, @y + 185, 212, 32, "None", 0)
when 1
@statistics_window.contents.draw_text(@x + 92, @y + 185, 212, 32, "One Enemy", 0)
when 2
@statistics_window.contents.draw_text(@x + 92, @y + 185, 212, 32, "All Enemies", 0)
when 3
@statistics_window.contents.draw_text(@x + 92, @y + 185, 212, 32, "One Ally", 0)
when 4
@statistics_window.contents.draw_text(@x + 92, @y + 185, 212, 32, "All Allies", 0)
when 5
@statistics_window.contents.draw_text(@x + 92, @y + 185, 212, 32, "One Ally", 0)
when 6
@statistics_window.contents.draw_text(@x + 92, @y + 185, 212, 32, "All Allies", 0)
when 7
@statistics_window.contents.draw_text(@x + 92, @y + 185, 212, 32, "This User", 0)
end
# HP
hp_recover = @item.recover_hp
if @item.recover_hp == 0
hp_recover = "0"
end
if @item.recover_sp == 0
sp_recover = "0"
end
@statistics_window.contents.font.color = Color.new(255, 255, 255, 255)
@statistics_window.contents.draw_text(@x + 110, @y + 205, 212, 32, hp_recover.to_s + " HP", 0)
# SP
sp_recover = @item.recover_sp
@statistics_window.contents.font.color = Color.new(255, 255, 255, 255)
@statistics_window.contents.draw_text(@x + 180, @y + 205, 212, 32, sp_recover.to_s + " SP", 0)
# Create Elements
element = ""
flag = false
for i in @item.element_set
if flag
element += ", "
end
element += $data_system.elements[i]
flag = true
end
if element == ""
element = "None"
end
# Create Status Effects
status = ""
flag = false
for i in @item.plus_state_set
if flag
status += ", "
end
status += $data_states[i].name
flag = true
end
if status == ""
status = "None"
end
# Draw Element And Status Effects
@statistics_window.contents.draw_text(@x + 110, @y + 230, 420, 24, element, 0)
@statistics_window.contents.draw_text(@x + 110, @y + 250, 420, 24, status, 0)
end
#--------------------------------------------------------------------------
# * Update Weapon Values
#--------------------------------------------------------------------------
def update_weapon_values
@statistics_window.contents.clear
@statistics_window.contents.font.color = Color.new(192, 224, 255, 255)
@statistics_window.contents.font.bold = true
@statistics_window.contents.draw_text(@x, @y, 212, 32, "Name: ", 0)
@statistics_window.contents.draw_text(@x, @y + 42, 212, 32, "Description:", 0)
@statistics_window.contents.draw_text(@x, @y + 106, 212, 32, "Item Type: ", 0)
@statistics_window.contents.draw_text(@x, @y + 140, 212, 32, "Statistics: ", 0)
@statistics_window.contents.font.bold = false
@statistics_window.contents.font.color = Color.new(255, 255, 255, 255)
@statistics_window.contents.draw_text(@x + 60, @y, 212, 32, @item.name, 0)
@statistics_window.contents.draw_text(@x, @y + 62, 252, 32, @item.description, 0)
@statistics_window.contents.draw_text(@x + 95, @y + 106, 212, 32, "Weapon", 0)
# Main Words
@statistics_window.contents.font.color = Color.new(192, 224, 255, 255)
@statistics_window.contents.draw_text(@x, @y + 165, 212, 32, "#{@atk_word}: ", 0)
@statistics_window.contents.draw_text(@x, @y + 185, 212, 32, "#{@pdef_word}: ", 0)
@statistics_window.contents.draw_text(@x, @y + 205, 212, 32, "#{@mdef_word}: ", 0)
@statistics_window.contents.draw_text(@x, @y + 225, 212, 32, "#{@str_word}: ", 0)
@statistics_window.contents.draw_text(@x, @y + 245, 212, 32, "#{@dex_word}: ", 0)
@statistics_window.contents.draw_text(@x, @y + 265, 212, 32, "#{@agi_word}: ", 0)
@statistics_window.contents.draw_text(@x, @y + 285, 212, 32, "#{@int_word}: ", 0)
@statistics_window.contents.draw_text(@x, @y + 305, 212, 32, "Elements: ", 0)
@statistics_window.contents.draw_text(@x, @y + 325, 212, 32, "Status Effects: ", 0)
# Values
@statistics_window.contents.font.color = Color.new(255, 255, 255, 255)
# Attack
atk = @item.atk
@statistics_window.contents.draw_text(@x + 120, @y + 165, 212, 32, atk.to_s, 0)
# Physical Defense
pdef = @item.pdef
@statistics_window.contents.draw_text(@x + 120, @y + 185, 212, 32, pdef.to_s, 0)
# Magical Defense
mdef = @item.mdef
@statistics_window.contents.draw_text(@x + 120, @y + 205, 212, 32, mdef.to_s, 0)
# Strength
str_plus = @item.str_plus
@statistics_window.contents.draw_text(@x + 120, @y + 225, 212, 32, str_plus.to_s, 0)
# Dexterity
dex_plus = @item.dex_plus
@statistics_window.contents.draw_text(@x + 120, @y + 245, 212, 32, dex_plus.to_s, 0)
# Agility
agi_plus = @item.agi_plus
@statistics_window.contents.draw_text(@x + 120, @y + 265, 212, 32, agi_plus.to_s, 0)
# Intelligence
int_plus = @item.int_plus
@statistics_window.contents.draw_text(@x + 120, @y + 285, 212, 32, int_plus.to_s, 0)
# Create Elements
element = ""
flag = false
for i in @item.element_set
if flag
element += ", "
end
element += $data_system.elements[i]
flag = true
end
if element == ""
element = "None"
end
# Create Status Effects
status = ""
flag = false
for i in @item.plus_state_set
if flag
status += ", "
end
status += $data_states[i].name
flag = true
end
if status == ""
status = "None"
end
# Draw Element And Status Effects
@statistics_window.contents.draw_text(@x + 110, @y + 310, 420, 24, element, 0)
@statistics_window.contents.draw_text(@x + 110, @y + 330, 420, 24, status, 0)
end
#--------------------------------------------------------------------------
# * Update Armor Values
#--------------------------------------------------------------------------
def update_armor_values
@statistics_window.contents.clear
@statistics_window.contents.font.color = Color.new(192, 224, 255, 255)
@statistics_window.contents.font.bold = true
@statistics_window.contents.draw_text(@x, @y, 212, 32, "Name: ", 0)
@statistics_window.contents.draw_text(@x, @y + 42, 212, 32, "Description:", 0)
@statistics_window.contents.draw_text(@x, @y + 106, 212, 32, "Item Type: ", 0)
@statistics_window.contents.draw_text(@x, @y + 140, 212, 32, "Statistics: ", 0)
@statistics_window.contents.font.bold = false
@statistics_window.contents.font.color = Color.new(255, 255, 255, 255)
@statistics_window.contents.draw_text(@x + 60, @y, 212, 32, @item.name, 0)
@statistics_window.contents.draw_text(@x, @y + 62, 252, 32, @item.description, 0)
# Kind of Armor
kind_word = $data_system.words.send("armor#{@item.kind + 1}")
@statistics_window.contents.draw_text(@x + 95, @y + 106, 212, 32, "Armor -> #{kind_word}", 0)
# Main Words
@statistics_window.contents.font.color = Color.new(192, 224, 255, 255)
@statistics_window.contents.draw_text(@x, @y + 165, 212, 32, "#{@pdef_word}: ", 0)
@statistics_window.contents.draw_text(@x, @y + 185, 212, 32, "#{@mdef_word}: ", 0)
@statistics_window.contents.draw_text(@x, @y + 205, 212, 32, "EVA: ", 0)
@statistics_window.contents.draw_text(@x, @y + 225, 212, 32, "#{@str_word}: ", 0)
@statistics_window.contents.draw_text(@x, @y + 245, 212, 32, "#{@dex_word}: ", 0)
@statistics_window.contents.draw_text(@x, @y + 265, 212, 32, "#{@agi_word}: ", 0)
@statistics_window.contents.draw_text(@x, @y + 285, 212, 32, "#{@int_word}: ", 0)
@statistics_window.contents.draw_text(@x, @y + 305, 212, 32, "Guard Elements: ", 0)
@statistics_window.contents.draw_text(@x, @y + 325, 212, 32, "Guard Effects: ", 0)
# Values
@statistics_window.contents.font.color = Color.new(255, 255, 255, 255)
# Physical Defense
pdef = @item.pdef
@statistics_window.contents.draw_text(@x + 120, @y + 165, 212, 32, pdef.to_s, 0)
# Magical Defense
mdef = @item.mdef
@statistics_window.contents.draw_text(@x + 120, @y + 185, 212, 32, mdef.to_s, 0)
# Evasion
eva = @item.eva
@statistics_window.contents.draw_text(@x + 120, @y + 205, 212, 32, eva.to_s, 0)
# Strength
str_plus = @item.str_plus
@statistics_window.contents.draw_text(@x + 120, @y + 225, 212, 32, str_plus.to_s, 0)
# Dexterity
dex_plus = @item.dex_plus
@statistics_window.contents.draw_text(@x + 120, @y + 245, 212, 32, dex_plus.to_s, 0)
# Agility
agi_plus = @item.agi_plus
@statistics_window.contents.draw_text(@x + 120, @y + 265, 212, 32, agi_plus.to_s, 0)
# Intelligence
int_plus = @item.int_plus
@statistics_window.contents.draw_text(@x + 120, @y + 285, 212, 32, int_plus.to_s, 0)
# Create Elements
element = ""
flag = false
for i in @item.guard_element_set
if flag
element += ", "
end
element += $data_system.elements[i]
flag = true
end
if element == ""
element = "None"
end
# Create Status Effects
status = ""
flag = false
for i in @item.guard_state_set
if flag
status += ", "
end
status += $data_states[i].name
flag = true
end
if status == ""
status = "None"
end
# Draw Element And Status Effects
@statistics_window.contents.draw_text(@x + 110, @y + 310, 420, 24, element, 0)
@statistics_window.contents.draw_text(@x + 110, @y + 330, 420, 24, status, 0)
end
#--------------------------------------------------------------------------
# * Frame Update (when item window is active)
#--------------------------------------------------------------------------
def update_item
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(0)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the item window
@item = @item_window.item
# If not a use item
unless @item.is_a?(RPG::Item)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If it can't be used
unless $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)
# If effect scope is an ally
if @item.scope >= 3
# Activate target window
@item_window.active = false
@target_window.visible = true
@target_window.active = true
# Set cursor position to effect scope (single / all)
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end
# If effect scope is other than an ally
else
# If command event ID is valid
if @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)
# Draw item window item
@item_window.draw_item(@item_window.index)
end
# Switch to map screen
$scene = Scene_Map.new
return
end
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when target window is active)
#--------------------------------------------------------------------------
def update_target
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# If unable to use because items ran out
unless $game_party.item_can_use?(@item.id)
# Remake item window contents
@item_window.refresh
end
# Erase target window
@item_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If items are used up
if $game_party.item_number(@item.id) == 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If target is all
if @target_window.index == -1
# Apply item effects to entire party
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# If single target
if @target_window.index >= 0
# Apply item use effects to target actor
target = $game_party.actors[@target_window.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 window item
@item_window.draw_item(@item_window.index)
end
# Remake target window contents
@target_window.refresh
# If all party members are dead
if $game_party.all_dead?
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# 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
$scene = Scene_Map.new
return
end
end
# If item wasn't used
unless used
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end #of class
#==============================================================================
# ** Scene_Battle (part 3)
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Alias' New Game Method
#--------------------------------------------------------------------------
alias con_ais_scene_battle_main main
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make dummy grid window
@dummy_window = Window_Grid_Dummy.new
# Hide dummy window
@dummy_window.visible = false
@dummy_window.opacity = 255
# Call Original Method
con_ais_scene_battle_main
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : item selection)
#--------------------------------------------------------------------------
def update_phase3_item_select
# Make item window visible
@item_window.visible = true
@dummy_window.visible = true
# Update item window
@item_window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# End item selection
end_item_select
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the item window
@item = @item_window.item
# If it can't be used
unless $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)
# Set action
@active_battler.current_action.item_id = @item.id
# Make item window invisible
@item_window.visible = false
# Make dummy window invisible
@dummy_window.visible = false
# If effect scope is single enemy
if @item.scope == 1
# Start enemy selection
start_enemy_select
# If effect scope is single ally
elsif @item.scope == 3 or @item.scope == 5
# Start actor selection
start_actor_select
# If effect scope is not single
else
# End item selection
end_item_select
# Go to command input for next actor
phase3_next_actor
end
return
end
end
#--------------------------------------------------------------------------
# * Start Item Selection
#--------------------------------------------------------------------------
def start_item_select
# Make item window
@item_window = Window_Item.new
# Associate help window
@item_window.help_window = @help_window
# Disable actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
# Show dummy window
@dummy_window.visible = true
@dummy_window.opacity = 160
@dummy_window.x = 144
end
#--------------------------------------------------------------------------
# * End Item Selection
#--------------------------------------------------------------------------
def end_item_select
# Dispose of item window
@item_window.dispose
@item_window = nil
# Hide help window
@help_window.visible = false
# Enable actor command window
@actor_command_window.active = true
@actor_command_window.visible = true
# Hide dummy window
@dummy_window.visible = false
end
end #of class
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
#end