Bag Pockets V1.2
by SowS
by SowS
Introduction
I'm not active here anymore but I decided to share this with you guys.
This script tries to emulate the BAG in the POKéMON games. If you haven't played any POKéMON game, this script is just like KCG_CategorizeItem, and if you still don't know KCG_CategorizeItem, this script categorizes your items. *sigh*
Features
- Categorize your items.
- POKéMON game-like item scene.
Change Log
V1.2
- Fixed the bug where the pocket name doesn't get disposed.
- Rewritten the classes and methods I edited in the equip scene.
- Repositioned the windows in equip scene and battle scene.
V1.1
- Fixed Scene_Equip glitch
- Fixed Scene_Battle glitch
V1
- Initial release
Screenshots
How to Use
CODE
# Instructions:
# Put the script under Materials section of your script editor.
# Put this tag in the notes field of all your items/weapons/armors.
# <pocket n> where n is the pocket number
# Put the script under Materials section of your script editor.
# Put this tag in the notes field of all your items/weapons/armors.
# <pocket n> where n is the pocket number
Script
CODE
#==============================================================================
# Bag Pockets V1.2
# by SowS - 06/11/10
#------------------------------------------------------------------------------
# Instructions:
# Put the script under Materials section of your script editor.
# Put this tag in the notes field of all your items/weapons/armors.
# <pocket n> where n is the pocket number
# >>>>>>>>REMINDER: You need to put the tags in all of your items!<<<<<<<<<
# It's possible to make an item be on multiple pockets, just put multiple tags
# on that particular item.
#==============================================================================
module SOWS
#----------------------------------------------------------------------------
# start of config
#----------------------------------------------------------------------------
MAX_POCKETS = 7 # maximum number of pockets
# these are the names of the pockets and their corresponding pocket numbers
POCKETS = { # id => "Pocket Name"
1 => "Items",
2 => "Weapon",
3 => "Shield",
4 => "Headgear",
5 => "Armor",
6 => "Accessory",
7 => "Key Items"
}
# these are the pockets in the equip scene. They're based on your current
# max number of equip types.
EQUIP_POCKETS = {
1 => "Weapon",
2 => "Shield",
3 => "Headgear",
4 => "Armor",
5 => "Accessory"
}
# The message in the help window while Cancel/Remove is selected.
CANCEL_HELP = "Return to the menu." # in Scene_Item
REMOVE_HELP = "Remove current equipment." # in Scene_Equip
#----------------------------------------------------------------------------
# end of config
#----------------------------------------------------------------------------
def self.split_tags(obj, tag)
obj.note.split(/[\r\n]+/).each { |notetag|
case notetag
when tag
@result = $1.to_i
end }
return @result
end
end
#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
# This window displays a list of inventory items for the item screen, etc.
#==============================================================================
class Window_Item < Window_Selectable
include SOWS
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :page
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
@column_max = 1
self.index = 0
self.page = 1
refresh
end
#--------------------------------------------------------------------------
# * Whether or not to include in item list
# item : item
#--------------------------------------------------------------------------
def include?(item)
return false if item == nil
return false if self.page != item.pocket
if $game_temp.in_battle
return false unless item.is_a?(RPG::Item)
end
return true
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@data = []
for item in $game_party.items
next unless include?(item)
@data.push(item)
if item.id == $game_party.last_item_id
self.index = @data.size - 1
end
end
@data.push(nil) if include?(nil)
@item_max = @data.size + 1
create_contents
for i in 0...@item_max - 1
draw_item(i)
end
draw_cancel
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Input.trigger?(Input::RIGHT)
if self.page == MAX_POCKETS
self.page = 1
else
self.page += 1
end
elsif Input.trigger?(Input::LEFT)
if self.page == 1
self.page = MAX_POCKETS
else
self.page -= 1
end
end
end
#--------------------------------------------------------------------------
# * Draw Cancel
#--------------------------------------------------------------------------
def draw_cancel
rect = item_rect(@item_max - 1)
self.contents.clear_rect(rect)
rect.width -= 4
self.contents.draw_text(rect, "Cancel")
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y)
self.contents.draw_text(rect, sprintf("x%2d", number), 2)
end
end
#--------------------------------------------------------------------------
# * Update Help Text
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(item == nil ? CANCEL_HELP : item.description)
end
end
#==============================================================================
# ** Window_Pocket
#------------------------------------------------------------------------------
# This window displays the current pocket name.
#==============================================================================
class Window_Pocket < Window_Base
include SOWS
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :pocket
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(equip = false, x = 0, y = 0, width = 544 / 2, height = WLH + 32)
super(x, y, width, height)
self.pocket = 1
@equip = equip
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @equip
self.contents.draw_text(0, 0, contents.width, WLH, EQUIP_POCKETS[self.pocket], 1)
else
self.contents.draw_text(0, 0, contents.width, WLH, POCKETS[self.pocket], 1)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Input.trigger?(Input::RIGHT)
if self.pocket == MAX_POCKETS
self.pocket = 1
else
self.pocket += 1
end
elsif Input.trigger?(Input::LEFT)
if self.pocket == 1
self.pocket = MAX_POCKETS
else
self.pocket -= 1
end
end
end
end
#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x = 0, y = 0, width = 544, height = WLH + 32)
super(x, y, width, height)
end
end
#==============================================================================
# ** Window_EquipItem
#------------------------------------------------------------------------------
# This window displays choices when opting to change equipment on the
# equipment screen.
#==============================================================================
class Window_EquipItem < Window_Item
include SOWS
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@data = []
for item in $game_party.items
next unless include?(item)
@data.push(item)
if item.id == $game_party.last_item_id
self.index = @data.size - 1
end
end
@data.push(nil) if include?(nil)
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y)
self.contents.draw_text(rect, sprintf("x%2d", number), 2)
else
self.contents.draw_text(rect, "Remove")
end
end
#--------------------------------------------------------------------------
# * Update Help Text
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(item == nil ? REMOVE_HELP : item.description)
end
end
#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
# This class performs the item screen processing.
#==============================================================================
class Scene_Item < Scene_Base
#--------------------------------------------------------------------------
# * Method Aliasing
#--------------------------------------------------------------------------
alias sows_pocket_update update unless $@
alias sows_pocket_terminate terminate unless $@
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
@viewport = Viewport.new(0, 0, 544, 416)
@help_window = Window_Help.new(0, 416 - 56)
@help_window.viewport = @viewport
@item_window = Window_Item.new(544 / 2, 0, 544 / 2, 360)
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.active = false
@title_window = Window_Pocket.new
@title_window.viewport = @viewport
@target_window = Window_MenuStatus.new(0, 0)
hide_target_window
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
sows_pocket_terminate
@title_window.dispose
end
#--------------------------------------------------------------------------
# * Update Frame
#--------------------------------------------------------------------------
def update
sows_pocket_update
@title_window.update
@item_window.refresh if (Input.repeat?(Input::RIGHT) or Input.repeat?(
Input::LEFT))
@title_window.refresh if (Input.repeat?(Input::RIGHT) or Input.repeat?(
Input::LEFT))
end
#--------------------------------------------------------------------------
# * Update Item Selection
#--------------------------------------------------------------------------
def update_item_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
if @item_window.index == @item_window.item_max - 1
return_scene
else
@item = @item_window.item
$game_party.last_item_id = @item.id
if $game_party.item_can_use?(@item)
Sound.play_decision
determine_item
else
Sound.play_buzzer
end
end
end
end
end
#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs the equipment screen processing.
#==============================================================================
class Scene_Equip < Scene_Base
#--------------------------------------------------------------------------
# * Method Aliasing
#--------------------------------------------------------------------------
alias sows_pocket_terminate terminate unless $@
alias sows_pocket_update update unless $@
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
@actor = $game_party.members[@actor_index]
@help_window = Window_Help.new(0, 416 - 56)
create_item_windows
@equip_window = Window_Equip.new(208, 0, @actor)
@equip_window.help_window = @help_window
@equip_window.index = @equip_index
@status_window = Window_EquipStatus.new(0, 0, @actor)
@title_window = Window_Pocket.new(true, 0, 152)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
sows_pocket_terminate
@title_window.dispose
end
#--------------------------------------------------------------------------
# * Update Frame
#--------------------------------------------------------------------------
def update
sows_pocket_update
@title_window.update
if @equip_window.active
if Input.trigger?(Input::DOWN)
if @title_window.pocket == EQUIP_TYPE_MAX
@title_window.pocket = 1
else
@title_window.pocket += 1
end
@title_window.refresh
elsif Input.trigger?(Input::UP)
if @title_window.pocket == 1
@title_window.pocket = EQUIP_TYPE_MAX
else
@title_window.pocket -= 1
end
@title_window.refresh
end
end
end
#--------------------------------------------------------------------------
# * Create Item Window
#--------------------------------------------------------------------------
def create_item_windows
@item_windows = []
for i in 0...EQUIP_TYPE_MAX
@item_windows[i] = Window_EquipItem.new(544 / 2, 152, 544 / 2, 208, @actor, i)
@item_windows[i].help_window = @help_window
@item_windows[i].visible = (@equip_index == i)
@item_windows[i].height = 208
@item_windows[i].active = false
@item_windows[i].index = -1
end
end
#--------------------------------------------------------------------------
# * Update Status Window
#--------------------------------------------------------------------------
def update_status_window
if @equip_window.active
@status_window.set_new_parameters(nil, nil, nil, nil)
elsif @item_window.active
if @item_window.index == @item_window.item_max - 1
@status_window.set_new_parameters(nil, nil, nil, nil)
else
temp_actor = @actor.clone
temp_actor.change_equip(@equip_window.index, @item_window.item, true)
new_atk = temp_actor.atk
new_def = temp_actor.def
new_spi = temp_actor.spi
new_agi = temp_actor.agi
@status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi)
end
end
@status_window.update
end
#--------------------------------------------------------------------------
# * Update Equip Region Selection
#--------------------------------------------------------------------------
def update_equip_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::R)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::L)
Sound.play_cursor
prev_actor
elsif Input.trigger?(Input::C)
if @actor.fix_equipment
Sound.play_buzzer
else
Sound.play_decision
@equip_window.active = false
@item_window.active = true
@item_window.index = 0
end
end
end
#--------------------------------------------------------------------------
# * Update Item Selection
#--------------------------------------------------------------------------
def update_item_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@equip_window.active = true
@item_window.active = false
@item_window.index = -1
elsif Input.trigger?(Input::C)
Sound.play_equip
@actor.change_equip(@equip_window.index, @item_window.item)
@equip_window.active = true
@item_window.active = false
@item_window.index = -1
@equip_window.refresh
for item_window in @item_windows
item_window.refresh
end
end
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * Method Aliasing
#--------------------------------------------------------------------------
alias sows_pocket_end_item_selection end_item_selection unless $@
alias sows_pocket_update_item_selection update_item_selection unless $@
#--------------------------------------------------------------------------
# * Start Item Selection
#--------------------------------------------------------------------------
def start_item_selection
@help_window = Window_Help.new(0, 416 - 128 - 56)
@item_window = Window_Item.new(544 / 2, 0, 544 / 2, 232)
@item_window.help_window = @help_window
@actor_command_window.active = false
@title_window = Window_Pocket.new
end
#--------------------------------------------------------------------------
# * End Item Selection
#--------------------------------------------------------------------------
def end_item_selection
sows_pocket_end_item_selection
if @title_window != nil
@title_window.dispose
@title_window = nil
end
end
#--------------------------------------------------------------------------
# * Update Item Selection
#--------------------------------------------------------------------------
def update_item_selection
sows_pocket_update_item_selection
@title_window.update if @title_window != nil
end
end
#============================================================================
# ** RPG
#----------------------------------------------------------------------------
# A module containing RPGVX Data Structures.
#============================================================================
module RPG
#==========================================================================
==
# ** Item
#----------------------------------------------------------------------------
# Data class for items.
#==========================================================================
==
class Item < UsableItem
def pocket
str = SOWS.split_tags(self, /<(?:pocket)[ ]*(\d+)>/i)
pocket = str.nil? ? 0 : str.to_i
return pocket
end
end
end
#============================================================================
# ** RPG
#----------------------------------------------------------------------------
# A module containing RPGVX Data Structures.
#============================================================================
module RPG
#==========================================================================
==
# ** Weapon
#----------------------------------------------------------------------------
# Data class for weapons.
#==========================================================================
==
class Weapon < BaseItem
def pocket
str = SOWS.split_tags(self, /<(?:pocket)[ ]*(\d+)>/i)
pocket = str.nil? ? 0 : str.to_i
return pocket
end
end
end
#============================================================================
# ** RPG
#----------------------------------------------------------------------------
# A module containing RPGVX Data Structures.
#============================================================================
module RPG
#==========================================================================
==
# ** Armor
#----------------------------------------------------------------------------
# Data class for armors.
#==========================================================================
==
class Armor < BaseItem
def pocket
str = SOWS.split_tags(self, /<(?:pocket)[ ]*(\d+)>/i)
pocket = str.nil? ? 0 : str.to_i
return pocket
end
end
end
# Bag Pockets V1.2
# by SowS - 06/11/10
#------------------------------------------------------------------------------
# Instructions:
# Put the script under Materials section of your script editor.
# Put this tag in the notes field of all your items/weapons/armors.
# <pocket n> where n is the pocket number
# >>>>>>>>REMINDER: You need to put the tags in all of your items!<<<<<<<<<
# It's possible to make an item be on multiple pockets, just put multiple tags
# on that particular item.
#==============================================================================
module SOWS
#----------------------------------------------------------------------------
# start of config
#----------------------------------------------------------------------------
MAX_POCKETS = 7 # maximum number of pockets
# these are the names of the pockets and their corresponding pocket numbers
POCKETS = { # id => "Pocket Name"
1 => "Items",
2 => "Weapon",
3 => "Shield",
4 => "Headgear",
5 => "Armor",
6 => "Accessory",
7 => "Key Items"
}
# these are the pockets in the equip scene. They're based on your current
# max number of equip types.
EQUIP_POCKETS = {
1 => "Weapon",
2 => "Shield",
3 => "Headgear",
4 => "Armor",
5 => "Accessory"
}
# The message in the help window while Cancel/Remove is selected.
CANCEL_HELP = "Return to the menu." # in Scene_Item
REMOVE_HELP = "Remove current equipment." # in Scene_Equip
#----------------------------------------------------------------------------
# end of config
#----------------------------------------------------------------------------
def self.split_tags(obj, tag)
obj.note.split(/[\r\n]+/).each { |notetag|
case notetag
when tag
@result = $1.to_i
end }
return @result
end
end
#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
# This window displays a list of inventory items for the item screen, etc.
#==============================================================================
class Window_Item < Window_Selectable
include SOWS
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :page
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
@column_max = 1
self.index = 0
self.page = 1
refresh
end
#--------------------------------------------------------------------------
# * Whether or not to include in item list
# item : item
#--------------------------------------------------------------------------
def include?(item)
return false if item == nil
return false if self.page != item.pocket
if $game_temp.in_battle
return false unless item.is_a?(RPG::Item)
end
return true
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@data = []
for item in $game_party.items
next unless include?(item)
@data.push(item)
if item.id == $game_party.last_item_id
self.index = @data.size - 1
end
end
@data.push(nil) if include?(nil)
@item_max = @data.size + 1
create_contents
for i in 0...@item_max - 1
draw_item(i)
end
draw_cancel
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Input.trigger?(Input::RIGHT)
if self.page == MAX_POCKETS
self.page = 1
else
self.page += 1
end
elsif Input.trigger?(Input::LEFT)
if self.page == 1
self.page = MAX_POCKETS
else
self.page -= 1
end
end
end
#--------------------------------------------------------------------------
# * Draw Cancel
#--------------------------------------------------------------------------
def draw_cancel
rect = item_rect(@item_max - 1)
self.contents.clear_rect(rect)
rect.width -= 4
self.contents.draw_text(rect, "Cancel")
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y)
self.contents.draw_text(rect, sprintf("x%2d", number), 2)
end
end
#--------------------------------------------------------------------------
# * Update Help Text
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(item == nil ? CANCEL_HELP : item.description)
end
end
#==============================================================================
# ** Window_Pocket
#------------------------------------------------------------------------------
# This window displays the current pocket name.
#==============================================================================
class Window_Pocket < Window_Base
include SOWS
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :pocket
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(equip = false, x = 0, y = 0, width = 544 / 2, height = WLH + 32)
super(x, y, width, height)
self.pocket = 1
@equip = equip
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @equip
self.contents.draw_text(0, 0, contents.width, WLH, EQUIP_POCKETS[self.pocket], 1)
else
self.contents.draw_text(0, 0, contents.width, WLH, POCKETS[self.pocket], 1)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Input.trigger?(Input::RIGHT)
if self.pocket == MAX_POCKETS
self.pocket = 1
else
self.pocket += 1
end
elsif Input.trigger?(Input::LEFT)
if self.pocket == 1
self.pocket = MAX_POCKETS
else
self.pocket -= 1
end
end
end
end
#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x = 0, y = 0, width = 544, height = WLH + 32)
super(x, y, width, height)
end
end
#==============================================================================
# ** Window_EquipItem
#------------------------------------------------------------------------------
# This window displays choices when opting to change equipment on the
# equipment screen.
#==============================================================================
class Window_EquipItem < Window_Item
include SOWS
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@data = []
for item in $game_party.items
next unless include?(item)
@data.push(item)
if item.id == $game_party.last_item_id
self.index = @data.size - 1
end
end
@data.push(nil) if include?(nil)
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y)
self.contents.draw_text(rect, sprintf("x%2d", number), 2)
else
self.contents.draw_text(rect, "Remove")
end
end
#--------------------------------------------------------------------------
# * Update Help Text
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(item == nil ? REMOVE_HELP : item.description)
end
end
#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
# This class performs the item screen processing.
#==============================================================================
class Scene_Item < Scene_Base
#--------------------------------------------------------------------------
# * Method Aliasing
#--------------------------------------------------------------------------
alias sows_pocket_update update unless $@
alias sows_pocket_terminate terminate unless $@
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
@viewport = Viewport.new(0, 0, 544, 416)
@help_window = Window_Help.new(0, 416 - 56)
@help_window.viewport = @viewport
@item_window = Window_Item.new(544 / 2, 0, 544 / 2, 360)
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.active = false
@title_window = Window_Pocket.new
@title_window.viewport = @viewport
@target_window = Window_MenuStatus.new(0, 0)
hide_target_window
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
sows_pocket_terminate
@title_window.dispose
end
#--------------------------------------------------------------------------
# * Update Frame
#--------------------------------------------------------------------------
def update
sows_pocket_update
@title_window.update
@item_window.refresh if (Input.repeat?(Input::RIGHT) or Input.repeat?(
Input::LEFT))
@title_window.refresh if (Input.repeat?(Input::RIGHT) or Input.repeat?(
Input::LEFT))
end
#--------------------------------------------------------------------------
# * Update Item Selection
#--------------------------------------------------------------------------
def update_item_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
if @item_window.index == @item_window.item_max - 1
return_scene
else
@item = @item_window.item
$game_party.last_item_id = @item.id
if $game_party.item_can_use?(@item)
Sound.play_decision
determine_item
else
Sound.play_buzzer
end
end
end
end
end
#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs the equipment screen processing.
#==============================================================================
class Scene_Equip < Scene_Base
#--------------------------------------------------------------------------
# * Method Aliasing
#--------------------------------------------------------------------------
alias sows_pocket_terminate terminate unless $@
alias sows_pocket_update update unless $@
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
@actor = $game_party.members[@actor_index]
@help_window = Window_Help.new(0, 416 - 56)
create_item_windows
@equip_window = Window_Equip.new(208, 0, @actor)
@equip_window.help_window = @help_window
@equip_window.index = @equip_index
@status_window = Window_EquipStatus.new(0, 0, @actor)
@title_window = Window_Pocket.new(true, 0, 152)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
sows_pocket_terminate
@title_window.dispose
end
#--------------------------------------------------------------------------
# * Update Frame
#--------------------------------------------------------------------------
def update
sows_pocket_update
@title_window.update
if @equip_window.active
if Input.trigger?(Input::DOWN)
if @title_window.pocket == EQUIP_TYPE_MAX
@title_window.pocket = 1
else
@title_window.pocket += 1
end
@title_window.refresh
elsif Input.trigger?(Input::UP)
if @title_window.pocket == 1
@title_window.pocket = EQUIP_TYPE_MAX
else
@title_window.pocket -= 1
end
@title_window.refresh
end
end
end
#--------------------------------------------------------------------------
# * Create Item Window
#--------------------------------------------------------------------------
def create_item_windows
@item_windows = []
for i in 0...EQUIP_TYPE_MAX
@item_windows[i] = Window_EquipItem.new(544 / 2, 152, 544 / 2, 208, @actor, i)
@item_windows[i].help_window = @help_window
@item_windows[i].visible = (@equip_index == i)
@item_windows[i].height = 208
@item_windows[i].active = false
@item_windows[i].index = -1
end
end
#--------------------------------------------------------------------------
# * Update Status Window
#--------------------------------------------------------------------------
def update_status_window
if @equip_window.active
@status_window.set_new_parameters(nil, nil, nil, nil)
elsif @item_window.active
if @item_window.index == @item_window.item_max - 1
@status_window.set_new_parameters(nil, nil, nil, nil)
else
temp_actor = @actor.clone
temp_actor.change_equip(@equip_window.index, @item_window.item, true)
new_atk = temp_actor.atk
new_def = temp_actor.def
new_spi = temp_actor.spi
new_agi = temp_actor.agi
@status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi)
end
end
@status_window.update
end
#--------------------------------------------------------------------------
# * Update Equip Region Selection
#--------------------------------------------------------------------------
def update_equip_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::R)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::L)
Sound.play_cursor
prev_actor
elsif Input.trigger?(Input::C)
if @actor.fix_equipment
Sound.play_buzzer
else
Sound.play_decision
@equip_window.active = false
@item_window.active = true
@item_window.index = 0
end
end
end
#--------------------------------------------------------------------------
# * Update Item Selection
#--------------------------------------------------------------------------
def update_item_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@equip_window.active = true
@item_window.active = false
@item_window.index = -1
elsif Input.trigger?(Input::C)
Sound.play_equip
@actor.change_equip(@equip_window.index, @item_window.item)
@equip_window.active = true
@item_window.active = false
@item_window.index = -1
@equip_window.refresh
for item_window in @item_windows
item_window.refresh
end
end
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * Method Aliasing
#--------------------------------------------------------------------------
alias sows_pocket_end_item_selection end_item_selection unless $@
alias sows_pocket_update_item_selection update_item_selection unless $@
#--------------------------------------------------------------------------
# * Start Item Selection
#--------------------------------------------------------------------------
def start_item_selection
@help_window = Window_Help.new(0, 416 - 128 - 56)
@item_window = Window_Item.new(544 / 2, 0, 544 / 2, 232)
@item_window.help_window = @help_window
@actor_command_window.active = false
@title_window = Window_Pocket.new
end
#--------------------------------------------------------------------------
# * End Item Selection
#--------------------------------------------------------------------------
def end_item_selection
sows_pocket_end_item_selection
if @title_window != nil
@title_window.dispose
@title_window = nil
end
end
#--------------------------------------------------------------------------
# * Update Item Selection
#--------------------------------------------------------------------------
def update_item_selection
sows_pocket_update_item_selection
@title_window.update if @title_window != nil
end
end
#============================================================================
# ** RPG
#----------------------------------------------------------------------------
# A module containing RPGVX Data Structures.
#============================================================================
module RPG
#==========================================================================
==
# ** Item
#----------------------------------------------------------------------------
# Data class for items.
#==========================================================================
==
class Item < UsableItem
def pocket
str = SOWS.split_tags(self, /<(?:pocket)[ ]*(\d+)>/i)
pocket = str.nil? ? 0 : str.to_i
return pocket
end
end
end
#============================================================================
# ** RPG
#----------------------------------------------------------------------------
# A module containing RPGVX Data Structures.
#============================================================================
module RPG
#==========================================================================
==
# ** Weapon
#----------------------------------------------------------------------------
# Data class for weapons.
#==========================================================================
==
class Weapon < BaseItem
def pocket
str = SOWS.split_tags(self, /<(?:pocket)[ ]*(\d+)>/i)
pocket = str.nil? ? 0 : str.to_i
return pocket
end
end
end
#============================================================================
# ** RPG
#----------------------------------------------------------------------------
# A module containing RPGVX Data Structures.
#============================================================================
module RPG
#==========================================================================
==
# ** Armor
#----------------------------------------------------------------------------
# Data class for armors.
#==========================================================================
==
class Armor < BaseItem
def pocket
str = SOWS.split_tags(self, /<(?:pocket)[ ]*(\d+)>/i)
pocket = str.nil? ? 0 : str.to_i
return pocket
end
end
end
Credit
- Credit me. That's all I need.
Compatibility
I didn't test this with other scripts. :/
Paper PokéMaster:
QUOTE
Any script that modifies the equip screen must go under this one.
Also, If you're using Yanfly's Melody Battle Engine or Yanfly's small skill/item window script, the pockets won't work in-battle.
Also, If you're using Yanfly's Melody Battle Engine or Yanfly's small skill/item window script, the pockets won't work in-battle.


